نظام ذكي لعدّ الأشخاص باستخدام تتبع الاتجاه
Person Counting Using Directional Tracking
A real-time person counting system using a custom YOLO12 model to track individuals as they cross
a defined vertical line, accurately determining whether they are entering (IN) or exiting (OUT)
a monitored area.
Project Overview
This project implements a real-time people counting solution using a custom-trained YOLO12 model.
The system detects and tracks individuals in a video stream and determines movement direction by
analyzing changes in their X-axis position as they cross a virtual vertical line.
Key Features
Custom YOLO12 Person Detection
- 🧠 Custom-trained YOLO12 nano model for person detection.
- ⚡ Lightweight and optimized for real-time performance.
Directional IN / OUT Counting
- ➡️ Counts people moving left to right as IN.
- ⬅️ Counts people moving right to left as OUT.
Real-Time Tracking with IDs
- 🆔 Uses persistent object IDs to track individuals across frames.
- 🔁 Prevents duplicate counting.
Visual Annotations
- 📦 Bounding boxes and center points for each person.
- 📊 Live IN / OUT counters displayed on screen using cvzone.
Edge Device Ready
- 🧩 Nano model suitable for low-resource edge devices.
- 📡 Works with video files, webcams, or IP camera streams.
Technology Stack
- 🐍 Programming Language: Python 3.x
- 🎥 Computer Vision: OpenCV
- 🧠 Object Detection & Tracking: Ultralytics YOLO12
- 🖥️ Visualization: cvzone
- ⚡ GPU Acceleration: CUDA (optional)
- 📊 Numerical Processing: NumPy
Use Cases
- 🏢 Smart Office Entry Monitoring
- 🛍️ Retail Foot Traffic Analytics
- 🎟️ Event Entry & Exit Tracking
- 🎓 School & University Attendance Analysis
- 🚉 Public Transport Station Crowd Management
- 🛡️ Security & Surveillance Systems
Conclusion
This project provides a lightweight and accurate real-time solution for directional people counting.
By combining a custom YOLO12 model with intelligent movement analysis, the system delivers valuable
insights for crowd control, security, and smart building automation, while remaining suitable for
deployment on edge devices.