- Overview
- The Problem
- How It Works
- Tech Stack
- Project Structure
- Getting Started
- Features
- Detection Workflow
- Roadmap
- Learning Outcomes
- Author
Real-Time PPE Detection System is an end-to-end Computer Vision application that automatically identifies whether workers are wearing required Personal Protective Equipment β helmets, safety vests, gloves, and more β using state-of-the-art object detection.
Built on YOLOv8 (You Only Look Once v8) and OpenCV, this system delivers fast, accurate inference on both static images and live video streams, making it production-ready for integration into industrial safety pipelines.
β‘ Part of an Applied AI Engineering roadmap focused on building real-world, deployable AI systems.
Every year, thousands of workplace injuries occur due to missing or improper use of Personal Protective Equipment. In environments like:
| Environment | Common PPE Required |
|---|---|
| ποΈ Construction Sites | Helmets, safety vests, boots |
| π Factories & Warehouses | Gloves, goggles, hard hats |
| βοΈ Chemical Plants | Full-body suits, face shields |
| π Electrical Facilities | Insulated gloves, arc flash gear |
Manual monitoring of PPE compliance across large facilities is:
- β Time-consuming and error-prone
- β Impossible to scale with limited supervisors
- β Reactive rather than preventive
- β Subject to human fatigue and oversight
This system makes compliance monitoring proactive, automated, and scalable β detecting violations in real time before accidents happen.
The system is built on a simple, modular inference pipeline β any input source (image, video file, or live webcam stream) is passed through YOLOv8 for detection, then annotated with bounding boxes and confidence scores before being written to an output file or displayed on screen.
Each component is decoupled, making it easy to swap in a custom-trained PPE model, add a new input source, or plug in an alerting layer without touching the rest of the pipeline.
See the Detection Workflow section for the full pipeline diagram.
| Technology | Role | Version |
|---|---|---|
| Python | Core language | 3.8+ |
| YOLOv8 (Ultralytics) | Object detection model | Latest |
| OpenCV | Image/video processing | 4.x |
| PyTorch | Deep learning backend | 2.x |
| NumPy | Numerical operations | 1.24+ |
real-time-ppe-detection-system/
β
βββ app/
β βββ inference.py # π Core detection script
β
βββ data/ # π Input images & videos
β βββ images/
β βββ videos/
β
βββ models/ # π€ YOLOv8 model weights (.pt files)
β βββ yolov8n.pt
β
βββ outputs/ # π€ Annotated detection results
β βββ images/
β βββ videos/
β
βββ requirements.txt # π¦ Python dependencies
βββ README.md # π Project documentation- Python 3.8 or higher
- pip package manager
- Git
git clone https://github.com/gee-46/real-time-ppe-detection-system.git
cd real-time-ppe-detection-systemCreate the environment:
python -m venv venvActivate β Windows:
venv\Scripts\activateActivate β macOS / Linux:
source venv/bin/activatepip install ultralytics opencv-python numpyOr using requirements.txt (recommended):
pip install -r requirements.txtrequirements.txt:
ultralytics>=8.0.0
opencv-python>=4.8.0
numpy>=1.24.0
python app/inference.pyπ By default, the script runs detection on images inside the
data/directory.
Modifyinference.pyto point to your own images, video files, or webcam feed.
The detection pipeline follows a clean, modular flow from any input source to annotated output:
π· Input Source (Image / Video / Webcam)
β
βΌ
βββββββββββββββββββββββ
β Frame Capture β β OpenCV VideoCapture / imread
β & Preprocessing β
βββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββ
β YOLOv8 Inference β β Ultralytics model.predict()
β (Object Detection)β
βββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Post-Processing β β Bounding boxes, class labels,
β & Visualization β confidence scores overlay
βββββββββββ¬ββββββββββββ
β
βΌ
π€ Output (Annotated Image / Video / Alert)
| Feature | Status |
|---|---|
| π― YOLOv8 object detection | β Available |
| πΌοΈ Image-based detection | β Available |
| π¦ Bounding box visualization | β Available |
| π·οΈ Class label + confidence overlay | β Available |
| π₯ Video file inference | β Available |
| πΉ Live webcam detection | π Coming Soon |
| π¦Ί PPE-specific custom model | π Coming Soon |
| π¨ Real-time alert system | π Coming Soon |
| π FastAPI backend | π Coming Soon |
Phase 1 β Foundation (Current) β
βββ YOLOv8 integration
βββ Image-based detection pipeline
βββ Bounding box + label visualization
Phase 2 β Live Detection π
βββ Webcam / RTSP stream support
βββ Multi-frame processing
βββ Real-time FPS optimization
Phase 3 β PPE-Specific Model π
βββ Custom dataset (helmets, vests, gloves)
βββ Fine-tune YOLOv8 on PPE classes
βββ Confidence threshold tuning
Phase 4 β Alerts & Backend π
βββ Violation alert system (sound/email)
βββ FastAPI REST API integration
βββ Detection logs & reporting
Phase 5 β Deployment π
βββ Docker containerization
βββ Edge deployment (Raspberry Pi / Jetson)
βββ Cloud API (AWS / GCP)
This project covers the following concepts hands-on:
- β Computer Vision Fundamentals β image processing, frame handling, color spaces
- β Object Detection β understanding YOLO architecture, bounding boxes, IoU, NMS
- β Real-Time Inference β optimizing detection pipelines for speed
- β OpenCV Workflows β reading images/videos, drawing annotations, displaying results
- β Deep Learning Integration β using pretrained models from Ultralytics
- β AI for Safety Systems β applying AI to solve real industrial problems
Built by gee-46
Part of an Applied AI Engineering roadmap β building production-ready AI systems for real-world deployment.
If this project helped you, consider giving it a β on GitHub!
This project is licensed under the MIT License β free to use, modify, and distribute.