Showing confidence levels on bounding boxes within deepstream

Goal: Show confidence level labels on bounding box classifications

Using the DeepStream SSD example, (1) are there ways to edit the example app (e.g., editing the network output layers) to calculate confidence levels (2) if not, are there any other DeepStream examples that show confidence levels, ideally of pedestrians or cars

We will be adding confidence in metadata on DS 5.0 recently.
If you cannot wait the new DS version, you need to modify the source code to achieve you goal.

  1. refer nvinfer is not populating 'confidence' field in NvDsObjectMeta (DS 4.0) to set the confidence value in meta data.
    2.if you want to display confidence using OSD, U can modify gstnvinfer_meta_utils.cpp and modify the label that we set in function attach_metadata_detector , you can append confidence value as string along with the class string.

Thanks for the reply. Ideally, I would want to show the confidence levels using the objectDetector_SSD example that is run using the deepstream reference app.

When I attempted to append the confidence levels to the class string, I saw that the confidence levels were set to 0.0. After commenting out those lines, the confidence levels printed out were still 0.0 in stdout. I was unable to display the confidence levels alongside the class labels.

gstnvinfer_meta_utils.cpp

obj_meta->confidence = obj.confidence;
...
if (obj.label) {
      // Convert confidence level to string
      char buffer[64];
      int ret = snprintf(buffer, sizeof buffer, "%f", obj_meta->confidence);
      // Append confidence to label
      strcat(obj_meta->obj_label, buffer);
      strcat(obj_meta->obj_label, obj.label);
      text_params.display_text = g_strdup (obj_meta->obj_label);
}

After diving into this more, I found that the confidence levels that I do want to display are located in the NvDsInferObjectDetectionInfo object inside the nvdsparsebbox_ssd.cpp.

object.detectionConfidence = det[2];
cout << object.detectionConfidence;

Could you provide guidance as to how to get this confidence level to show on the osd? Specifically, how to pass this information to the function suggested in gstnvinfer_meta_utils.cpp (i.e., way to append the confidence level to the NvDsInferDetectionOutput object)?

Thanks in advance!

Have you applied the patch nvinfer is not populating 'confidence' field in NvDsObjectMeta (DS 4.0)

1 Like

Hi bcao, so how to show confidence value on bounding box when doing object detection using DS 5.0. Are there any example code?