DBNet.pytorch icon indicating copy to clipboard operation
DBNet.pytorch copied to clipboard

order_points_clockwise,有错误

Open jtcjump opened this issue 5 years ago • 2 comments

order_points_clockwise,某些倾斜角度较大时候,会导致错误,例子:45.45,226.83,11.87,181.79,183.84,13.1,233.79,49.95,

jtcjump avatar Sep 03 '20 09:09 jtcjump

确实。。当初看这个函数的时候就觉得有问题 比如 (100, 0) (200, 100) (100, 200) (0, 100) 这种bbox用这个算法就会出问题 以为训练集里面没有这么极端的例子就没管

toxic-0518 avatar Sep 09 '20 08:09 toxic-0518

+1, 把后处理 def get_mini_boxes()函数里的box四点排序搬过来就可以了~

def order_points_clockwise(pts):
    points = sorted(list(pts), key=lambda x: x[0])
    index_1, index_2, index_3, index_4 = 0, 1, 2, 3
    if points[1][1] > points[0][1]:
        index_1 = 0
        index_4 = 1
    else:
        index_1 = 1
        index_4 = 0
    if points[3][1] > points[2][1]:
        index_2 = 2
        index_3 = 3
    else:
        index_2 = 3
        index_3 = 2

    rect = np.float32([points[index_1], points[index_2], points[index_3], points[index_4]])
    return rect

DYJNG avatar May 25 '21 08:05 DYJNG