Construction PPE detector, YOLO11n
Detects 10 classes on construction-site photos: Hardhat, Mask, NO-Hardhat, NO-Mask, NO-Safety Vest, Person, Safety Cone, Safety Vest, machinery, vehicle. In the project, each hard hat and vest is then attached to the person wearing it and every worker gets a status. Training code, evaluation and the compliance rules: github.com/haroonkhan02/construction-safety-lidar-vision. Browser demo: spaces/haroonx02/construction-ppe-browser.
COCO-pretrained YOLO11n fine-tuned for 40 epochs (59 min on an Apple M5, 640 px) on the 2,605 training images of the Roboflow Construction Site Safety dataset.
Files
| File | What it is | Size | Test mAP@0.5 (82 images) |
|---|---|---|---|
yolo11n_ppe.pt | Ultralytics checkpoint | 5.5 MB | 0.713 (rectangular batches) |
onnx/yolo11n_ppe.onnx | ONNX FP32, opset 17, fixed 1 × 3 × 640 × 640 | 10.7 MB | 0.708 |
onnx/yolo11n_ppe_fp16.onnx | ONNX, FP16 weights, float32 input/output | 5.4 MB | 0.702 |
onnx/yolo11n_ppe_int8.onnx | ONNX, static INT8 (QDQ, per-channel, 200 training images, MinMax) | 3.3 MB | 0.698 |
All ONNX files are scored on the same 640 × 640 letterbox; the PyTorch model on that input scores 0.708, exactly like the FP32 ONNX file. The INT8 file keeps the last convolution of each head branch and the box decoding in float.
ONNX input images: float32 (1, 3, 640, 640), RGB in [0, 1], letterboxed (aspect ratio
kept, bilinear resize, grey 114 padding, centred). Output output0: (1, 14, 8400), box
centre x, y, width, height in input pixels and one sigmoid score per class. NMS is not in the
graph: keep anchors whose best score is above the threshold (the project uses 0.35) and run
class-aware NMS at IoU 0.5. The Ultralytics metadata is embedded, so
YOLO("yolo11n_ppe_int8.onnx", task="detect") works directly.
Evaluation
| Test images | mAP@0.5 | mAP@0.5:0.95 | Violation flags P / R |
|---|---|---|---|
| All 82 | 0.713 | 0.413 | 0.97 / 0.68 |
| 40 clean (no source video shared with training) | 0.671 | 0.384 |
Half of the dataset's test images come from videos also used in training, so the clean subset is the fairer number. With the INT8 file: 0.698 / 0.650 mAP@0.5 (all / clean), violation flags 0.95 / 0.67.
INT8 is sensitive to small input changes: letterboxing the same images with OpenCV's
INTER_LINEAR_EXACT instead of INTER_LINEAR (1 grey level apart on some pixels) leaves
97–98 % of INT8 boxes matched at IoU 0.5 but only 7–9 % at IoU 0.99; for the FP32 file it is
91–96 % at IoU 0.99 (test images resized to 960 × 720 and 500 × 333).
Intended use and limits
A learning project, not a safety system. About a third of the workers with a violation in the test set are missed: 17 of the 28 misses are workers the detector didn't find at all, the other 11 had the missing item undetected. The images are mostly daylight scenes. Do not use it to discipline workers automatically; camera monitoring of employees needs a legal basis and a stated purpose.
Data and licences
The weights are a fine-tuned Ultralytics YOLO11n and are released under AGPL-3.0, like Ultralytics YOLO itself. Training data: Construction Site Safety (Roboflow, CC BY 4.0). The project's training and evaluation code is MIT.