Deep Learning
Baptiste

How to detect objects more efficiently with YOLO?

Partager l’article :

Introduction: Object detection, a revolution at the heart of computer vision

Object detection is more than just a technological feat; it is the cornerstone of modern computer vision. By merging localization and classification, it allows for the precise identification and positioning of elements within images or video streams. This capability has become indispensable across a multitude of sectors: public safety, industrial automation, medical diagnostics, advanced robotics, and even for the autonomous vehicles navigating our roads with increasing confidence. Imagine accelerated medical diagnoses, intelligent production lines, and enhanced security. All this, and much more, is made possible by object detection. In this article, we will explore in depth one of the most iconic algorithms in this field: YOLO.

Image montrant une prédiction avec le modèle YOLO sur une photo de Zinedine Zidane et Carlo Ancelotti lors de la finale de la Ligue des Champions. Les deux personnes sont encadrées et étiquetées avec des scores de confiance, indiquant "person 0.88" pour Zinedine Zidane et "person 0.85" pour Carlo Ancelotti. La cravate de Zinedine Zidane est également détectée et étiquetée avec un score de confiance de "tie 0.61".

YOLO (You Only Look Once): Innovation driving performance

YOLO, an acronym for "You Only Look Once," is an object detection algorithm that marked a turning point. Its unique feature? Analyzing images in a single pass, which drastically reduces processing time without sacrificing performance. This combination of efficiency and accuracy has propelled YOLO to the rank of reference models in computer vision. With constant evolution driven by an active community and players such as the company Ultralytics, YOLO continues to push boundaries, as evidenced by research into advanced versions such as YOLOv12.

From Redmon's initiative to the Ultralytics push: The history of YOLO maintenance

The evolution of YOLO is closely tied to its successive leaders. Initially driven by Joseph Redmon, creator of the YOLOv1 to YOLOv3 versions under the Darknet framework, the project reached a major turning point when Redmon stepped away from computer vision research in early 2020 for ethical reasons. This withdrawal did not mean the end of YOLO, but rather the beginning of a new era of diverse contributions. While researchers like Alexey Bochkovskiy and his team brilliantly ensured continuity with YOLOv4, extending the Darknet legacy, the ecosystem was ripe for an approach focused on greater accessibility. It is in this context that Ultralytics, under the leadership of Glenn Jocher, truly catalyzed the democratization of YOLO. By reimplementing and extending the fundamental concepts of YOLO natively in PyTorch with models like YOLOv5, and later YOLOv8, Ultralytics not only delivered cutting-edge performance but, more importantly, drastically lowered the barrier to entry. Their framework simplified the training, customization, and deployment of YOLO models, making them accessible to a global community of developers, researchers, and businesses.

At the heart of YOLO: A balance between speed and visual intelligence

In computer vision, the interpretation and localization of objects in images rely on sophisticated algorithms. Two main approaches have long coexisted, each with its own strengths and weaknesses.

CNNs (Convolutional Neural Networks): Fast and efficient analysis

The CNNs excel in their speed of analysis. They work by applying filters to an image to progressively identify simple elements (edges, shapes, etc.) and then more complex combinations (eyes, wheels, etc.). This method, which is highly efficient and fast thanks to optimized calculations, is the foundation of many vision algorithms, including the early versions of YOLO. However, CNNs can struggle to grasp complex relationships between distant objects or the global context of an image with the same precision as other techniques. For example, when recognizing a "soccer ball," a CNN might struggle to link it to the presence of a soccer goal located on the other side of the image.

Schéma illustrant l'architecture des réseaux de neurones convolutifs (CNN). Le diagramme montre les étapes de traitement d'une image d'entrée à travers des couches de convolution, de pooling, et des couches entièrement connectées, aboutissant à une sortie. Les étapes sont étiquetées comme "Feature Extraction" pour la convolution et le pooling, et "Classification" pour les couches entièrement connectées.

Transformers and the attention mechanism: A new era for visual interpretation

More recently, Transformers, with their attention mechanism, have sparked significant interest. Attention allows the algorithm to evaluate the relative importance of different parts of an image (or text) in relation to one another. This gives it the ability to connect distant information and focus on what is essential to interpret complex scenes with high precision. Taking the "soccer ball" example again, the Transformer can assign more importance to the presence of a soccer goal located on the other side of the image. The major drawback of Transformers lies in their high computational power requirements, often making them slower than CNNs, which can be problematic for real-time applications. Among Transformer models, we can name DETR which is currently one of the best computer vision models. In comparison, the medium version of the YOLO 12 series is 3 times smaller than DETR.

Schéma illustrant l'architecture du Vision Transformer (ViT). Le diagramme montre le processus de traitement d'une image d'entrée à travers des étapes de "Patch + Position embedding", une projection linéaire des patches aplatis, un encodeur de transformeur, et une tête MLP pour la classification. Le détail de l'encodeur de transformeur est également montré, incluant des couches de normalisation, des couches MLP, et des mécanismes d'attention multi-têtes.

YOLO: A successful marriage between CNN and attention mechanisms

The creators of YOLO sought to combine the advantages of these two approaches. While retaining the efficient architecture of CNNs for speed, they integrated lighter and optimized attention mechanisms. The goal is not to use the "heavy" attention of Transformers systematically, but to apply it in a targeted and ingenious way. For example, thanks to the Localized Attention (i.e., "Area Attention") architecture, YOLO learns to focus its attention on specific areas of the image by segmenting it and identifying zones that require deeper analysis, without having to calculate the relationships between every single pixel. Other technical optimizations, such as "Flash Attention" or network simplification, help make the use of attention compatible with the speed characteristic of YOLO.

In summary, YOLO strikes a clever compromise by leveraging the speed of CNNs for global analysis while integrating elements of contextual intelligence inspired by Transformers. This allows it to improve detection accuracy in complex scenes without sacrificing speed, much like a fast athlete who also develops observation and strategic skills.

YOLO: An algorithm with limitless practical applications

YOLO's versatility and speed have opened doors in numerous sectors, transforming complex challenges into tangible solutions.

Industry and quality control

In the manufacturing sector, YOLO automates quality control by spotting defects on production lines, improving efficiency and reducing costs.

Image montrant une ligne de production industrielle avec des bouteilles en plastique sur un convoyeur. Les bouteilles sont encadrées et étiquetées, avec une bouteille marquée comme "DEFECTED BOTTLE" en rouge et les autres comme "BOTTLE" en vert.

Autonomous vehicles

Autonomous driving requires infallible perception of the environment. YOLO detects pedestrians, vehicles, signage, and obstacles, ensuring safer and more reliable navigation.

Image montrant une scène de circulation avec des véhicules détectés et encadrés. Un bus, des voitures et un camion sont visibles sur une route avec des marquages de voie colorés. Les véhicules sont encadrés avec des boîtes de détection.

Surveillance and security

YOLO is revolutionizing surveillance by analyzing video feeds to identify suspicious behavior, intrusions, or abandoned objects, enhancing the security of property and people.

Image montrant deux scènes de surveillance et de sécurité. À gauche, une voiture est encadrée avec une plaque d'immatriculation détectée et étiquetée, indiquant "VEHICLE ALLOWED" avec un horodatage. À droite, une personne portant un sac à dos est encadrée et détectée près d'une porte de salle de conférence, avec un horodatage.

Precision agriculture

In agriculture, YOLO helps identify plant diseases, detect weeds, or monitor livestock, optimizing yields and promoting sustainable farming.

Image montrant une feuille de plante avec des zones de taches bactériennes identifiées et encadrées. Les zones de taches bactériennes sont étiquetées avec des pourcentages de confiance, indiquant "Bacterial Spot" avec divers scores. Une partie saine de la feuille est également encadrée et étiquetée "Healthy Part 0.83".

Healthcare and medical diagnostics

Speed and precision are vital in medicine. YOLO assists practitioners by detecting anomalies in medical images (X-rays, MRIs), such as tumors or fractures, for faster diagnoses.

Image médicale montrant une coupe IRM du cerveau avec des zones de tumeur identifiées et encadrées. Les zones tumorales sont étiquetées avec des pourcentages de confiance, indiquant "Tumor 100%" et "Tumor 98%".

Humanitarian aid and crisis management

During disasters, rapid damage assessment is crucial. By analyzing aerial or satellite imagery (for example, for rural housing censuses in developing countries), YOLO helps coordinate relief efforts and deliver aid efficiently. This is one of the projects led by Aqsone Lab as part of the Disaster Vulnerability Challenge offered by the Zindi.

Image satellite montrant une zone rurale du Malawi avec des champs, des arbres et des routes. Plusieurs maisons sont détectées et encadrées en bleu, avec des scores de confiance indiqués

The Ultralytics framework: A versatile toolkit for vision

The Ultralytics framework is designed to simplify and accelerate the development of computer vision solutions. By providing a comprehensive set of pre-built tools, pre-trained models, and modular features, it allows researchers and developers to focus on the specific aspects of their projects rather than having to build the foundations from scratch. Let's explore in detail some of the key tools and benefits offered by this powerful framework.

Data Augmentation

To ensure a model's robustness, training on a large and varied volume of data is essential. To increase this diversity without acquiring new images, data augmentation techniques are used. These include classic transformations (cropping, flipping, rotating, adjusting brightness and contrast) as well as more sophisticated methods like Mosaic (combining four images into one) or MixUp (weighted blending of images and their labels). Applying these techniques exposes the model to a wider range of situations, which improves its ability to generalize.

L'image montre une transformation d'une image originale en plusieurs variantes, incluant des transformations standard comme le recadrage aléatoire, les retournements, les rotations, et les ajustements de luminosité et de contraste

Test-Time Augmentation (TTA)

During the inference (prediction) phase, Test-Time Augmentation (TTA) can improve performance. It involves applying multiple transformations to the test image, obtaining predictions for each transformed version, and then aggregating these predictions (e.g., by majority vote or averaging). Although more time-consuming, this method can significantly increase the model's precision and recall.

Schéma illustrant l'application du Test-Time Augmentation (TTA) lors de l'inférence. L'image originale, une version retournée et une version avec changement de contraste sont passées à travers un modèle entraîné. Les prédictions obtenues sont ensuite moyennées pour améliorer la précision et le rappel.

A complete ecosystem for computer vision

The Python library provided by Ultralytics is not limited to object detection. Their framework extends YOLO's capabilities to:

  • Object tracking: Tracking identified objects across video frames.
  • Instance segmentation: Identifying each object instance at the pixel level, providing a precise outline of its shape.
  • Pose estimation: Detecting and tracking human body key points (skeleton).
  • Image classification: Categorizing an entire image (no bounding box).
  • Oriented Bounding Box (OBB) detection: Detecting objects with an oriented bounding box, which is crucial for aerial imagery where the angle is important.

Conclusion: YOLO, a continuous engine for innovation in computer vision

YOLO has established itself as an essential object detection algorithm, combining speed, precision, and remarkable adaptability. Its innovative architecture and constant evolution, driven by a dynamic scientific community and industry players, allow it to excel in an impressive variety of fields. Ongoing advancements, such as those explored with models like YOLOv12-turbo (see performance chart on the COCO dataset, the benchmark dataset for object detection), promise new capabilities.

Graphique comparant la performance en mAP (%) sur le dataset COCO en fonction de la latence (en millisecondes) pour différentes versions du modèle YOLO, y compris YOLOv12-turbo.

The flexibility offered by frameworks like Ultralytics, with its advanced features for segmentation, pose estimation, and oriented detection, makes YOLO much more than just a detector: it is a truly versatile toolkit for computer vision. As artificial intelligence continues to advance, YOLO and its derivatives are certainly destined to continue redefining standards, paving the way for increasingly intelligent and high-performance applications.

To learn more (useful resources)

YOLO research papers

Major object detection datasets

Key concepts and related technologies

Article image link

Un accompagnement de A à Z par nos experts dans le but d’une intégration de solutions IA sur-mesure.

Lorem ipsum dolor sit amet consectetur. Ipsum penatibus viverra feugiat amet varius pharetra porta risus lectus. Turpis enim massa non tincidunt in faucibus.

Découvrez plus d’articles

No items found.
Bird with red, yellow, and black feathers in flight, wings spread, against a blurred background of greenery.

Can you chat with your company database just like you do with ChatGPT?

Lire l’article
No items found.

TPOT vs. Auto-sklearn: Comparing Two AutoML Libraries

Lire l’article
Deep Learning

Strengthening convolutional neural networks (CNNs) using capsules

Lire l’article