nms_score_threshold smaller than 0.5

Good afternoon,

I am using this repository for detection. In the file object_detection_utils.py, there is a function called extract_detections. It is stated that by default, detections are extracted from a threshold of 0.5. However, when I lower this threshold in the code to 0.2, for example, nothing changes, and detections are still extracted from 0.5.

Could you please let me know if there is a way to change this threshold? In my case, NMS is set to 0.2 in the .hef file, but for some reason, I still can’t extract detections below 0.5. Is it possible to modify this threshold to a lower value?

Hi @Anton_Sema
What model are you using? Is it from the Hailo model zoo?

I suspect the issue comes from the fact that the example model has the NMS built in.

The IoU is set to 0.60.

Run the following command to confirm:

hailortcli parse-hef yolov7.hef
Architecture HEF was compiled for: HAILO8
Network group name: yolov7, Multi Context - Number of contexts: 5
    Network name: yolov7/yolov7
        VStream infos:
            Input  yolov7/input_layer1 UINT8, NHWC(640x640x3)
            Output yolov5_nms_postprocess FLOAT32, HAILO NMS BY CLASS(number of classes: 80, maximum bounding boxes per class: 80, maximum frame size: 128320)
            Operation:
                Op YOLOV5
                Name: YOLOv5-Post-Process
                Score threshold: 0.001
                IoU threshold: 0.60
                Classes: 80
                Cross classes: false
                NMS results order: BY_CLASS
                Max bboxes per class: 80
                Image height: 640
                Image width: 640

NMS is handled by HailoRT before your app gets the data. You would need to change the NMS settings inside the HEF. I do not think you can do this after creation of the HEF file. So you would need to do this during model conversion.

I think the threshold @Anton_Sema is referring to is score threshold and not IoU as the object_detection_utils.py script filters based on score threshold.

@shashi Yes, you are right.

OK, are you sure it is an issue with the score itself. I noted there is a min-score parameter in the draw_detections function. It is set to 0.45 by default. How do you determine that “nothing changes”? Do you look at the data or the drawing?

"Architecture HEF was compiled for: HAILO8L
Network group name: best, Multi Context - Number of contexts: 6
Network name: best/best
VStream infos:
Input best/input_layer1 UINT8, NHWC(640x640x3)
Output best/yolov8_nms_postprocess FLOAT32, HAILO NMS BY CLASS(number of classes: 1, maximum bounding boxes per class: 100, maximum frame size: 2004)
Operation:
Op YOLOV8
Name: YOLOV8-Post-Process
Score threshold: 0.200
IoU threshold: 0.70
Classes: 1
Cross classes: false
NMS results order: BY_CLASS
Max bboxes per class: 100
Image height: 640
Image width: 640
" This is what my header looks like. The problem is that I can’t change the NMS value during inference—it always stays at 0.5. I’ve tried many things, but I couldn’t find a solution. I don’t understand what the issue is

Hi @Anton_Sema
We developed PySDK, a python package, to make it easier to develop applications with Hailo devices. You can follow the instructions at: User Guide 3: Simplifying Object Detection on a Hailo Device Using DeGirum PySDK