📧 Project Description
This project implements an intelligent vehicle lane counting system using YOLO-based object detection and Supervision tracking utilities.
It accurately detects, tracks, and counts vehicles crossing defined lanes or zones in a video feed — making it ideal for traffic flow analysis, lane monitoring, and vehicle entry/exit analytics.
The system processes video streams in real time, applying a ByteTrack-based tracker to maintain persistent object IDs and prevent duplicate counts.
It uses Supervision’s visual annotators to display bounding boxes, lane lines, and count overlays, while also saving the annotated output as a video file for later review.
With support for custom polygon zones and configurable parameters via a YAML configuration file, this system can easily adapt to various camera angles and roadway setups.
🎯 Core Objectives
-
🚗 Detect and track multiple vehicles using YOLO deep learning models.
-
📊 Count vehicles crossing a virtual lane line or custom polygon zones.
-
🔁 Ensure accurate counting using persistent tracking IDs via ByteTrack.
-
🧩 Allow multiple detection zones defined dynamically from configuration.
-
💾 Save annotated video outputs for documentation and review.
-
⚙️ Enable modular and configurable design via
config.yaml.
✨ Key Features
✅ Real-Time Vehicle Detection: Detects and tracks cars, trucks, and other vehicles using YOLO.
✅ Smart Lane Counting: Counts vehicles crossing defined lines or polygonal regions.
✅ Zone-Based Analytics: Supports multiple custom zones for region-based counting.
✅ Accurate Object Tracking: Uses ByteTrack to maintain unique IDs for vehicles.
✅ Visual Overlays: Annotated boxes, lines, and count text rendered using Supervision annotators.
✅ Video Output Recording: Automatically saves processed frames into a high-quality .mp4 file.
✅ Customizable Configurations: YAML-based settings for model, zones, sensitivity, and sources.
⚙️ System Architecture
-
Input Video: Captured from camera or video file defined in config.
-
Detection Stage: YOLO model identifies vehicles in each frame.
-
Tracking Stage: ByteTrack assigns unique IDs to track each vehicle across frames.
-
Zone Analysis: Vehicles crossing defined lanes or zones are counted.
-
Annotation & Visualization: Supervision annotators draw bounding boxes, zones, and labels.
-
Output: Saves annotated video and optionally displays it in real time.
🛠️ Technologies Used
| Component | Description |
|---|---|
| Programming Language | Python 3.x |
| Model | YOLO (Ultralytics) |
| Tracking | ByteTrack via Supervision |
| Libraries | OpenCV, NumPy, Supervision |
| Configuration | config.yaml for model, video path, and zones |
| Output | Annotated video (output.mp4) |
📌 Use Cases
-
🚦 Traffic Flow Analysis: Monitor lane-wise traffic density and movement patterns.
-
🛣️ Highway Toll Monitoring: Count vehicles entering or exiting toll gates.
-
🏙️ Smart City Systems: Integrate into urban traffic management solutions.
-
🧾 Data Logging: Use count data for statistical traffic reports and predictions.
-
🧠 Research Applications: Evaluate tracking and detection performance for academic projects.
🔮 Possible Enhancements
-
☁️ Real-time dashboard integration with Flask, Streamlit, or Dash.
-
🗂️ Store logs (counts, timestamps, directions) in a CSV or database.
-
🛰️ Integration with IoT or cloud analytics platforms.
-
🔊 Add audio or visual alerts for abnormal traffic or lane violations.
-
🧩 Multi-class vehicle differentiation (e.g., cars, trucks, bikes, buses).
-
📡 Remote monitoring via web streaming.
✅ Conclusion
The Vehicle Lane Counting System using YOLO and Supervision provides a reliable and flexible solution for real-time traffic monitoring.
By combining deep learning–based object detection, persistent tracking, and zone-based analytics, it delivers accurate, automated vehicle counting suitable for smart transportation, city surveillance, and data-driven traffic management.

Reviews
There are no reviews yet.