Classes mismatch error on Deepstream

Hi,
I am working on tiny yolov3 model on Deepstream with custom dataset.
When I try objectDetector_Yolo project, I change the network model with yolov3 network trained with classes.
I changed the code as follow:
config_infer_primary_yoloV3._tiny.txt

num-detected-classes=80 =>>  num-detected-classes=1

label.txt

person

nvdsparsebbox_Yolo.cpp

static const int NUM_CLASSES_YOLO = 80; =>> static const int NUM_CLASSES_YOLO = 1;

However, when running deepstream-app -c deepstream_app_config_yoloV3_tiny.txt , I can load the model and build the TensorRT Engine, but still have an error of class mismatch. Can you help me?

vamsisiddharthasiddhu2041@linux:/opt/nvidia/deepstream/deepstream-5.1/sources/objectDetector_Yolo$ deepstream-app -c deepstream_app_config_yoloV3_tiny.txt
Unknown or legacy key specified ‘is-classifier’ for group [property]
gstnvtracker: Loading low-level lib at /opt/nvidia/deepstream/deepstream-5.1/lib/libnvds_mot_klt.so
gstnvtracker: Optional NvMOT_RemoveStreams not implemented
gstnvtracker: Batch processing is OFF
gstnvtracker: Past frame output is OFF
0:00:05.438217137 32204 0x1f530600 INFO nvinfer gstnvinfer.cpp:619:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1702> [UID = 1]: deserialized trt engine from :/opt/nvidia/deepstream/deepstream-5.1/sources/objectDetector_Yolo/yolov3/yolov3-tiny-608_fp16.trt
INFO: [Implicit Engine Info]: layers num: 3
0 INPUT kFLOAT 000_net 3x608x608
1 OUTPUT kFLOAT 016_convolutional 18x19x19
2 OUTPUT kFLOAT 023_convolutional 18x38x38

0:00:05.438408651 32204 0x1f530600 INFO nvinfer gstnvinfer.cpp:619:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1806> [UID = 1]: Use deserialized engine model: /opt/nvidia/deepstream/deepstream-5.1/sources/objectDetector_Yolo/yolov3/yolov3-tiny-608_fp16.trt
0:00:05.461123141 32204 0x1f530600 INFO nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary_gie> [UID 1]: Load new model:/opt/nvidia/deepstream/deepstream-5.1/sources/objectDetector_Yolo/config_infer_primary_yoloV3_tiny.txt sucessfully

Runtime commands:
h: Print this help
q: Quit

    p: Pause
    r: Resume

NOTE: To expand a source in the 2D tiled display and view object details, left-click on the source.
To go back to the tiled display, right-click anywhere on the window.

**PERF: FPS 0 (Avg)
**PERF: 0.00 (0.00)
** INFO: <bus_callback:181>: Pipeline ready

Opening in BLOCKING MODE
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
** INFO: <bus_callback:167>: Pipeline running

WARNING: Num classes mismatch. Configured:1, detected by network: 80
Segmentation fault (core dumped)

I am enclosing Screenshot of the error. Please help me to sort out this error. Thanks in advance.

Hi,

Do you also generate the TensorRT engine with the same Deepstream sample?
If not, please give it a try.

Here is our output dimension for a default YOLOv3 Tiny 416x416 model.

INFO: [Implicit Engine Info]: layers num: 3
0   INPUT  kFLOAT data            3x416x416       
1   OUTPUT kFLOAT yolo_17         255x13x13       
2   OUTPUT kFLOAT yolo_24         255x26x26 

You will also need to adjust the output dimension as well.
Please check this document for the customizing guidance:
https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_custom_YOLO.html

Thanks.

Hi,.
I have created TensorRT engine and also followed the steps given in the Custom yolo model in the deepstream document. Still getting same warning .Please help me to sort out this error. Thanks in advance.

Please change number of classes in yolo.cfg file also

If that doesn’t solve it, you can re-train custom yolo model with the required classes or even check if there are errors when you made a custom model. Here is a video for that YOLOv3 in the CLOUD : Install and Train Custom Object Detector (FREE GPU) - YouTube

Sir,
Actually i am using custom dataset. I trained the model with one class. And when I tried to execute deepstream app with those customised model, it is showing that classes mismatch warning. I don’t know why it is showing like that. I have updated the number of classes to 1 in config file, nvdsparsebbox_Yolo.cpp file also. Still showing same warning. Please help me to sort out this error.
Thanks

Please follow these steps to implement custom model : https://github.com/marcoslucianops/DeepStream-Yolo/blob/master/customModels.md