From 6c6516c5572d7b2b3d4d3d6f7bdfa991034e0f26 Mon Sep 17 00:00:00 2001 From: Pavan Tripathi <88571564+PaVaNTrIpAtHi@users.noreply.github.com> Date: Wed, 17 May 2023 21:39:11 +0530 Subject: [PATCH] Update nanodet.cpp To ensure confidence values are in the correct range and will fill the difference in confidence value changes in python and cpp output. Eg. This solved my issue where the nanodet python code was giving 95% confidence on a detection whereas the cpp code was giving >200% confidence on the same detection --- demo_ncnn/nanodet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demo_ncnn/nanodet.cpp b/demo_ncnn/nanodet.cpp index 6b5c2cb92..c5bde52f6 100644 --- a/demo_ncnn/nanodet.cpp +++ b/demo_ncnn/nanodet.cpp @@ -160,9 +160,9 @@ void NanoDet::decode_infer(ncnn::Mat& feats, std::vector& center_pr int cur_label = 0; for (int label = 0; label < this->num_class; label++) { - if (scores[label] > score) + if (sigmoid(scores[label]) > score) { - score = scores[label]; + score = sigmoid(scores[label]); cur_label = label; } }