Base Classes for Postprocessing Plugins
A model postprocessing plugin is used to postprocess the output tensor of model inference and write the corresponding result to the metadata. The input and output types required for postprocessing of different inference job types are different. Therefore, different postprocessing plugins are required. To facilitate reuse, Vision SDK has extracted some APIs and members to the postprocessing base class. For each type of tasks, such as object detection, the postprocessing .so file is dynamically loaded to support polymorphism of various models (such as YOLOv3, Faster R-CNN, and SsdVgg-16).
|
Function |
Performs postprocessing on the output tensor after model inference. |
|---|---|
|
Constraints |
The postprocessing plugins can be used after being connected to the mxpi_tensorinfer inference plugin. Only MxpiTensorPackageList can be used as the metadata input. The parent class does not generate plugins, and the subclass inherits the parent class to generate plugins. |
|
Parent Class |
MxModelPostProcessorBase and MxImagePostProcessorBase (image postprocessing base class, inherited from MxModelPostProcessorBase) |
|
Input/Output |
|
|
Port Format (Caps) |
|
|
Property |
For details, see Table 1. |
|
Property Name |
Description |
Mandatory or Not |
Modifiable or Not |
|---|---|---|---|
|
deviceId |
Ascend device ID, which is specified by the deviceId property in the stream_config field. You do not need to set the ID. |
No |
Yes |
|
postProcessLibPath |
Path of the .so file of the postprocessing DLL. If the path is not specified, the model inference result is directly written to the metadata MxpiTensorPackageList and output to the position specified by outputDeviceId. |
Yes |
Yes |
|
labelPath |
Path of the postprocessing class label |
No |
Yes |
|
dataSource |
Index of the input data (generally the name of the upstream element). The default value is the key value of the output port of the upstream plugin. |
No |
Yes |
|
postProcessConfigPath |
Path of the postprocessing configuration file |
Yes |
Yes |
|
postProcessConfigContent |
Postprocessing configuration |
No |
Yes |
|
dataSourceResize |
This property is available only in the subclass plugins that inherit MxImagePostProcessorBase (image postprocessing base class). Whether to map the coordinates in the postprocessing of the model back to the image before resizing. If this property is not set, the value is obtained from the upstream plugin of the inference plugin by default. If the value cannot be obtained, the coordinates are not scaled. |
No |
Yes |
|
dataSourceRoiBoxes |
This property is available only in the subclass plugins that inherit MxImagePostProcessorBase (image postprocessing base class). Specifies whether to map the coordinates of the model inference to the source image before cropping. If this property is not set, the image is not mapped to the source image by default. To map the image, set the property to the name of the image cropping plugin. |
No |
Yes |
|
funcLanguage |
Development language of the postprocessing plugin, that is, C++ or Python |
No |
Yes |
|
className |
Postprocessing class name |
Yes |
Yes |
|
pythonModule |
Name of the loaded postprocessing module, which is the same as the module name in Python or .so file |
Yes |
Yes |
|
dataSourceImage |
It is under internal debugging. Do not use it. |
No |
No |
|
Property Name |
Description |
Mandatory or Not |
Modifiable or Not |
|---|---|---|---|
|
funcLanguage |
Development language of the postprocessing plugin, that is, C++ or Python |
No |
Yes |
|
postProcessLibPath |
Directory of the postprocessing DLL .so file. This directory contains the postprocessing Python file or .so file |
Yes |
Yes |
|
className |
Postprocessing class name |
Yes |
Yes |
|
pythonModule |
Name of the loaded postprocessing module, which is the same as the module name in Python or .so file |
Yes |
Yes |
|
labelPath |
Path of the postprocessing class label |
No |
Yes |
|
dataSource |
Index of the input data (generally the name of the upstream element). |
Yes |
Yes |
|
postProcessConfigPath |
Path of the postprocessing configuration file |
Yes |
Yes |
|
deviceId |
Ascend device ID, which is specified by the deviceId property in the stream_config field. You do not need to set the ID. |
No |
Yes |
|
dataSourceResize |
This property is available only in the subclass plugins that inherit MxImagePostProcessorBase (image postprocessing base class). Whether to map the coordinates in the postprocessing of the model back to the image before resizing. If this property is not set, the value is obtained from the upstream plugin of the inference plugin by default. If the value cannot be obtained, the coordinates are not scaled. |
No |
Yes |
|
dataSourceRoiBoxes |
This property is available only in the subclass plugins that inherit MxImagePostProcessorBase (image postprocessing base class). Specifies whether to map the coordinates of the model inference to the source image before cropping. If this property is not set, the image is not mapped to the source image by default. To map the image, set the property to the name of the image cropping plugin. |
No |
Yes |