diff --git a/deep_sort/iou_matching.py b/deep_sort/iou_matching.py index c4dd0b88..9efeb947 100644 --- a/deep_sort/iou_matching.py +++ b/deep_sort/iou_matching.py @@ -23,7 +23,7 @@ def iou(bbox, candidates): occluded by the candidate. """ - bbox_tl, bbox_br = bbox[:2], bbox[:2] + bbox[2:] + bbox_tl, bbox_br = bbox[:2], bbox[:2] + bbox[2:] - 1 candidates_tl = candidates[:, :2] candidates_br = candidates[:, :2] + candidates[:, 2:] diff --git a/tools/generate_detections.py b/tools/generate_detections.py index c7192c26..2eea81e6 100644 --- a/tools/generate_detections.py +++ b/tools/generate_detections.py @@ -53,8 +53,13 @@ def extract_image_patch(image, bbox, patch_shape): bbox[0] -= (new_width - bbox[2]) / 2 bbox[2] = new_width - # convert to top left, bottom right - bbox[2:] += bbox[:2] + # convert to top left, bottom right, + # box is (x, y, width, height). In order + # to get right bottom corner we need to + # add width and height to x and y + # correspondingly and subtract 1 + # as on line 67 for images rects + bbox[2:] += bbox[:2] - 1 bbox = bbox.astype(np.int) # clip at image boundaries