Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions mean_average_precision/utils/bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ def intersect_area(box_a, box_b):
min_xy = np.maximum(resized_A[:, :, :2], resized_B[:, :, :2])

diff_xy = (max_xy - min_xy)
inter = np.clip(diff_xy, a_min=0, a_max=np.max(diff_xy))
inter = np.maximum(diff_xy, 0)
inter_max = np.max(diff_xy)
if inter_max > 0:
inter = np.minimum(inter_max, inter)

return inter[:, :, 0] * inter[:, :, 1]


Expand All @@ -46,4 +50,4 @@ def jaccard(box_a, box_b):
area_a = area_a[:, np.newaxis]
area_b = area_b[np.newaxis, :]
union = area_a + area_b - inter
return inter / union
return inter / union