πŸ€– LateAI
Home β€Ί Tutorials β€Ί Object Detection Yolo
πŸ“¦

Object Detection Yolo

Intermediate Β· Half a day
πŸ“Ά Intermediate ⏱ Half a day πŸ’° Free (software only) 🏷 CV Zone

πŸ“Œ Overview

Use YOLO (You Only Look Once) to recognise object classes and positions in real time; OpenCV's tutorial uses YOLOv3, which detects the 80 common COCO classes (person, car, cat, phone, and so on).

YOLO is famous for producing all detection boxes from a single forward pass, balancing real-time speed against accuracy - a classic hands-on project in object detection.

🧰 What you need

πŸ”§ Step by step

1

Download the model files

Get yolov3.weights (about 236MB), yolov3.cfg, and coco.names

The lighter yolov3-tiny is also an option if you need speed

2

Load the network and classes

Load the cfg and weights with readNetFromDarknet

Read in the list of 80 class names

3

Blob the input

Convert the image to a blob with the right scaling and input size

Remember that YOLO inputs are normalised to 0-1

4

Forward pass

Iterate the network output layers to get the detections

Each detection has a centre coordinate, width/height, confidence, and class probabilities

5

Filter and NMS

Filter out low-confidence detections with a threshold

Remove duplicate boxes with NMSBoxes

6

Draw the results

Draw the class name, confidence, and box on the original frame

Different classes can use different colours

πŸ’‘ Tips

View original β†— ← Back to LateAI home