“6893d151b91ed1916d816be8c5b9023922abb2d5”上不存在“PPOCRLabel/git@gitcode.net:s920243400/PaddleOCR.git”
提交 2103753d 编写于 作者: L LDOUBLEV

sorted

上级 51640f62
...@@ -116,6 +116,9 @@ def sorted_boxes(dt_boxes): ...@@ -116,6 +116,9 @@ def sorted_boxes(dt_boxes):
sorted boxes(array) with shape [4, 2] sorted boxes(array) with shape [4, 2]
""" """
num_boxes = dt_boxes.shape[0] num_boxes = dt_boxes.shape[0]
if abs(num_boxes - 2) < 1e-4:
sorted_boxes = sorted(dt_boxes, key=lambda x: (x[1], x[0]))
else:
sorted_boxes = sorted(dt_boxes, key=lambda x: (x[0][1], x[0][0])) sorted_boxes = sorted(dt_boxes, key=lambda x: (x[0][1], x[0][0]))
_boxes = list(sorted_boxes) _boxes = list(sorted_boxes)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册