SafeSite AI is a Flask-based construction safety monitoring app that uses YOLO models to detect workers, PPE compliance, and restricted-zone intrusions in real time.
https://drive.google.com/file/d/1keShImRescQkreYiGrvxLL_G49aH4vRY/view?usp=sharing
- Real-time video monitoring from a webcam or uploaded video file
- PPE violation detection for missing helmets and safety vests
- Restricted-zone creation and intrusion alerts
- Bilingual voice alerts
- Violation logging in a local SQLite database
- Dashboard analytics and PDF report generation
SafeSIteAI/
|-- app.py # Flask entry point
|-- detection/ # PPE and zone detection logic
|-- alerts/ # Voice alert system
|-- database/ # SQLite access layer
|-- dashboard/ # Analytics and charts
|-- reports/ # PDF report generation
|-- templates/ # Flask HTML templates
|-- static/ # CSS, JS, and generated screenshots
|-- zones/ # Persisted restricted-zone definitions
|-- uploads/ # Uploaded video files
|-- runs/ # YOLO training/inference outputs
|-- ppe detection.v3i.yolov8/ # Local dataset folder
|-- requirements.txt
|-- .gitignore
- Python 3.11+ recommended
- A webcam for live monitoring, or a local video file
- YOLO model weights placed in the project root:
ppe_best.ptyolov8n.pt
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtpython app.pyThen open http://127.0.0.1:5000 in your browser.
yolov8n.ptdetects people in the frame.ppe_best.ptdetects PPE items such as helmets and vests.- A worker is flagged when their bounding box does not sufficiently overlap with the required PPE detections.
- Restricted zones are stored in
zones/zones.json. - Violations are stored in
database/safesiteai.db. - Incident screenshots are saved under
static/screenshots/.
/live monitoring page/dashboardanalytics dashboard/reportsreport generation page/video_feedMJPEG stream
API endpoints include:
POST /api/startPOST /api/stopPOST /api/upload_videoGET /api/videosPOST /api/toggle_detectionPOST /api/toggle_voiceGET/POST /api/zonesDELETE /api/zones/<name>POST /api/zones/clearGET /api/violationsPOST /api/report/generateGET /api/statsGET /api/recent_violations
The repository is configured to ignore local/generated artifacts such as:
- virtual environments and Python cache
- uploaded videos
- generated violation screenshots
- local SQLite databases
- YOLO training outputs in
runs/ - large model weights like
*.pt - bulky dataset contents inside
ppe detection.v3i.yolov8/
Dataset metadata files such as data.yaml and the Roboflow README files are still kept trackable.
uploads/,static/screenshots/, and the database file are created and updated locally at runtime.- The dataset folder in this project appears to be intended for local experimentation/training, not for normal source control.
- If you want this project to be easier for other people to run, the next good step would be adding sample environment/setup notes for model downloads and OS-specific voice dependencies.