[FFmpeg-cvslog] libavfilter/vf_dnn_detect: Use class confidence to filt boxes

Wenbin Chen git at videolan.org
Sun Jan 28 06:00:55 EET 2024


ffmpeg | branch: master | Wenbin Chen <wenbin.chen at intel.com> | Wed Jan 17 15:21:51 2024 +0800| [d52e8ed114301b44f2a1ff526c6164c43da35749] | committer: Guo Yejun

libavfilter/vf_dnn_detect: Use class confidence to filt boxes

Use class confidence instead of box_score to filt boxes, which is more
accurate. Class confidence is obtained by multiplying class probability
distribution and box_score.

Signed-off-by: Wenbin Chen <wenbin.chen at intel.com>
Reviewed-by: Guo Yejun <yejun.guo at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d52e8ed114301b44f2a1ff526c6164c43da35749
---

 libavfilter/vf_dnn_detect.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
index caccbf7a12..2bf5ed7476 100644
--- a/libavfilter/vf_dnn_detect.c
+++ b/libavfilter/vf_dnn_detect.c
@@ -236,9 +236,6 @@ static int dnn_detect_parse_yolo_output(AVFrame *frame, DNNData *output, int out
                     conf = post_process_raw_data(
                                 detection_boxes_data[cy * cell_w + cx + 4 * cell_w * cell_h]);
                 }
-                if (conf < conf_threshold) {
-                    continue;
-                }
 
                 if (is_NHWC) {
                     x = post_process_raw_data(detection_boxes_data[0]);
@@ -257,6 +254,9 @@ static int dnn_detect_parse_yolo_output(AVFrame *frame, DNNData *output, int out
                     conf = conf * post_process_raw_data(
                                 detection_boxes_data[cy * cell_w + cx + (label_id + 5) * cell_w * cell_h]);
                 }
+                if (conf < conf_threshold) {
+                    continue;
+                }
 
                 bbox = av_mallocz(sizeof(*bbox));
                 if (!bbox)



More information about the ffmpeg-cvslog mailing list