You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
15 Hrs
22 Min
42 Seg

Introducción a la Detección de Objetos con YOLO

7/16
Resources

Object detection is a fundamental technology in the field of computer vision, enabling machines to identify and locate specific elements within images or videos. In the context of retail businesses, this capability is invaluable for analyzing customer behavior and optimizing operations. Let's see how to implement a people counting system using Ultralytics object detection models.

How to select the right object detection model?

Ultralytics offers five different models for object detection, each with specific characteristics that make them more or less suitable depending on the use case. These models vary in size and complexity:

  • YOLOv11n (nano): the smallest and least complex.
  • YOLOv11s (small): Small size
  • YOLOv11m (medium): medium size
  • YOLOv11l (large): Big size
  • YOLOv11xl (extra large): Largest and most complex

All these models share the same input image size (640x640 pixels), but differ significantly in other aspects:

  • MAP (Mean Average Precision): Increases with the complexity of the model.
  • Latency: On both CPU and GPU T4, increases with increasing complexity.
  • Parameters: From 2.6 million in the nano model up to 56.9 million in the XL model
  • FLOPS (floating-point operations): Performance measure indicating how many operations are required to process an image.

For environments with limited hardware where some latency can be tolerated, the YOLOv11n model is the most suitable option due to its lower complexity and resource requirements.

How to implement object detection with Ultralytics?

To implement object detection using Ultralytics, we need to follow these steps:

Installing dependencies

The first thing is to install the Ultralytics library in our environment:

# Installing the library!pip install ultralytics

Downloading the pre-trained model

There are two main ways to download the YOLOv11n model:

  1. Direct method using the library:
from ultralytics import YOLO
 # Download YOLOv11nmodel model = YOLO('yolov11n').

It is important to note that "YOLO" is capitalized, while "yolov11n" is lowercase.

  1. Alternative method using wget (Plan B):

If the above method fails, we can download the model directly from its URL:

!wget https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov11n.pt

Once the model is downloaded, we can load it directly from the local file:

model = YOLO('yolov11n.pt')

This avoids having to download the model again each time we run our code.

Characteristics of the pre-trained model

The YOLOv11n model comes pre-trained with the COCO dataset, which allows it to detect 80 common object types, including:

  • People
  • Animals (cats, dogs, etc.)
  • Vehicles
  • Different types of food
  • Everyday objects

This pre-detection capability makes the model immediately useful for many applications, including people counting in a commercial establishment.

How to apply object detection to people counting?

For the specific case of our customer at SecurityVision AI, who already knows how people move around their premises but now needs to count them, the implementation of the YOLOv11n model is ideal.

Benefits of this solution:

  • Low resource consumption: By using the smaller model, we can implement it even on constrained hardware.
  • Adequate accuracy: Although it is not the most accurate model, it offers an adequate balance between performance and resources.
  • Ease of implementation: With just a few steps we can have a functional system.

Once the model is implemented, we can process video from security cameras to detect and count people in real time, providing valuable information for business decision making.

Object detection with Ultralytics represents a powerful and affordable solution for people counting in commercial environments. Have you ever implemented computer vision systems in your projects? Share your experience in the comments.

Contributions 0

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?