How to Address Unqualified Model Inference Accuracy Due to Attribute Parsing Failure with the Operator Plugin?
Symptom
The Caffe model contains a custom operator and has been successfully converted to an offline model using ATC. However, the model inference accuracy is not as expected.
Possible Cause
Although the model conversion using the ATC tool is successful, the custom operator's attributes fail to be parsed.
A possible cause is that the operator attributes are not defined in custom.proto, and attribute obtaining failures are not properly handled in the implementation of the parsing function of the custom operator plugin.
Troubleshooting
- Check the implementation logic of the parsing function of the custom operator plugin and confirm that a proper handling mechanism is available to deal with GetAttr failures.
If not, modify the logic of the parsing function of the operator plugin. For example, if a required operator attribute fails to be obtained, a failure message should be returned.
- View the log messages relating to the model conversion using the ATC tool.
Perform the model conversion again using ATC and set the log level to WARNING. That is, add the --log=warning option to the atc command.
After the model conversion is complete, view logs of the operating environment. For details about the log path, see Log Reference.
Search for the following log message:
[INFO] GE(15435,atc):2020-08-04-11:35:28.253.770 [framework/domi/parser/caffe/caffe_custom_parser_adapter.cc:58]15435 ParseParams:Caffe custom op begin to params: layer name = leakyrelu, layer type= LeakyReLUDemo [WARNING] GE(15435,atc):2020-08-04-11:35:28.253.785 [common/graph/./operator.cc:970]15435 GetAttr:get attr name negative_slope failed.
If the preceding message is printed, parsing of the operator attributes fails. Check the plugin parsing code by referring to Plugin Development (Caffe).