A computer vision system that detects and tracks people in video using YOLOv8. It assigns persistent IDs, monitors a defined zone, calculates dwell time, and logs alerts when a person remains inside the zone for more than three seconds.
- Real-time person detection using YOLOv8
- Persistent multi-object tracking
- Unique tracking ID for each detected person
- Configurable monitored zone
- Per-person dwell-time calculation
- Automatic alerts after three seconds inside the zone
- Timestamped alert logging
- Live confidence scores and tracking statistics
- Retail customer movement analysis
- Restricted-area monitoring
- Queue and waiting-time analysis
- Workplace safety monitoring
- Occupancy and behavioural analytics
pip install -r requirements.txt
## Usage
Place a video named retail_store.mp4 in the project directory and run:
python people_tracker.py
Press q to stop the application.
The YOLOv8 model weights are downloaded automatically by Ultralytics when the program runs for the first time.
## Configuration
Change the monitored zone coordinates inside people_tracker.py:
ZONE = (200, 300, 800, 600)
The values represent:
(x1, y1, x2, y2)
To use another video, update:
run(source="retail_store.mp4")
## Alert Logic
When the centre point of a tracked person's bounding box enters the monitored zone, the system begins calculating dwell time.
An alert is generated when the same person remains inside the zone for more than three seconds.
Alerts are written to:
tracking_log.txt
## Project Structure
People-Tracking/
├── people_tracker.py
├── requirements.txt
├── README.md
└── .gitignore
Model weights, videos, generated logs, virtual environments, and cache files are excluded from the repository.