Skip to content

Commit 3fd44f9

Browse files
committed
Bug fixes
1 parent 16f9b09 commit 3fd44f9

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

motrackers/simple_tracker2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class SimpleTracker2:
99
"""
10-
Greedy Tracker with class label check.
10+
Simple Tracker.
1111
"""
1212
def __init__(self, max_lost=5):
1313
"""

motrackers/utils/misc.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ def get_centroid(bounding_box):
2424

2525

2626
def get_centroids(bboxes):
27-
assert bboxes.shape[1] == 4
28-
29-
x = np.mean(bb[:, [0, 2]], axis=1, keepdims=True, dtype='int')
30-
y = np.mean(bb[:, [1, 3]], axis=1, keepdims=True, dtype='int')
31-
centroids = np.concatenate([x, y], axis=1)
32-
return centroids
27+
if len(bboxes):
28+
assert bboxes.shape[1] == 4, "Input shape is {}, expecting shape[1]==4".format(bboxes.shape)
29+
30+
x = np.mean(bboxes[:, [0, 2]], axis=1, keepdims=True, dtype='int')
31+
y = np.mean(bboxes[:, [1, 3]], axis=1, keepdims=True, dtype='int')
32+
centroids = np.concatenate([x, y], axis=1)
33+
return centroids
34+
else:
35+
return bboxes
3336

3437

3538
def iou(bbox1, bbox2):

0 commit comments

Comments
 (0)