نظام عدّ الأشياء في الوقت الحقيقي باستخدام YOLO12
Real-Time Counter Using YOLO12 and Virtual Line Crossing Detection
Real-time object counting system using YOLO12 and OpenCV that detects, tracks, and counts multiple object types
as they cross a predefined virtual line.
Project Overview
This system detects, tracks, and counts multiple object types (people, boxes, equipment) crossing a virtual line
in a video feed. Unique IDs are assigned to each object to prevent duplicates, and movement direction (IN/OUT)
is determined in real time. Works with live cameras and video files for flexible industrial, logistics, and
smart facility monitoring.
Key Features
Multi-Class Object Detection
- 🟢 Detects various object types: people, boxes, machinery, and custom classes.
Unique Object ID Tracking
- 🆔 Assigns unique IDs to each object for consistent counting and analytics.
Directional Movement Detection
- ➡️ Detects IN/OUT movement across a virtual line.
Real-Time Counting Overlay
- 📊 Displays live counts, object labels, and movement direction on the video frame.
Supports Video Files and Webcams
- 🎥 Works with live camera input or pre-recorded videos.
Pixel Coordinate Debugging Tool
- 🖱️ Mouse-click tool to get pixel coordinates for line placement and configuration.
Modular and Extensible Codebase
- ⚙️ Easily customizable for new object classes, zones, or analytics outputs.
Optimized for Real-Time Inference
- ⚡ Efficient frame-by-frame processing using YOLO12 and OpenCV for low-latency performance.
Technology Stack
- 🐍 Programming Language: Python
- 🎥 Computer Vision: OpenCV
- 🧠 Object Detection: YOLO12 (Ultralytics)
- 🖥️ Visualization: cvzone
- 💻 Input Sources: Webcam or video file
Use Cases
- 🏭 Warehouse & Inventory Flow Monitoring – track movement of goods and pallets.
- 🤖 Industrial Automation – monitor machinery components and tools.
- 🚚 Logistics & Supply Chain – count objects entering/exiting hubs.
- 🏢 Smart Facility Management – track people and equipment across zones.
- 🔒 Surveillance & Security – detect unauthorized object movements.
- 🛒 Retail & Supermarkets – monitor footfall and goods movement.
- 🏥 Hospitals & Healthcare – track staff and medical equipment efficiently.
- 🏫 School & Campus Monitoring – count students or deliveries through gates.
Conclusion
This real-time object counting system using YOLO12 provides an adaptable, efficient, and visual video analytics
solution. By tracking directional crossings over a virtual line, it supports industrial, commercial, and
surveillance applications. Modular design, real-time inference, and visual tracking feedback make it perfect for
warehouses, logistics hubs, smart facilities, and beyond.