impoves code
This commit is contained in:
@@ -10,11 +10,7 @@ def iou(rect1: AnnotationRect, rect2: AnnotationRect) -> float:
|
||||
x_right = min(rect1.x2, rect2.x2)
|
||||
y_bottom = min(rect1.y2, rect2.y2)
|
||||
|
||||
# Returns 0 if no overlap
|
||||
if x_right <= x_left or y_bottom <= y_top:
|
||||
return 0.0
|
||||
|
||||
intersection_area = (x_right - x_left) * (y_bottom - y_top)
|
||||
intersection_area = max(x_right - x_left, 0) * max(y_bottom - y_top, 0)
|
||||
|
||||
rect1_area = rect1.area()
|
||||
rect2_area = rect2.area()
|
||||
|
||||
Reference in New Issue
Block a user