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

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.