For this problem I am writing an IOU function that returns the iou. I think I must be just mistyping something somewhere because I have drawn out the problem on paper and understand it backwards and forwards how to calculate the vertices and subtract for width and height, calculate areas, unions, and intersections, and then IOU.

But I am still getting a problem where I don’t get ‘0’ when the boxes intersect at the vertices only. I’ve stepped through my code using the test coordinates 1,1,2,2 and 2,2,3,3 and it should end up being xil = 2, yil = 2, xi2 =2, yi2 = 2 which leads to inter area being zero which should make my iou zero since iou is just dividing the inter area over the union.

My one note I would say is that I don’t utilize the hint that says to use max(height, 0) and max(width, 0) for inter area. I don’t understand what that means. But I just use inter inter area = inter width * inter height which should be zero times zero.

here is my area:

iou for intersecting boxes = 0.14285714285714285

iou for non-intersecting boxes = 1.0

AssertionError Traceback (most recent call last)

in

12 box2 = (5,6,7,8)

13 print("iou for non-intersecting boxes = " + str(iou(box1,box2)))

—> 14 assert iou(box1, box2) == 0, “Intersection must be 0”

15

16 ## Test case 3: boxes intersect at vertices only

AssertionError: Intersection must be 0\

any notes or helpful hints would be appreciated.

Thank you.