yolo26s-construction-ppe: hard hat and safety vest detector for construction sites
yolo26s.pt fine-tuned to find helmets, safety vests, people, and people without a helmet or vest on construction-site photos. Shipped as PyTorch and ONNX (FP32 / FP16). Every number below is measured on the held-out test split (119 images), which played no part in training, checkpoint selection, or INT8 calibration.
Accuracy, size, and speed
| variant | file | size, MB | mAP50 | mAP50-95 | Δ mAP50-95 vs FP32 [95% CI] | P | R | agreement F1 | Tesla T4 ms (FPS) | CPU 2 threads ms (FPS) |
|---|---|---|---|---|---|---|---|---|---|---|
| PyTorch FP32 | best.pt | 19.4 | 0.915 | 0.508 | — | 0.928 | 0.853 | 1.000 | 10.2 (98) | 349.5 (2.9) |
| ONNX FP32 | best-fp32.onnx | 36.4 | 0.915 | 0.508 | +0.000 [+0.000 … +0.000] | 0.928 | 0.853 | 1.000 | 11.0 (91) | 230.5 (4.3) |
| ONNX FP16 | best-fp16.onnx | 18.3 | 0.915 | 0.508 | -0.001 [-0.002 … +0.001] | 0.928 | 0.853 | 1.000 | 5.9 (168) | 239.9 (4.2) |
| ONNX INT8 U8U8 (not shipped, see below) | — | 11.0 | 0.913 | 0.512 | +0.004 [-0.008 … +0.011] | 0.885 | 0.886 | 0.909 | — | 269.2 (3.7) |
ONNX INT8, Ultralytics quantize=8 (reference, not shipped) | — | 9.8 | 0.904 | 0.508 | -0.000 [-0.024 … +0.011] | 0.906 | 0.858 | 0.899 | — | 427.5 (2.3) |
| ONNX INT8, dynamic (reference, not shipped) | — | 10.6 | 0.804 | 0.410 | -0.099 [-0.130 … -0.050] | 0.803 | 0.771 | 0.460 | — | 354.4 (2.8) |
All variants evaluated at 640×640. mAP: Ultralytics validator, conf=0.001, IoU=0.7, batch 1; INT8 rows on the CPU execution provider, the others on GPU. Δ and CI: paired bootstrap over test images (1000 resamples). Agreement F1: detections (conf ≥ 0.25) matched to PyTorch FP32 with the same class and IoU ≥ 0.9, no ground truth involved. Latency: network forward pass only (no JPEG decoding, no NMS), input 1×3×640×640 from host memory, median of 300 (GPU) / 50 (CPU) runs after 20 warm-up runs, each variant in a fresh process. Reference CPU: Intel(R) Xeon(R) CPU @ 2.00GHz, 2 threads, without VNNI (ISA: avx2, avx512f, avx512bw) — Google Colab. ONNX Runtime 1.31.1, Ultralytics 8.4.211, PyTorch 2.14.1+cu130.
Which file to use
- GPU:
best-fp16.onnx: 5.9 ms on Tesla T4 vs 10.2 ms for PyTorch FP32, Δ mAP50-95 -0.001. Expects a float16 input. - CPU:
best-fp32.onnx: 230 ms on the reference CPU (1.5× faster than PyTorch), same accuracy as PyTorch, runs anywhere ONNX Runtime does. INT8 is not shipped because on the reference CPU it did not pass the bar: 0.84× vs ONNX FP32, below the 1.1× bar. See Faster on your hardware. - Why not the stock Ultralytics INT8 export: it runs at 428 ms on the same CPU vs 230 ms for FP32. It quantizes only Conv/MatMul inputs, so ONNX Runtime keeps computing in float and only the file gets smaller.
Faster on your hardware
The files above are the portable defaults. Latency depends on the exact chip, so for production it pays to build and verify an optimized variant on the target hardware:
- x86 CPUs with VNNI / AMX (Intel Cascade Lake and newer, AMD Zen 4 and newer): INT8 with int8 weights (U8S8) is usually faster than the universal U8U8 file. Calibrate it and check mAP on the target CPU.
- Intel CPUs and iGPUs: OpenVINO INT8 via NNCF (
format="openvino", quantize=8). - NVIDIA GPUs: TensorRT FP16 or INT8 (
format="engine"). ONNX Runtime CUDA does not speed up INT8.
Whatever the variant, re-check accuracy on held-out images on the target device: INT8 kernels differ between CPUs.
Per-class results (PyTorch FP32, test)
| class | test instances | images | P | R | AP50 | AP50-95 | AP50-95 95% CI |
|---|---|---|---|---|---|---|---|
| helmet | 232 | 117 | 0.938 | 0.918 | 0.946 | 0.538 | 0.496 – 0.582 |
| no-helmet | 11 | 6 | 1.000 | 0.715 | 0.884 | 0.367 | 0.298 – 0.576 |
| no-vest | 89 | 51 | 0.882 | 0.839 | 0.852 | 0.444 | 0.367 – 0.521 |
| person | 241 | 115 | 0.911 | 0.938 | 0.953 | 0.658 | 0.614 – 0.708 |
| vest | 141 | 74 | 0.909 | 0.854 | 0.939 | 0.534 | 0.493 – 0.578 |
| all | 714 | 119 | 0.928 | 0.853 | 0.915 | 0.508 | 0.482 – 0.560 |
no-helmet has only 11 instances in the test split, so its AP comes with a wide interval. Treat it as indicative.
| Confusion matrix (normalized, test) | Precision-recall curve (test) |
|---|---|
![]() | ![]() |
Usage
from ultralytics import YOLO
model = YOLO("best-fp32.onnx") # CPU; on GPU use "best-fp16.onnx" or "best.pt"
for r in model.predict("site.jpg", conf=0.35):
for xyxy, cls, conf in zip(r.boxes.xyxy.tolist(), r.boxes.cls.tolist(), r.boxes.conf.tolist()):
print(r.names[int(cls)], round(conf, 2), [round(v) for v in xyxy])
Plain ONNX Runtime: input images, 1×3×640×640, RGB scaled to [0, 1], letterboxed to 640×640. Output output0, 1×9×8400: box center x, center y, width, height in input pixels, then 5 class scores. Apply class-aware NMS (IoU 0.7). Classes: 0 helmet, 1 no-helmet, 2 no-vest, 3 person, 4 vest.
Data and quality audit
Source: Francesco/construction-safety-gsnvb (Roboflow 100, CC BY 4.0), official splits. The audit report is in eval/audit.json.
| train | val | test | |
|---|---|---|---|
| images before / after audit | 997 / 995 | 90 / 90 | 119 / 119 |
| boxes before / after audit | 6386 / 6380 | 623 / 623 | 715 / 714 |
- Leakage check that does not trust file names. Roboflow renames every export, so the same photo can sit in two splits under different names. Every image is compared with every other by MD5 of the file, MD5 of the pixels, and a 128-bit perceptual hash (pHash + dHash, also against the mirrored image). 2 cross-split duplicate(s) found; the copy outside the more valuable split was removed (test is kept intact, so results stay comparable with RF100). Smallest test→train Hamming distances before removal: [0, 25, 30, 31, 31] bits of 128; anything ≤ 10 counts as a copy. Example below: the same photo in test and train, labeled differently.
- Images: decoded in full, size checked against the annotation; 0 issue(s).
- Boxes: 0 clipped to the frame, 2 degenerate (< 2 px) removed, 0 duplicates (same class, IoU > 0.95) removed, 0 invalid removed; 0 images without objects kept as background.
- The empty Roboflow parent class
construction-safety(0 boxes) is dropped; 5 classes remain.

Training
- Base:
yolo26s.pt(COCO), image size 640, batch 16, optimizer AdamW, AMP fp16, seed 42. - Up to 60 epochs with early stopping (patience 15); ran 60 epochs.
best.ptis the epoch with the highest val mAP50-95 (epoch 48: val mAP50 0.8276, mAP50-95 0.4364; validation during training uses Ultralytics' default rectangular batches). - Augmentations: mosaic 1.0 (off for the last 10 epochs), mixup 0.1, HSV (0.015, 0.7, 0.4), horizontal flip 0.5, scale ±0.5, translate ±0.1.
- Hardware: Tesla T4, 17.3 min. Curves:
assets/training_curves.png,eval/train_results.csv.
INT8 recipe
ONNX Runtime static quantization, QDQ format, U8U8: uint8 activations and uint8 per-channel weights, MinMax calibration on 200 train images. U8U8 does not take the saturating int16 path that U8S8 can take on x86 CPUs without VNNI, at some cost in peak speed on VNNI machines. The whole graph is quantized except the box-decoding tail of the detection head (pixel coordinates and 0–1 scores share one tensor, so one 8-bit scale would flatten the scores) and the C2PSA attention block. Opset 17, static batch 1. Shipping rule: Δ mAP50-95 ≥ −0.01 and ≥ 1.1× faster than ONNX FP32 on the reference CPU (median of 3 alternating A/B rounds, and not slower in any round) — not passed: 0.84× vs ONNX FP32, below the 1.1× bar.
Limitations
- 119 test images and a few hundred objects per class; small differences between variants are within noise, see the confidence intervals.
- Rare classes:
no-helmetandno-vestare the classes that matter most for safety alerts and the ones with the fewest examples. Validate on footage from the target site before relying on alerts. - Photos are 640×640 stills from the Roboflow community dataset, so domain shift to CCTV angles, night, or rain is expected.
- Latency was measured on Colab hardware; re-measure on the target device.
Changelog
- v2 (re-evaluation, same
best.pt, no retraining):- All variants evaluated at 640×640. In v1
best.ptwas validated at 672×672, because Ultralytics'model.val()defaults to rectangular batches with half-stride padding, while the ONNX files have a fixed 640×640 input (v1 PyTorch FP32: mAP50-95 0.509 at 672 → 0.508 at 640). - INT8 switched from U8S8 to U8U8: on the v1 reference CPU the U8S8 file lost 0.230 mAP50-95, consistent with the int16 saturation U8S8 can hit on x86 CPUs without VNNI.
- INT8 is shipped only if it passes the accuracy and speed bar; the file recommendations follow the measurements.
- All variants evaluated at 640×640. In v1
- v1: training, audit, first evaluation.
License
The weights are derived from Ultralytics YOLO and inherit AGPL-3.0. Commercial closed-source use requires an Ultralytics Enterprise license. The dataset is CC BY 4.0 (Roboflow 100).

