Instructions to use constructelligence/buildvision-site-hazards with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use constructelligence/buildvision-site-hazards with ultralytics:
from ultralytics import YOLOvv8 model = YOLOvv8.from_pretrained("constructelligence/buildvision-site-hazards") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
BuildVision site-hazard detector v0.1
A small (YOLOv8n, 12.2 MB ONNX) object detector for construction-site photos and video that finds workers, hard hats and hi-vis vests β worn and missing β and heavy plant (excavators, wheel loaders, dump trucks) in one pass, sized to run in a browser tab. It powers the Job Site mode of BuildVision, where missing-PPE boxes are matched to the worker they belong to and every detected machine gets an operating-radius check.
11 output classes: person, hardhat, no-hardhat, safety vest, no-safety vest, no-mask, gloves, safety shoes, excavator, wheel loader, dump truck. Of these, no-mask, gloves, safety shoes are not detected in practice β see Limitations.
Not a safety system. This is a prompt to look, not a finding. It is not safety-rated, not a substitute for a competent person's inspection, and never a compliance record.
Model output at confidence β₯ 0.35 on an image from the PPE detection 1 test split (CC BY 4.0), not seen in training.
Results
Held-out test set: the untouched test splits of 4 public construction-safety datasets, 573 images, with near-duplicates of any training or validation image removed. 3 of those sources were not in this model's training data, so their rows measure how it generalises to new sites and camera styles.
mAP50 0.442 Β· mAP50-95 0.241 Β· precision 0.714 Β· recall 0.432
Per class (test)
| Class | Boxes | Precision | Recall | mAP50 | mAP50-95 |
|---|---|---|---|---|---|
person |
713 | 0.882 | 0.732 | 0.807 | 0.388 |
hardhat |
547 | 0.776 | 0.751 | 0.795 | 0.367 |
no-hardhat |
126 | 0.117 | 0.191 | 0.047 | 0.011 |
safety vest |
382 | 0.794 | 0.592 | 0.708 | 0.365 |
no-safety vest |
222 | 0.621 | 0.266 | 0.368 | 0.135 |
no-mask β not detected |
2 | 1.000 | 0.000 | 0.000 | 0.000 |
gloves β not detected |
248 | 1.000 | 0.000 | 0.000 | 0.000 |
safety shoes β not detected |
268 | 1.000 | 0.000 | 0.000 | 0.000 |
excavator |
133 | 0.550 | 0.707 | 0.698 | 0.366 |
wheel loader |
46 | 0.497 | 0.870 | 0.777 | 0.540 |
dump truck |
78 | 0.619 | 0.646 | 0.666 | 0.477 |
Per source (test)
| Source | Images | mAP50 | mAP50-95 |
|---|---|---|---|
| Construction Site Safety | 34 | 0.503 | 0.293 |
| PPE detection 1 (not in training data) | 101 | 0.641 | 0.315 |
| PPE_Dectection v4 (not in training data) | 254 | 0.375 | 0.171 |
| excavators-czvg9 (RF100) (not in training data) | 184 | 0.677 | 0.438 |
These are numbers on this test set. Other open PPE models report on their own datasets, so a side-by-side number
is not a head-to-head comparison. Two sources label people incompletely; in their test images, people a stock COCO
YOLOv8s finds (confidence β₯ 0.5) were added as person boxes so correct detections are not scored as false positives.
Use
Ultralytics (PyTorch):
from ultralytics import YOLO
model = YOLO("buildvision-hazards-v0.1.pt")
for box in model("site.jpg", imgsz=448, conf=0.35)[0].boxes:
print(model.names[int(box.cls)], float(box.conf), box.xyxy.tolist())
onnxruntime only (no torch): pip install onnxruntime numpy pillow, then
python predict_onnx.py site.jpg --out boxes.jpg. Input is 1Γ3Γ448Γ448 RGB in [0, 1], letterboxed
with grey (114) padding; output is 1Γ15Γanchors (cx, cy, w, h, then one score per class), NMS not included.
Browser: the same ONNX file runs in onnxruntime-web (single-threaded WASM).
Training
- Architecture: YOLOv8n from COCO weights. Fine-tuned in two stages: 24 epochs at 512 px on Construction Site Safety alone, then 6 epochs at 448 px on both datasets.
- Data: Construction Site Safety, construction-safety-gsnvb (RF100) (both CC BY 4.0): 1,304 training and 266 validation images.
- Classes dropped from the source labels: classes with one to three boxes in the whole corpus (barricade, dumpster, mask, mini-van, truck, safety net) cannot be learned and were removed before training.
Limitations
- Not detected in practice: too few training examples to learn β
no-mask: 36 training boxesgloves: 11 training boxessafety shoes: 9 training boxes These output channels exist in the model but should be ignored.
- Missing-PPE classes are the weak spot:
no-hardhatandno-safety vestscore well below their worn counterparts, especially on sites and camera styles not in the training data. Expect missed violations and false alarms. - No fall protection: none of the training data labels harnesses, lanyards or edge protection.
- Small model: YOLOv8n trades accuracy for running in a browser.
- Plant operating radius is not in the model: BuildVision's radius rule is a heuristic on the detected box.
Licence
- Weights: AGPL-3.0. They were trained with Ultralytics YOLOv8, whose models and derivatives are AGPL-3.0 unless covered by an Ultralytics Enterprise licence. Using them in a network service means offering that service's source.
- Data: CC BY 4.0, attribution below.
Attribution
- Construction Site Safety β Roboflow Universe Projects, CC BY 4.0 β https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety
- construction-safety-gsnvb (RF100) β Roboflow 100, CC BY 4.0 β https://universe.roboflow.com/roboflow-100/construction-safety-gsnvb
- PPE detection 1 β vincentspace, CC BY 4.0 β https://universe.roboflow.com/vincentspace/ppe-detection-1-cniwr (evaluation only)
- PPE_Dectection v4 β himanshu-bharati, CC BY 4.0 β https://universe.roboflow.com/himanshu-bharati/ppe_dectection-dtt4q (evaluation only)
- excavators-czvg9 (RF100) β Roboflow 100, CC BY 4.0 β https://universe.roboflow.com/roboflow-100/excavators-czvg9 (evaluation only)
Person pseudo-labels in the test set from Ultralytics YOLOv8s (COCO).
- Downloads last month
- 7
Evaluation results
- mAP@50 on Construction safety test set (573 images, 4 sources)test set self-reported0.442
- mAP@50-95 on Construction safety test set (573 images, 4 sources)test set self-reported0.241
