ubiai deep learning

YOLO Object Detection Explained [+Examples]

Oct 30th, 2023

In a world where technology is advancing at an unprecedented pace, computer vision and object detection have emerged as the cornerstones of innovation. At the heart of this digital revolution lies an algorithm with the potential to reshape our understanding of visual data – YOLO, or “You Only Look Once.”


This article is your gateway to the captivating world of YOLO. As we embark on this enlightening journey, we will not only unravel the profound purpose of YOLO but also witness its remarkable evolution and explore the real-world applications that make it a game-changer in the computer vision field.


Prepare to be mesmerized by the sheer power and potential of this cutting-edge technology, as we dive deep into the heart of YOLO.

What is YOLO?

YOLO is a groundbreaking real-time object detection algorithm introduced in 2015 by Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. Unlike traditional methods, YOLO approaches object detection as a regression problem rather than a classification task. It uses a single convolutional neural network to spatially separate bounding boxes and associate probabilities with detected objects. This innovative approach enables real-time object detection at impressive speeds, with high accuracy, and has found a multitude of real-world applications.


Why is YOLO Popular?

Why is YOLO so popular for object detection? Over the years, it has undergone significant improvements:


1.Speed: YOLO processes images at an astonishing 45 Frames Per Second, making it a top choice for real-time applications.


2. Detection Accuracy: It outperforms other real-time systems, boasting a mean Average Precision  that’s more than twice as high.

3. Better Generalization: Newer versions of YOLO offer better generalization for diverse domains, a crucial feature for robust object detection.

4. Open Source: YOLO’s open-source nature has led to continuous model improvements by the community, resulting in rapid advancements.

YOLO Architecture:

The architecture of YOLO has been a pivotal factor in its success, setting it apart from traditional object detection methods. By dividing the input image into a grid, YOLO can simultaneously predict multiple objects within a single image. This approach is a game-changer, because of its efficiency and accuracy in real-time object detection tasks.


The grid-based approach allows YOLO to process images in one pass, eliminating the need for multi-stage pipelines often found in other object detection algorithms. This design not only speeds up the process but also maintains high accuracy, making it suitable for real-time applications where rapid and precise object recognition is critical.


Input Image Preparation:  YOLO begins its process by resizing the input image into a fixed dimension of 448×448. This step is crucial for ensuring uniformity and consistency in the data that the algorithm processes. By using a standard size, YOLO simplifies the subsequent computations, making them more efficient. The input image, after resizing, is then ready to be fed into the convolutional network.


Convolution Layers:  YOLO’s Convolution Layers are the heart of its object detection capability. The process begins with a 1×1 convolution, which is a specialized operation that helps reduce the number of channels in the image data. Reducing the number of channels is important for managing the computational complexity of the network. This operation is followed by a 3×3 convolution, which generates a cuboidal output. It’s in this step that YOLO starts to extract features from the input image. Activation functions, typically Rectified Linear Units (ReLU), are applied throughout these layers. ReLU is a mathematical function that introduces non-linearity to the model, helping it learn complex patterns in the data.


The final layer uses a linear activation function instead of ReLU. This is because the final layer’s purpose is to produce output values, including coordinates and probabilities, which require a linear range. Techniques like batch normalization and dropout are employed for regularization. Batch normalization helps stabilize and speed up training, while dropout prevents overfitting, ensuring that the model generalizes well to new, unseen data.

Object Localization: One of the remarkable aspects of YOLO’s architecture is its grid-based approach to object localization. The original image is divided into an NxN grid, with each cell in this grid responsible for localizing and predicting the class of objects it covers. Each cell is also tasked with assigning a probability or confidence value, indicating the likelihood of an object being present in that cell. This grid-based approach allows YOLO to not only detect multiple objects within the image but also to specify where they are located, making it highly efficient and precise.


Bounding Box Determination: YOLO excels in determining bounding boxes that accurately enclose objects within the image. These bounding boxes are identified using a regression module, which is a key part of the algorithm. This module computes various attributes for each bounding box, including probability scores (indicating the likelihood that an object exists within the box), coordinates of the bounding box center, height, width, and class information. The regression module’s role is pivotal in YOLO’s ability to precisely pinpoint the objects it detects and draw accurate bounding boxes around them.


Intersection Over Unions (IOU):  IOU plays a critical role in the post-processing phase of YOLO’s object detection. It’s a mathematical measure used to filter out redundant grid boxes. Essentially, IOU calculates the ratio of the area of intersection between two bounding boxes to the area of their union. High IOU values indicate a significant overlap between two bounding boxes, which suggests redundancy in predictions. By using IOU as a filter, YOLO ensures that only the most accurate and non-redundant predictions are retained. This step improves the overall quality of object detection and eliminates false positives.


Non-Maximum Suppression (NMS): After the initial predictions and IOU-based filtering, YOLO applies Non-Maximum Suppression (NMS) to further refine the results. NMS is a post-processing technique that ensures only the boxes with the highest probability scores are retained, while removing redundant or less confident predictions. By doing this, YOLO enhances the accuracy of object detection, as it keeps only the most reliable and significant predictions. NMS is an essential step to ensure that the final set of bounding boxes is both accurate and concise.

Applications of YOLO:

YOLO Object Detection

The versatility of YOLO’s applications highlights its significance across various domains, making it an indispensable technology with the potential to revolutionize industries and improve the quality of life:


  • Autonomous Vehicles: YOLO plays a critical role in enhancing the safety and navigation of autonomous vehicles. It excels in pedestrian and object detection, contributing to safer transportation solutions.


  • Surveillance Systems: In the realm of surveillance, YOLO shines in identifying and tracking intruders or suspicious activities swiftly and accurately. It’s a vital tool for security applications.


  • Medical Imaging: YOLO’s capabilities extend to the field of medical imaging, where it aids in the identification of anomalies in X-rays and MRIs. Its precision is invaluable for diagnosing and monitoring medical conditions.


  • Robotics: YOLO’s exceptional speed and accuracy make it a valuable asset in robotics. It enables robots to perceive their surroundings efficiently, paving the way for advancements in automation and human-robot interaction.

Evolution of YOLO:

Since its inception in 2015, YOLO has undergone significant transformations, leading to multiple versions that have pushed the boundaries of real-time object detection. Let’s take a closer look at the evolution of this algorithm. 



YOLOv2 (YOLO9000): YOLO’s evolution began with YOLOv2, also known as YOLO9000. This version introduced several critical enhancements to the original model. Notably, it brought anchor boxes into the mix, which significantly improved the accuracy of bounding box predictions. Furthermore, YOLOv2 exhibited better generalization across diverse object categories and improved processing speed, making it a key milestone in YOLO’s journey.

YOLO Object Detection

YOLOv2 stands out by achieving superior results in both Mean Average Precision and Frames Per Second measures compared to other object detection models. YOLO’s high mAP score demonstrates its remarkable accuracy in detecting and localizing objects, making it an excellent choice for tasks that require precise identification. Simultaneously, YOLO’s impressive FPS rating showcases its exceptional speed in processing images, surpassing 45 frames per second in many cases.


This efficiency is essential for real-time applications like autonomous vehicles and surveillance systems, where quick and accurate object detection is crucial. YOLO’s ability to excel in both mAP and FPS sets it apart as a comprehensive solution for various domains, combining accuracy with real-time capabilities.


YOLOv3: Building upon the successes of YOLOv2, the release of YOLOv3 marked another leap in object detection capabilities. YOLOv3 incorporated Darknet-53 as its backbone network, which further boosted its accuracy. The addition of pyramid networks enhanced the model’s ability to detect objects at various scales and orientations. This version, with its impressive performance, cemented YOLO’s reputation as a top choice for real-time object detection.


YOLOv4: While not considered an official release, YOLOv4 brought significant innovations to the table. It featured the CSPNet (Cross-Stage Partial Network) for improved feature extraction, k-means clustering for anchor boxes optimization, and the GHM (Gradient Harmonized Mismatch) loss function, enhancing the model’s ability to handle complex scenarios. YOLOv4 demonstrated YOLO’s commitment to pushing the boundaries of object detection.

YOLOv5: Maintained by Ultralytics, YOLOv5 continued the tradition of innovation. This version adopted the EfficientDet architecture, dynamic anchor boxes, Spatial Pyramid Pooling (SPP), and the CIoU (Complete Intersection over Union) loss function. These additions not only improved the model’s overall performance but also made it more efficient and versatile.


YOLOv6: YOLOv6 introduced the EfficientNet-L2 architecture and dense anchor boxes, further refining the model’s ability to detect objects with precision and speed. This version continued to focus on optimizing real-time object detection, ensuring that YOLO remained at the forefront of the field.



YOLO Object Detection

The iteration, YOLOv7, continues to push the envelope. With enhanced speed, accuracy, and the introduction of a new focal loss function, YOLOv7 solidifies YOLO’s position as a cutting-edge solution for real-time object detection. It remains at the forefront of innovation in the field of computer vision.


YOLOv8: a cutting-edge, state-of-the-art model, YOLOv8 builds on the success of previous versions, introducing new features and improvements for enhanced performance, flexibility, and efficiency. YOLOv8 supports a full range of vision AI tasks, including detection, segmentation, pose estimation, tracking, and classification. This versatility allows users to leverage YOLOv8’s capabilities across diverse applications and domains.

As YOLO evolves, its impact on real-time object detection becomes increasingly profound. The continuous improvements and innovative features integrated into each version make YOLO a versatile and powerful tool with applications across various domains, ensuring that it remains a pivotal player in the world of computer vision.


In conclusion, YOLO has revolutionized the field of object detection by providing a fast and accurate solution for identifying objects in images and videos. Its innovative architecture, which treats object detection as a regression problem, has made it a go-to choice for real-time applications. With its continuous evolution and open-source nature, YOLO continues to push the boundaries of what’s possible in computer vision. As technology advances, we can expect YOLO to play a pivotal role in applications ranging from autonomous vehicles to healthcare, making our world safer and more efficient.