C4W3L06 Intersection Over Union

Short video lecture (Andrew Ng) explaining the Intersection over Union (IOU) metric used in object detection. It defines IOU as the area of intersection between a predicted and ground-truth bounding box divided by their union, explains the conventional 0.5 threshold for a correct detection (with optional stricter thresholds like 0.6 or 0.7), and notes IOU’s later use in non-max suppression.
Chapters
So how do you tell if your object detection algorithm is working well? In this video, you learn about a function called intersection over union. And this will be used both for evaluating your object detection algorithm as well as in the next video, using it to add another component to your object detection algorithm to make it work even better. Let's get started. In the object detection task, you're expected to localize the object as well. So if that's the ground truth bounding box, and if your algorithm outputs this bounding box in purple, is this a good outcome or a bad one? So what the intersection over union function does, or IOU does is it computes the intersection over union of these two bounding boxes. So the union of these two bounding boxes is this area is really the area that is contained in either bounding boxes, whereas the intersection is this smaller region here. So what the intersection over union does is it computes the size of the intersection so that orange shaded area and divided by the size of the union, which is that green shaded area. And by convention, a lot of compute division tasks will judge that the answer is correct. If the IOU is greater than 0.5, and if the predicted and the ground truth bounding boxes overlapped perfectly, then the IOU would be one, because the intersection would equal to the union. But in general, so long as the IOU is greater than or equal to 0.5, then the answer will look okay. It will look pretty decent. And by convention, very often 0.5 is used as a threshold to judge as whether the predicted bounding box is correct or not. This is just a convention. If you want to be more stringent, you can judge an answer as correct only if the IOU is greater than equal to 0.6 or some other number. But the higher the IOU is, the more accurate the bounding box. And so this is one way to map localization to accuracy, where you just count up the number of times an algorithm correctly detects and localizes an object. Where you could use a definition like this of whether or not the object is correctly localized. And again, 0.5 is just a human chosen convention. There's no particularly deep theoretical reason for it. You can also choose some other threshold like 0.6 if you want to be more stringent. I sometimes see people use more stringent criteria like 0.6 or maybe 0.7. I rarely see people drop the threshold below 0.5. Now, we've motivated the definition of IOU as a way to evaluate whether or not your object localization algorithm is accurate or not. But more generally, IOU is a measure of the overlap between two bounding boxes, where if you have two boxes, you can compute their intersection, compute a union and take the ratio of the two areas. And so this is also a way of measuring how similar two boxes are to each other. And we'll see this use again this way in the next video when we talk about non max suppression. So that's it for IOU or intersection over union. Not to be confused with the promissory node concept in IOU where, you know, if you lend someone money, they write you a note that says, oh, I owe you this much money. So that's also called an iou. Totally different concept, but maybe it's cool that you know these two names. These two things have a similar name. Um, so now, armed with this definition of IOU intersection over union in the next video, I want to discuss with you non max suppression, which is a tool you can use to make the outputs of YOLO work even better. So let's go on to the next video.










