From 0560a138b2cd9d009ea1d0483402609f1b52a03b Mon Sep 17 00:00:00 2001 From: Double_V Date: Mon, 27 Jun 2022 09:08:16 +0800 Subject: [PATCH] Merge pull request #6625 from ynjang/ynjang update sorted_boxes --- tools/infer/predict_system.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/infer/predict_system.py b/tools/infer/predict_system.py index 73b7155b..3f322ecc 100755 --- a/tools/infer/predict_system.py +++ b/tools/infer/predict_system.py @@ -120,11 +120,14 @@ def sorted_boxes(dt_boxes): _boxes = list(sorted_boxes) for i in range(num_boxes - 1): - if abs(_boxes[i + 1][0][1] - _boxes[i][0][1]) < 10 and \ - (_boxes[i + 1][0][0] < _boxes[i][0][0]): - tmp = _boxes[i] - _boxes[i] = _boxes[i + 1] - _boxes[i + 1] = tmp + for j in range(i, 0, -1): + if abs(_boxes[j + 1][0][1] - _boxes[j][0][1]) < 10 and \ + (_boxes[j + 1][0][0] < _boxes[j][0][0]): + tmp = _boxes[j] + _boxes[j] = _boxes[j + 1] + _boxes[j + 1] = tmp + else: + break return _boxes -- GitLab