# The YOLO Algorithm

When we use sliding windows, we may not get the most accurate bounding box, as shown below:

![](/files/-M5-0VjcXVBm-IkYdfFT)

A more accurate way to get bounding boxes is the YOLO (You Only Look Once) algorithm.

The crux of this algorithm is to divide the image into cells using a grid, and then apply the object localization algorithm using CNNs (as described earlier) on each grid cell. It will output accurate bounding boxes as long as there is a single object in the cell.

![](/files/-M5-0VjerOhCiXfEpyvO)

Note that while training, we assign objects only to one grid cell, based on the cell where the center of its bounding box lies. Therefore, in the image above, the central cell will be considered to be empty, even though it contains part of a car.

Since YOLO has a convolutional implementation, all the grid cells are simultaneously processed. This results in a fast and accurate prediction. It is, therefore, also used for real-time object detection.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vikram-bajaj.gitbook.io/deep-learning-specialization-coursera/convolutional-neural-networks/object-detection/the-yolo-algorithm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
