Project: YOLO Object Tracking
· 3 min read
Overview
This is a backup of an old project that focused on object detection and tracking over videos using YOLOv8.
Applied Abrewley's Sort Library and self-implemented instance label assigning function based on maximum overlap to stablize the labelled id on each car moving across frames.
Backup of Old Project (June 2023)
This is a backup of an old project that focused on object detection and tracking over videos using YOLOv8. The project was based on the following tutorials:
- Murtaza's Workshop - Robotics and AI's Object Detection Tutorial
- Computer Vision Zone's Object Detection Course
The project was written in Python and uses the YOLOv8 object detection model.
About the Project / Key Features
Static Image Detection
- Applying YOLOv8 on static image given by path specified in the "Parameters" section.
Video Detection
- Applying YOLOv8 on video given by path specified in the "Parameters" section.
Instance Tracking with Abrewlay Sort
- Instance identification with Abrewlay Sort library for tracking objects.
Notes
- The color of the box indicates the INSTANCE ID
Problems
- Inconsistent IDs: Occurs under occlusion or label changes
- Observe that the id of the truck 457 on the rightmost lane (cyan, with label "car") changed to id 473 (purple, with label "truck")
- Indicates that the library cannot provide a consistent ID for the same object across frames
- Multiple bounding boxes for the same object
- As artifacts of the original YOLOv8 detection (due to using the nano model)
Custom Tracking Algorithm
- Instance identification with custom-implemented algorithm for tracking objects.
Goals
- Implementing a version of the object tracking algorithm that is more resistent to lost frames and flickering compared to the Abrewlay Sort library.
Features
- Label Accumulation
- Can accumulate labels from previous frames.
- The ids (colors of the frames) of the objects are more consistent, which can be checked visually
- The same truck now got a consistent id (no change in color indicates that)
- Bounding Box Merging
- Finds the closest bounding box to the previous frames (stored in a dictionary)
- Dictionary is cleared after a certain number of frames
- Only bounding boxes within a certain change in size and aspect ratio are merged by overwritting the same instance id
Car Counter
- Simple algorithm for counting cars across the line by masking the image before detection.
- Utilized the algorithm in sectino 3.5.2 for tracking objects to ensure that a car is not detected twice.