From 5a44480f588d172bc86498d0acf1ebe1b10e554c Mon Sep 17 00:00:00 2001 From: flishwnag Date: Wed, 27 May 2020 11:37:00 +0800 Subject: [PATCH] Update map_utils.py (#788) * Update map_utils.py The calculation may be not correct when the input bbox is not ordered by prob. This commit fixes the problem. --- ppdet/utils/map_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ppdet/utils/map_utils.py b/ppdet/utils/map_utils.py index 085556972..a920a5779 100644 --- a/ppdet/utils/map_utils.py +++ b/ppdet/utils/map_utils.py @@ -105,7 +105,8 @@ class DetectionMAP(object): # record class score positive visited = [False] * len(gt_label) - for b in bbox: + score_idx = np.argsort(-bbox[:, 1]) + for b in bbox[score_idx, :]: label, score, xmin, ymin, xmax, ymax = b.tolist() pred = [xmin, ymin, xmax, ymax] max_idx = -1 -- GitLab