Deepstream v4: zero confidence problem

Hi,

I’m using “/deepstream-4.0/sources/objectDetector_Yolo/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp” as a custom parser. My problem is in “attach_metadata_detector” function in file : “gst-nvinfer/gstnvinfer_meta_utils.cpp” #Ln83 :
obj_meta->confidence = 0.0;

How can I change this to get the confidence calculated before in “nvdsparsebbox_Yolo.cpp” ??
Is there any way to access NvDsInferObjectDetectionInfo object from “attach_metadata_detector” function ??

Thanks.

Get confidence here:

nvdsinfer_context_impl_output_parsing.cpp

parseBoundingBox() {
    ...
objectList.push_back({ classIndex, (unsigned int) rectX1,
                        (unsigned int) rectY1, (unsigned int) (rectX2 - rectX1),
                        (unsigned int) (rectY2 - rectY1), confidence});
...
}

I think you can add “confidence” parameters in “NvDsInferObject”
and set the value in “NvDsInferContextImpl::clusterAndFillDetectionOutputCV”
and then it can get confidence in “attach_metadata_detector()”

Thanks a lot. I’ll try it and let you know how it goes.

I couldn’t make it work. I’ve added “confidence” parameters in “NvDsInferObject” and modified “NvDsInferContextImpl::clusterAndFillDetectionOutputCV” :

for (unsigned int c = 0; c < m_NumDetectedClasses; c++)
    {

        /* Add coordinates and class ID and the label of all objects
         * detected in the frame to the frame output. */
        for (auto & rect:m_PerClassCvRectList[c])
        {
            NvDsInferObject &object = output.objects[output.numObjects];
            object.left = rect.x;
            object.top = rect.y;
            object.width = rect.width;
            object.height = rect.height;
	    object.confidence = 0.5;
            object.classIndex = c;
            object.label = nullptr;
            if (c < m_Labels.size() && m_Labels[c].size() > 0)
                object.label = strdup(m_Labels[c][0].c_str());
            output.numObjects++;
        }
    }

Also, I modified “attach_metadata_detector()” :

obj_meta->confidence = obj.confidence;

I rebuild “nvdsinfer” and “gst-nvinfer” libraries.

However, I get :
confidence = 4747328616950188978942771200.000000

This doesn’t make any sense.

Did I missed something ??

I tried to set the values of object.left, object.top, object.width, object.height to zero in “NvDsInferContextImpl::clusterAndFillDetectionOutputCV” function.
I rebuild everything.
I still got non null bbox detections (which doesn’t suppose to happen).
This means that “NvDsInferContextImpl::clusterAndFillDetectionOutputCV” doesn’t do anything.
I even tried modifying “NvDsInferContextImpl::clusterAndFillDetectionDBSCAN” function and still got the same results.

I’m out of ammo on this one.

I’d appreciate any help possible.

Edir : It finally worked. Anyone having the same problem refer to : https://devtalk.nvidia.com/default/topic/1058661/deepstream-sdk/nvinfer-is-not-populating-confidence-field-in-nvdsobjectmeta-ds-4-0-/post/5373361/?offset=13#5373383.

attach nvinfer process here. DBScan have confidence, but not for opencv. I think you can try to add confidence as my comment 2. We will fix this issue in the next version.

Hi ChrisDing,

is it possible to fix confidence problem without modifying the SDK after every new version release??

Thanks

I checked 4.0.2 code, confidence has not been added.
5.0 will add it.

Hi ChrisDing,

Do you know when the 5.0 version will be realeased ?

Thanks

5.0 is under development and will be announced in the next few months.