Welcome to the section and object detection.
Object detection is one of the most popular computer vision tasks and also a very important one.
Object detection entails correctly classifying objects which are in an image and also saying exactly
where these objects are located in the image.
So if we have this image, we see clearly that we have an airplane, an aeroplane, a person, a person,
and then we could say a car.
So this tool is some sort of car.
Now, an object detector not only classifies these images, but also localizes exactly their positions
in the image.
So this airplane, for example, has this bounding box.
Now, a bounding box basically surrounds us also square or rectangular box which surrounds the object.
And then for this person, we have this bounding box, for this, this bounding box and this other aeroplane,
we have this bounding box which is in this other bounding box.
So unlike a classification problem, where when given this kind of input, we have as an output one
hard vector, for example, which represents a number of classes we're dealing with.
So supposing we have five classes, then when given an input, we have to correctly say whether that
input belongs to one of the five classes.
Now, with object detection, we not only have this, but we also have the positions in the image.
So like this, we have this position like this and we have several conventions for this positions.
One of the most popular conventions is the center convention, where we have the x center, y center
width and then height.
Now, what does this mean?
This means that based on this referential right here, so we could define a referential right here where
we have this origin.
Now, recall we used to have y is to working with this kind of referential.
Now the referential for image data is considered to be this.
So our origin starts from here.
We're moving the x direction and then in the Y direction.
So this is our friends and then this is based from on this point, on this origin that we actually define
positions.
So if we have this airplane, let's consider this bigger airplane.
So we could have this bigger airplane, we could define its bounding box by its center and then its
width.
So once we have a center, obviously, and if we're given this width, we can obviously see that it
is in this bounding box.
So this is the first convention the center does the X center and the Y center.
The X center is basically the distance from this to the center.
So suppose that the center is right here.
So if our center is here, then the distance from here to this is X center and the distance from up
to this is Y center.
So basically that's what we have.
So if we want to link this up like this, we could see clearly how we obtain X center the distance from
here the year and then Y center distance from this origin to this, which now gives us the center.
So that's how we get a center.
Now we are given the width and then the height, if we give it the width and height, obviously to get
this points or to get because we have actually four points right here to get all those four points which
make up the bounding box, we could start from say, this point for this point to obtain the x and Y
coordinates right here, we simply take this x coordinate and subtract from the width divided by two
because from this to this is we divided by two on the diagram.
It doesn't show clearly at this point is at the center.
But normally this should be at the center.
So we could rearrange this bounding box now.
So as we said, to get this, we have this x center minus the width divided by two to obtain this and
then to get the Y, we have the Y center plus because this is actually the positive direction and then
this is the negative direction for the X.
So for y, this is positive.
This is negative for Y, this is positive for X and then this is negative for x.
Now, to obtain the Y, as we said, we have this y center plus the width of this, or rather plus the
height of this divided by two.
That's how we obtain this.
Now, to obtain this, since we're going from this, we're going the x center minus the width divided
by two.
We obtain the x coordinate here.
To obtain the y coordinate we have the Y center minus because this is the negative direction.
So we have the Y center minus the height, divided by two and.
This is very similar to obtain the x here.
There's an x coordinate right here.
We have the x enter year plus the width divided by two to obtain the same x coordinate.
Right here is the x center plus the width divided by two.
Obviously these two have the same x coordinates, but different y coordinates To obtain the y coordinate.
We have this y center minus the height divided by two.
To obtain the Y coordinate.
Here we have the Y center plus the height divided by two.
Either ways, once we have this to coordinate this point here and then this, we could always obtain
this and this automatically.
Now another convention is the x mean y, mean x, max y, and max convention where we just given this
coordinates.
If we're given this coordinates and then this coordinates, we could obviously obtain all this because
when one is given this and then given this, we could just get the whole box or the magically.
So here are the two main conventions we use to actually locate an object in the image.