Single-plugin Test Example
- Configure the information of the mxpi_imageresize plugin to be tested in ${MX_SDK_HOME}/toolkit/TestPlugin/config/config.py. The configuration information is as follows:
- If the plugin to be tested is a multi-input plugin, you can set multiple input files for the load configuration item.
- If the plugin to be tested is a multi-output plugin, you can set multiple output files for the dump configuration item.
PipelineConfig = { "stream_config": { "deviceId": "0" }, "factory": "mxpi_imageresize", # Plugin name "props": { # Plugin properties "dataSource": "mxpi_imagedecoder0", "resizeHeight": "416", "resizeWidth": "416" }, "load": [ # Input file name of the load plugin. One input file corresponds to one load plugin. "input/imageresize0.json" ], "dump": [ # Output file name of the dump plugin. One output file corresponds to one dump plugin. "imageresize0-output.json" ] } - Create the data input file input/imageresize0.json for the plugin to be tested.
{ "buffer": { }, "metaData": [{ "key": "ExternalObjects", "protoDataType": "MxpiObjectList" }, { "key": "ReservedFrameInfo", "protoDataType": "MxpiFrameInfo" }, { "key": "ReservedVisionList", "content": "mxpi_imagedecoder0" }, { "key": "mxpi_imagedecoder0", "content": "{\"visionVec\":[{\"visionInfo\":{\"format\":1,\"width\":512,\"height\":512,\"widthAligned\":512,\"heightAligned\":512},\"visionData\":{\"dataPtr\":\"17695267880960\",\"dataSize\":393216,\"memType\":\"MXPI_MEMORY_DVPP\"}}]}", "visionData": [{ "dataPtr": "17695267880960", // dataPtr address corresponding to MxpiVisionData "content": "vLu6ury9vr68vLy8" // Value of the image data on the device after Base64 encoding }], "protoDataType": "MxpiVisionList" }] } - Run the single-plugin test tool to generate the pipeline file of the plugin to be tested and perform a stream test on the plugin. The command is as follows:
chmod +x run.sh && ./run.sh
- The pipeline file is generated by the single-plugin test tool. Run the following commands:
cat pipeline/mxpi_imageresize0.pipeline
{ "TestPlugin": { "stream_config": { "deviceId": "0" }, "mxpi_imageresize0": { "factory": "mxpi_imageresize", "next": [ "mxpi_dumpdata0" ], "props": { "dataSource": "mxpi_imagedecoder0", "resizeHeight": "416", "resizeWidth": "416" } }, "filesrc0": { "factory": "filesrc", "next": "mxpi_loaddata0", "props": { "location": "input/imageresize0.json", "blocksize": "40960000" } }, "mxpi_loaddata0": { "factory": "mxpi_loaddata", "next": "mxpi_imageresize0:0" }, "mxpi_dumpdata0": { "factory": "mxpi_dumpdata", "next": "fakesink0", "props": { "location": "imageresize0-output.json" } }, "fakesink0": { "factory": "fakesink" } } } - Check whether the output file imageresize0-output.json of the plugin to be tested has been generated by the plugin test tool.
- Check the streaming result. If the streaming is successful, a success log is displayed, as shown in Figure 1.
Parent topic: Single-plugin Test Tool
