نظام تتبع وعدّ المركبات حسب المسار
Vehicle Lane Traffic Tracker and Counting System
A real-time vehicle counting and lane tracking system powered by a custom YOLO12 model. It detects cars, buses,
and trucks, tracks them across frames, and counts vehicles based on their movement direction (IN / OUT) when
crossing a predefined virtual line.
Project Overview
This project implements a real-time vehicle lane IN/OUT counting system using a custom-trained YOLO12 object
detection model integrated with OpenCV and cvzone. The system processes video streams to detect and track
vehicles, assigns unique IDs, and determines directional flow when vehicles cross a horizontal virtual line.
Key Features
Real-Time Object Detection & Tracking
- 🚘 Detects cars, buses, and trucks in live video streams.
- 🆔 Maintains unique IDs for each vehicle across frames.
IN / OUT Direction Detection
- ⬇️ IN: Vehicles crossing from top to bottom.
- ⬆️ OUT: Vehicles crossing from bottom to top.
Vehicle Type-Specific Counting
- 🚗 Separate counters for cars.
- 🚌 Separate counters for buses.
- 🚛 Separate counters for trucks.
Color-Coded Visualization
- 🔴 Red bounding boxes for cars.
- 🔵 Blue bounding boxes for buses.
- 🟡 Yellow bounding boxes for trucks.
Optional / Custom Extensions
- 📄 CSV or database logging of vehicle entries and exits.
- 📊 Traffic trend graphs over time.
- ➖ Multi-line support for complex intersections.
- 🔍 License Plate Recognition (LPR).
- ☁️ Cloud integration for remote monitoring.
Technology Stack
- 🐍 Programming Language: Python 3.x
- 🎥 Computer Vision: OpenCV
- 🧠 Object Detection & Tracking: Ultralytics YOLO12 (Custom Model)
- 🖥️ Visualization: cvzone
- 📐 Numerical Processing: NumPy
- ⚡ GPU Acceleration: CUDA (Optional)
Use Cases
- 🚦 Traffic Monitoring & Control Systems
- 🛣️ Highway Entry / Exit Analytics
- 🚧 Construction Site Vehicle Logs
- 🏢 Industrial & Corporate Gate Management
- 🅿️ Smart Parking Garage Tracking
- 🏙️ Smart City Traffic Flow Analysis
Conclusion
This system demonstrates how lightweight deep learning models like YOLO12 can be efficiently integrated with
OpenCV for real-time vehicle detection, tracking, and directional flow analysis. With accurate counting, clear
visualization, and strong performance, it is well-suited for smart city deployments, traffic analytics, and
industrial automation.