Primary classifier class_id=-1 and result_prob=0.58 for all frames

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson Nano
• DeepStream Version 5.0
• JetPack Version (valid for Jetson only) 4.4
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)

I am trying to use a resnet18 classification model as my primary model with deepstream. I keep getting class_id = -1 for all frames, and when I go to obj_meta->class_meta->label_info the result_prob is always 0.583008 or 0.583496.

Any tips for how to debug this?

Here is my inference config:

process-mode=1 # Process full frames
network-type=1 # Classifier
network-mode=2 # FP16
1 Like

@Morganh I’m having the same issue – maybe you can help with this?

I’ve exported a model from TLT 2.0 for classification (just a simple multi-label classification with 2 classes). When I test this model using tlt-infer within the TLT notebook and with the pruned model, the results are great. However after I export the model and attempt to run it using Deepstream 5.0, the class_id is always -1 for every frame. What can cause this -1 output? The documentation doesn’t provide much indication on if this is from an input error, model error, config error etc.


1 Like

It results from deepstream application. You can check the code of deepstream applications.

…we cannot look at the deepstream reference application code and see where this class_id is being set to -1. Can you point me to a specific location?

I’ll answer this for you though as we have finally figured it out…

We had to manually debug the deepstream application using gdb and eventually found that class_id is being set to -1, as shown by @mattcarp88 in another thread:
Simple classifier as Primary GIE

The useful data for this multi-label classification is at:

What was confusing was that the documentation (NVIDIA DeepStream SDK API Reference) states the following for gint _NvDsObjectMeta::class_id:

This is misleading because we were expecting to see the inferred class ID at this part of the metadata, but it was always showing as -1.

Is this a bug, or is this the intended behavior? The documentation is not very helpful here… If this behavior is not a bug, then I would recommend that either the documentation gets updated, or that a more useful reference application for multi-label classification as pgie be provided.

The class_id set to -1 if nvinfer work as primary gie mode.
The classification info will be found inside the NvDsClassifierMeta for the object

Can the documentation be updated to reflect this? The screenshot I posted above implies that we will see the class index inferred by the detector/classifier. I believe it should say something more like: Holds the index of the object class inferred by the primary detector when using object detection. If using a classifier as primary, see NvDsClassifierMeta.