From 4711d88a2f763aa1922302806b84b96d0ba7a70c Mon Sep 17 00:00:00 2001 From: jerrywgz Date: Wed, 20 Feb 2019 08:19:01 +0000 Subject: [PATCH] fix nms unittest in py36, test=develop --- .../paddle/fluid/tests/unittests/test_multiclass_nms_op.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py b/python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py index 8fc391a1ff2..69e060341ed 100644 --- a/python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py +++ b/python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py @@ -173,13 +173,16 @@ def lod_multiclass_nms(boxes, scores, background, score_threshold, normalized, shared=False) if nmsed_num == 0: - #lod.append(1) continue lod.append(nmsed_num) + tmp_det_out = [] for c, indices in nmsed_outs.items(): for idx in indices: xmin, ymin, xmax, ymax = box[idx, c, :] - det_outs.append([c, score[idx][c], xmin, ymin, xmax, ymax]) + tmp_det_out.append([c, score[idx][c], xmin, ymin, xmax, ymax]) + sorted_det_out = sorted( + tmp_det_out, key=lambda tup: tup[0], reverse=False) + det_outs.extend(sorted_det_out) if len(lod) == 0: lod.append(1) -- GitLab