From: MyungJoo Ham Date: Wed, 9 Aug 2023 02:10:35 +0000 (+0900) Subject: fix: decoder/bounding-box mobilenet threshold logic X-Git-Tag: accepted/tizen/unified/20230818.183539~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c8785be83119e1fb8560d904cfbbe3888955fdc;p=platform%2Fupstream%2Fnnstreamer.git fix: decoder/bounding-box mobilenet threshold logic Let's not ignore labels that may have larger score after the first label exceeding the threshold. Fixes #4137 Signed-off-by: MyungJoo Ham --- diff --git a/ext/nnstreamer/tensor_decoder/tensordec-boundingbox.c b/ext/nnstreamer/tensor_decoder/tensordec-boundingbox.c index 4ae47fc..44023a1 100644 --- a/ext/nnstreamer/tensor_decoder/tensordec-boundingbox.c +++ b/ext/nnstreamer/tensor_decoder/tensordec-boundingbox.c @@ -1391,6 +1391,7 @@ update_centroids (void **pdata, GArray * boxes) #define _get_object_i_mobilenet_ssd(bb, index, total_labels, boxprior, boxinputptr, detinputptr, result) \ do { \ unsigned int c; \ + gfloat highscore = -FLT_MAX; \ properties_MOBILENET_SSD *data = &bb->mobilenet_ssd; \ float sigmoid_threshold = data->sigmoid_threshold; \ float y_scale = data->params[MOBILENET_SSD_PARAMS_Y_SCALE_IDX]; \ @@ -1411,14 +1412,15 @@ update_centroids (void **pdata, GArray * boxes) int y = ymin * bb->i_height; \ int width = w * bb->i_width; \ int height = h * bb->i_height; \ - result->class_id = c; \ - result->x = MAX (0, x); \ - result->y = MAX (0, y); \ - result->width = width; \ - result->height = height; \ - result->prob = score; \ - result->valid = TRUE; \ - break; \ + if (highscore < score) { \ + result->class_id = c; \ + result->x = MAX (0, x); \ + result->y = MAX (0, y); \ + result->width = width; \ + result->height = height; \ + result->prob = score; \ + result->valid = TRUE; \ + } \ } \ } \ } while (0);