A real-time safety monitoring system for hazardous industrial zones that detects people, verifies safety-vest compliance, and tracks dwell-time in danger areas—raising instant alerts when safety rules are violated.
-
Human Detection
Frame-by-frame person detection powered by YOLOv8 for high speed and accuracy. -
Safety-Vest Classification
Color-based vest presence check:- ❌ No Vest → Immediate RED alert
- 🟡 Yellow Vest → Start zone-timer & issue YELLOW warning if threshold exceeded
-
Zone-Based Timer
Tracks how long each person remains in the danger zone; configurable time limits trigger audible/visual warnings. -
(Optional) Face Recognition
Integrate dlib-based face matching to tag and log individual IDs in the dashboard. -
Web Dashboard
Flask-powered UI to stream video, display alerts, timers, and safety logs in real time.
- Python 3.8+
- CUDA-enabled GPU (recommended for real-time performance)
- Roboflow Dataset: Safety Vests
-
Clone this repository
git clone https://github.com/your-username/human-zone-tracking.git cd human-zone-tracking -
Create & activate a virtual environment
python3 -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate.bat # Windows
-
Install dependencies
pip install -r requirements.txt
-
Download or link your dataset
- Export your annotated images from Roboflow (YOLO format).
- Place
train/,val/,test/folders underdata/safety_vests/.
-
Train YOLOv8 model (optional)
yolo detect train model=yolov8n.yaml data=data/safety_vests/ epochs=50 imgsz=640
-
Run inference & dashboard
python app.py \ --weights runs/train/exp/weights/best.pt \ --source 0 \ --zone-file config/zone.json \ --time-threshold 10
--sourcecan be a webcam index or video file.--zone-filedefines polygon(s) of hazardous area(s).--time-thresholdis the max seconds allowed in-zone with a vest.
- Detection accuracy: mAP₅₀ > 92%
- Real-time performance: ≈25 FPS on RTX 2060
- Demo Video: YouTube Link
Here’s a sample frame with our human-zone overlays:
And here’s the “blue square” test pattern we used for calibration:
├── app.py # Main Flask app + inference loop
├── models/ # YOLOv8 model configs & weights
├── data/ # Train/Val/Test datasets
│ └── safety_vests/
├── utils/
│ ├── detector.py # YOLOv8 wrapper
│ ├── vest_classifier.py # Color-based vest check
│ ├── timer.py # Zone dwell-time logic
│ └── face_recog.py # (Optional) dlib integration
├── requirements.txt
└── README.md
-
config/zone.json{ "zone_polygon": [[x1,y1], [x2,y2], …, [xn,yn]] } -
config/settings.yamltime_threshold: 10 # seconds alert_colors: no_vest: "red" vest: "yellow"
- Fork the repo
- Create a feature branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -m "Add YourFeature") - Push to branch (
git push origin feature/YourFeature) - Open a Pull Request
Please adhere to the existing coding style and include tests for new functionality.
- Rasul & Zhanibek – YOLOv8 human & vest detection
- Olzhas & Bakkustar – Face-recognition module
- Ilyas – Zone timer & alert logic
Special thanks to Roboflow Universe Dataset for annotated safety-vest images.