Correct box format in documentation for batch_iou.
This commit is contained in:
parent
7fc1ce2855
commit
3f548c04e7
1 changed files with 14 additions and 14 deletions
28
sort.py
28
sort.py
|
@ -44,20 +44,20 @@ def linear_assignment(cost_matrix):
|
|||
return np.array(list(zip(x, y)))
|
||||
|
||||
|
||||
def iou_batch(bb_test, bb_gt):
|
||||
"""
|
||||
From SORT: Computes IUO between two bboxes in the form [l,t,w,h]
|
||||
"""
|
||||
bb_gt = np.expand_dims(bb_gt, 0)
|
||||
bb_test = np.expand_dims(bb_test, 1)
|
||||
|
||||
xx1 = np.maximum(bb_test[..., 0], bb_gt[..., 0])
|
||||
yy1 = np.maximum(bb_test[..., 1], bb_gt[..., 1])
|
||||
xx2 = np.minimum(bb_test[..., 2], bb_gt[..., 2])
|
||||
yy2 = np.minimum(bb_test[..., 3], bb_gt[..., 3])
|
||||
w = np.maximum(0., xx2 - xx1)
|
||||
h = np.maximum(0., yy2 - yy1)
|
||||
wh = w * h
|
||||
def iou_batch(bb_test, bb_gt):
|
||||
"""
|
||||
From SORT: Computes IUO between two bboxes in the form [x1,y1,x2,y2]
|
||||
"""
|
||||
bb_gt = np.expand_dims(bb_gt, 0)
|
||||
bb_test = np.expand_dims(bb_test, 1)
|
||||
|
||||
xx1 = np.maximum(bb_test[..., 0], bb_gt[..., 0])
|
||||
yy1 = np.maximum(bb_test[..., 1], bb_gt[..., 1])
|
||||
xx2 = np.minimum(bb_test[..., 2], bb_gt[..., 2])
|
||||
yy2 = np.minimum(bb_test[..., 3], bb_gt[..., 3])
|
||||
w = np.maximum(0., xx2 - xx1)
|
||||
h = np.maximum(0., yy2 - yy1)
|
||||
wh = w * h
|
||||
o = wh / ((bb_test[..., 2] - bb_test[..., 0]) * (bb_test[..., 3] - bb_test[..., 1])
|
||||
+ (bb_gt[..., 2] - bb_gt[..., 0]) * (bb_gt[..., 3] - bb_gt[..., 1]) - wh)
|
||||
return(o)
|
||||
|
|
Loading…
Reference in a new issue