Good day, I have been struggling with deploying my custom classification model (yolov8-cls) on Deepsteam.
When I run the pipeline, the SGIE was built successfully, and the program is able to run. I can see that the SGIE has in influence, because I can see that there is a label that is added to the text of the bounding boxes. Please see the image below that demonstrates this:
I also added a few print statements in the shared library that displays the attribute that has the highest confidence (Attributes are either Male of Female) and its confidence. I saw that every single classification has a confidence of 1 and every classification is a male…I am not sure what the issue is because I used a different script to test the onnx model and it works perfectly. Below is a description of all relevant information (how the model has been trained, the configuration file for the SGIE, the C++ script that creates the shared library and also the onnx model itself.)
Here is how I have trained and exported the onnx model:
Here is the C++ file that was used to create the shared library: nvdsinfer_customparser.zip (31.7 KB)
[please note: I adjusted the Makefile so that the “SRCFILES” only contains the “nvdsinfer_customclassifierparser.cpp” file. I also adjusted the labels in the “nvdsinfer_customclassifierparser.cpp” file so that the labels are “male” and “female”. I also added two print statements that prints the confidence score of both the classes.]
ERROR: [TRT]: 3: Cannot find binding of given name: predictions/Softmax
0:00:11.265900727 4712 0xaaaae005d670 WARN nvinfer gstnvinfer.cpp:679:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::checkBackendParams() <nvdsinfer_context_impl.cpp:1955> [UID = 1]: Could not find output layer ‘predictions/Softmax’ in engine
0:00:11.265956408 4712 0xaaaae005d670 INFO nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2091> [UID = 1]: Use deserialized engine model: /home/aizatron/repos/RnD-video-tracking/models/Onnx/genderClassification.onnx_b16_gpu0_fp32.engine
0:00:11.421424000 4712 0xaaaae005d670 ERROR nvinfer gstnvinfer.cpp:676:gst_nvinfer_logger: NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::readMeanImageFile() <nvdsinfer_context_impl.cpp:189> [UID = 1]: Mismatch between ppm mean image resolution(224 x 224) and network resolution(320 x 320)
0:00:11.421471553 4712 0xaaaae005d670 ERROR nvinfer gstnvinfer.cpp:676:gst_nvinfer_logger: NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::allocateResource() <nvdsinfer_context_impl.cpp:253> [UID = 1]: Failed to read mean image file
0:00:11.421490721 4712 0xaaaae005d670 ERROR nvinfer gstnvinfer.cpp:676:gst_nvinfer_logger: NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::preparePreprocess() <nvdsinfer_context_impl.cpp:1032> [UID = 1]: preprocessor allocate resource failed
ERROR: Infer Context prepare preprocessing resource failed., nvinfer error:NVDSINFER_CONFIG_FAILED
0:00:11.430064057 4712 0xaaaae005d670 WARN nvinfer gstnvinfer.cpp:898:gst_nvinfer_start: error: Failed to create NvDsInferContext instance
0:00:11.430648388 4712 0xaaaae005d670 WARN nvinfer gstnvinfer.cpp:898:gst_nvinfer_start: error: Config file path: ./dstest_appsrc_config.txt, NvDsInfer Error: NVDSINFER_CONFIG_FAILED
ERROR: Pipeline doesn’t want to pause.
ERROR: from element /GstPipeline:pipeline0/GstNvInfer:nvinfer0: Failed to create NvDsInferContext instance
Additional debug info:
/dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(898): gst_nvinfer_start (): /GstPipeline:pipeline0/GstNvInfer:nvinfer0:
Config file path: ./dstest_appsrc_config.txt, NvDsInfer Error: NVDSINFER_CONFIG_FAILED
Setting pipeline to NULL …
Freeing pipeline …
The only changes that I have made to the config file (dstest_appsrc_config.txt) is to change the path to the model_engine_file (model-engine-file=/home/aizatron/repos/RnD-video-tracking/models/Onnx/genderClassification.onnx_b16_gpu0_fp32.engine) and I changed the number of detected classes to 2 (num-detected-classes=2)
There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks
please update the content of sgie_config_YOLO_GENDER_CLASSIFICATION.txt to dstest_appsrc_config.txt mentioned in the FAQ .