Week 3 YOLO: iou for boxes that only touch at edges = 0.6666666666666666

Hi.

I need some help here. I am getting this menssaje, and is a persistent error. I already use max(…,0). As i see (clearly mistakenly) there is no way to get a value like this if two edges share the x or y coordinates. So, i post.

Hints?

Thanks in advance. (sorry my english!!).

iou for intersecting boxes = 0.14285714285714285
iou for non-intersecting boxes = 0.0
iou for boxes that only touch at vertices = 0.0
iou for boxes that only touch at edges = 0.6666666666666666
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-126-9af4d3565c08> in <module>
     24 box2 = (2,3,3,4)
     25 print("iou for boxes that only touch at edges = " + str(iou(box1,box2)))
---> 26 assert iou(box1, box2) == 0, "Intersection at edges must be 0"
     27 
     28 print("\033[92m All tests passed!")

IOU is non-zero only when the numerator is non-zero, so you know the problem is with the intersection element. There is a diagram in this thread that might help you work through this test case by hand. Try drawing it out and computing the intersection manually, then compare to your code.