C4 W3 Intersection over union function

Hey guys! In intersection over union function, how do we get our ground truth bounding box with which our output from algorithm is compared?

Jaccard Index, or Intersection-Over-Union (IOU), is a technique for comparing any two sets. Sometimes it is used in object detection as a measure of prediction accuracy. For that, you do need both predicted and ground truth bounding boxes for a given object. However, as is the case in the autonomous driving exercise, you can also use it to compare two predicted bounding boxes, in which case you don’t use or need ground truth. Why compare two predicted bounding boxes? Duplicate pruning

Note: this course uses the set notation

J(A,B) = \frac {(A \cap B)}{(A \cup B)}

but you also see it written as

IoU = \frac{TP}{TP + FP + FN}

where TP, FP, and FN represent quadrants of the truth or confusion matrix. See for example tf.keras.metrics.IoU  |  TensorFlow v2.12.0


Hey @Diwakar_B,
To add to Nomen’s reply, in some datasets, the true bounding boxes are added to the images manually, thus creating supervised datasets, which we later use to train our Object Localization models. I hope this helps.


1 Like

I don’t disagree with this assertion.

However, IOU functions in general do not know whether the two boxes they are comparing are two predicted boxes or one predicted box plus one ground truth box. In this class, specifically, the application of IOU is in the context of non-max-suppression, which is comparing two predicted bounding boxes; ground truth ground boxes play no role.

This class uses a pre-trained YOLO model. Ground truth bounding boxes would have been required during that model training. However, to the best of my knowledge, they have never been included in the materials for this class.

Hey @ai_curious,
Thanks for pointing out the discrepancy. I didn’t write my reply in the context of IoU. I wrote my reply in the context of “true bounding boxes”, as in how the true bounding boxes for the different datasets are figured out. I assumed that @Diwakar_B was referring to this context only; and he mentioned IoU just because we use that for comparing the true bounding boxes with the predicted ones in the lecture videos.