๐ฏ Re-Identification Tracker (YOLOv8 + ByteTrack)
Real-time multi-object tracking with automatic re-identification using YOLOv8 and built-in ByteTrack.
This project detects, tracks, and re-identifies objects across frames using persistent track IDs. It also visualizes motion trails, track memory, FPS, and dynamic class filtering.
๐ Features
- โ Real-time object detection
- โ Persistent ID tracking (ByteTrack)
- โ Re-identification detection (gap-based)
- โ Motion trail visualization
- โ Live FPS counter
- โ Class filtering (All / Person / Car)
- โ Mirror toggle
- โ Clean HUD overlay
๐ง Architecture
This tracker is powered by:
-
YOLOv8 for object detection
-
ByteTrack for ID persistence
-
Custom logic for:
- Re-ID gap detection
- Track memory expiration
- Motion history trails
Pipeline:
Camera Frame
โ
YOLOv8 Detection
โ
ByteTrack ID Assignment
โ
Re-ID Logic (Gap + Timeout)
โ
Rendering (Boxes + Trails + HUD)
๐ฆ Installation
Only one requirement:
pip install ultralyticsOther dependencies:
- Python 3.10+
- OpenCV
- NumPy
If OpenCV is not installed:
pip install opencv-python numpypython tracker.pyOn first run, the YOLOv8 model (yolov8n.pt) will auto-download (~6MB).
๐ฎ Controls
| Key | Action |
|---|---|
| F | Cycle class filter (All โ Person โ Car) |
| M | Toggle mirror |
| H | Toggle help overlay |
| Q | Quit |
โ๏ธ Configurable Parameters
Inside the script:
YOLO_MODEL = "yolov8n.pt"
CONFIDENCE = 0.4
TRAIL_LEN = 40
REID_TIMEOUT = 10.0
REID_GAP = 1.5Meaning
- CONFIDENCE โ Detection threshold
- TRAIL_LEN โ Length of motion trail
- REID_TIMEOUT โ How long memory keeps lost objects
- REID_GAP โ Time absence required to flag as "RE-ID"
๐งฉ Re-Identification Logic
An object is marked as RE-ID if:
- It was seen before
- It disappeared
- It reappears after
REID_GAPseconds - It has not expired from memory (
REID_TIMEOUT)
This simulates practical re-identification behavior in surveillance and tracking systems.
๐ Output Visualization
- Unique color per track ID
- Bounding box + ID label
- "RE-ID" badge for reappeared objects
- Smooth motion trails
- Live performance metrics
๐๏ธ Why This Project Matters
This implementation demonstrates:
- Understanding of multi-object tracking
- State persistence across frames
- Temporal reasoning
- Real-time performance handling
- Computer vision visualization techniques
This is not just detection โ it's temporal intelligence over video streams.
๐ฎ Future Improvements
- Deep feature-based Re-ID embeddings
- Multi-camera support
- Kalman-based smoothing visualization
- Save tracking logs to CSV
- Export annotated video
- Integrate DeepSORT alternative
๐ง Learning Context
Part of my structured Computer Vision exploration journey โ building systems from detection to intelligent tracking.