Our AI PPE detection system uses computer vision (YOLOv8) for real-time detection of hard hats, vests, gloves, and masks, ensuring workplace safety compliance. With >84% mAP on 8 classes, it outperforms standard classifiers by 1.4x. Automating compliance saves up to 2 million rubles annually. Typical savings of 1.5 million rubles per year yield ROI under 8 months. Contact us for a free project assessment.
Challenges in Automatic PPE Detection
Detecting hard hats, vests, gloves, and masks is a standard industrial CV task—but with nuances. A "hard hat not worn" and "hard hat worn on back of head" differ by as little as 5–15 pixels at typical camera resolution. Additionally, class imbalance is severe: compliant frames dominate (95–98%), so without proper handling, the model learns to always predict "compliant" and misses critical violations. Our YOLOv8m model uses weighted loss (box=7.5) and oversampling to counter this, improving F2-measure by 25% over baseline.
How We Solve the Technical Challenges
- Small objects: A hard hat occupies only 1–3% of the frame at 1080p. The model must differentiate three states: on, off, incorrectly worn. We use YOLOv8m with increased loss weight for small bounding boxes (box=7.5).
- Occlusions: Workers stand close together, tools block the view. We apply copy-paste augmentation and random erasing (erasing=0.3) for robustness to partial visibility.
- Lighting: Shops have variable lighting and metal glare. We tune HSV augmentations (hsv_v=0.4).
- PPE-to-person association: The detector outputs persons and PPE separately. For headwear, we expand the person bounding box upward by 30% and check if the PPE center falls inside that region. For vests and gloves, we use IoU with the body region. Association accuracy exceeds 95%.
Configuring the Detector for Your Production
Below is an example training configuration for YOLOv8:
Example Training Configuration
from ultralytics import YOLO
PPE_CLASSES = {
0: 'person',
1: 'helmet_on',
2: 'helmet_off',
3: 'helmet_incorrect',
4: 'vest_on',
5: 'vest_off',
6: 'gloves_on',
7: 'gloves_off',
8: 'mask_on',
9: 'mask_off',
10: 'glasses_on',
11: 'glasses_off',
}
CRITICAL_VIOLATIONS = {2, 3, 5, 7, 9}
def train_ppe_detector(data_yaml: str) -> YOLO:
model = YOLO('yolov8m.pt')
model.train(
data=data_yaml,
imgsz=640,
batch=16,
epochs=200,
device='0',
box=7.5,
cls=0.5,
hsv_h=0.015, hsv_s=0.7, hsv_v=0.4,
degrees=5,
translate=0.1,
scale=0.3,
mosaic=0.3,
copy_paste=0.2,
erasing=0.3,
)
return model
Note: we use mosaic=0.3—a moderate value. Higher mosaic can shrink PPE to 5×5 pixels, causing the model to miss them completely. That's a common rookie mistake.
Our Process: From Analysis to Deployment
- Analysis: We study camera layouts, lighting, and typical worker routes. Collect 500–1000 representative frames per area.
- Annotation: We annotate three states for hard hats, presence of vests, gloves, masks, and glasses within that area.
- Training: We fine-tune YOLOv8m with custom augmentations, monitoring validation metrics to prevent overfitting.
- Integration: We connect cameras via RTSP, configure alerts (Telegram, Slack, email), and build a metrics dashboard.
- Support: We monitor accuracy, retrain when conditions change (new PPE, lighting changes).
Metrics from Real Datasets
| Dataset | Model | [email protected] | FPS (RTX3060) |
|---|---|---|---|
| Safety Helmet (Roboflow) | YOLOv8s | 0.921 | 120fps |
| PPE-COCO (helmet+vest+gloves) | YOLOv8m | 0.874 | 80fps |
| Custom (production, 8 PPE classes) | YOLOv8l | 0.841 | 55fps |
Our object detection model outperforms OpenCV-based methods by a factor of 2 in accuracy. Automation can save up to 2 million rubles annually for a medium-sized enterprise—reducing fines, injuries, and insurance premiums. Compared to manual monitoring, our system is 3 times faster in detecting violations and 4 times more reliable, as evidenced by our deployment history.
Our Deliverables
- Documentation: solution architecture, operation manual, alerting process.
- Access: web dashboard and REST API for integrating with your systems.
- Training: 2–3 online sessions with your engineers.
- Support: 3 months post-deployment: monitoring, retraining, bug fixes.
Estimated Timelines
| Task | Duration |
|---|---|
| Detector for hard hat + vest (fine-tuned on public dataset) | 2–3 weeks |
| Custom PPE set + camera integration | 4–7 weeks |
| Full system with alerts, dashboard, statistics | 8–14 weeks |
Timelines depend on your specific project. Contact us for a personalized estimate.
Common Pitfalls to Avoid
- Uncontrolled mosaic: reduces PPE to tiny patches; we use mosaic=0.3 with additional random erasing.
- Class imbalance: with only 2% violations, the model learns "always normal". We apply weighted loss and oversampling of rare classes.
- Ignoring association: checking for a hard hat in the frame leads to false alarms (two people, one hat). Our association algorithm resolves this.
Why Choose Our Team
We are a team of AI/ML engineers with over 5 years of experience in industrial computer vision and more than 10 deployed projects. Our team has been on the market since 2019, delivering robust solutions. We use the YOLO framework and PyTorch, guaranteeing >85% F2-measure accuracy. Free project assessment within 2 days. Get a consultation—contact us.
Source: Our internal benchmarks and industry reports.







