From 3bcc32ffdc997385f35b51f8b3dc2c437349b6ae Mon Sep 17 00:00:00 2001 From: Micaela Verucchi Date: Tue, 15 Feb 2022 19:57:57 +0100 Subject: [PATCH] Fix nms thresh Signed-off-by: Micaela Verucchi --- src/Yolo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Yolo.cpp b/src/Yolo.cpp index deffbeb..db14774 100644 --- a/src/Yolo.cpp +++ b/src/Yolo.cpp @@ -278,6 +278,7 @@ void Yolo::mergeDetections(Yolo::detection *dets, int ndets, int classes, double } total = k+1; + float thresh = 0.45f; for(k = 0; k < classes; ++k){ for(i = 0; i < total; ++i){ dets[i].sort_class = k; @@ -288,9 +289,9 @@ void Yolo::mergeDetections(Yolo::detection *dets, int ndets, int classes, double box a = dets[i].bbox; for(j = i+1; j < total; ++j){ box b = dets[j].bbox; - if (nsm_kind == GREEDY_NMS && yolo_box_iou(a, b) > nms_thresh) + if (nsm_kind == GREEDY_NMS && yolo_box_iou(a, b) > thresh) dets[j].prob[k] = 0; - else if (nsm_kind == DIOU_NMS && yolo_box_diou(a, b, nms_thresh) > nms_thresh) + else if (nsm_kind == DIOU_NMS && yolo_box_diou(a, b, nms_thresh) > thresh) dets[j].prob[k] = 0; } }