> For the complete documentation index, see [llms.txt](https://vikram-bajaj.gitbook.io/deep-learning-specialization-coursera/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vikram-bajaj.gitbook.io/deep-learning-specialization-coursera/main-10/convolutional-neural-networks/object-detection/object-localization.md).

# Object Localization

Object Localization is the process of locating an object in an image, and creating a bounding box around the object once localized.

## Classification with Localization

We use CNNs for object classification. However, they can also be used for localization simultaneously.

To do this, we must add the parameters $$b\_x, b\_y, b\_h, b\_w$$ to the softmax output where $$(b\_x, b\_y)$$ are the coordinates for the center of the required bounding box and $$b\_h, b\_w$$ are its height and width respectively.

Note that the training images must contain bounding boxes too (with the 4 parameters) so as to be able to learn the parameters.

In fact, every training image has the following vector associated with it:

\[$$p, b\_x, b\_y, b\_h, b\_w, c$$]

where p=1 if there is an object in the image and c is the label of the object.

If p=0 (no object in the image), then the vector becomes \[0, ?, ?, ?, ?, ?] where ?s denote "don't-care" values.

(c can be one-hot encoded).
