Skip to content

Commit d4d66a8

Browse files
authored
Update predict_det.py
"order_points_clockwise" could cause some bugs when points have more than one max values
1 parent af75f43 commit d4d66a8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/infer/predict_det.py

+3
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ def __init__(self, args, logger=None):
171171
def order_points_clockwise(self, pts):
172172
rect = np.zeros((4, 2), dtype="float32")
173173
s = pts.sum(axis=1)
174+
sorted_s = np.sort(s)
175+
if sorted_s[0] == sorted_s[1] or sorted_s[2] == sorted_s[3]:
176+
return pts
174177
rect[0] = pts[np.argmin(s)]
175178
rect[2] = pts[np.argmax(s)]
176179
tmp = np.delete(pts, (np.argmin(s), np.argmax(s)), axis=0)

0 commit comments

Comments
 (0)