So how do you tell if your object detection algorithm is working well?
In this video, you'll learn about a function called, "Intersection Over Union".
And as we use 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 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 of a 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, the low compute division task will
judge that your answer is correct if the IoU is greater than 0.5.
And if the predicted and the ground-truth bounding boxes overlapped perfectly,
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, 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 IoUs,
the more accurate the bounding the 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, what motivates 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 the intersection,
compute the 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 note concept in IoU,
where 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.
It's totally a different concept,
that maybe it's cool that these two things have a similar name.
So now, onto this definition of IoU, Intersection of 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.