yihong1120/Construction-Hazard-Detection
Construction-Hazard-Detection
YOLO26 construction-site safety detection models, with legacy YOLO11 checkpoints. The repository includes portable PyTorch and ONNX weights, plus TensorRT INT8 artifacts evaluated on the original, unaugmented validation split.
The full application, training utilities, and evaluation tooling live in the main project.
Project and data links
- GitHub: full Construction-Hazard-Detection system
- Roboflow: Construction Hazard Detection dataset reference
The GitHub repository contains the production services, training code, and deployment configuration. The Roboflow project is the dataset reference for this work; the validation images and labels used for the published metrics are not redistributed in this model repository.
Recommended artifacts
- Use models/yolo26/pt/*.pt for the most portable Ultralytics workflow.
- Use models/yolo26/onnx/*.onnx for ONNX Runtime or custom deployment.
- Use models/yolo26/tensorrt/mixed/*.engine on the documented RTX 4090 environment when accuracy and TensorRT throughput both matter.
- Treat models/yolo26/tensorrt/int8/*.engine as a lower-accuracy option. It is not recommended for the m or x variants on this validation set.
Labels
0: Hardhat 1: Mask 2: NO-Hardhat 3: NO-Mask 4: NO-Safety Vest 5: Person 6: Safety Cone 7: Safety Vest 8: machinery 9: utility pole 10: vehicle
Validation results
All results use 6,664 original validation images (61,458 instances), at imgsz=640, batch size 16. A duplicate label in one source annotation was removed automatically by Ultralytics during validation. The table reports box mAP50-95; the full precision, recall, mAP50, timing, checksum, and file size records are in evaluation/yolo26_precision.csv.
FP16 is evaluated from the same PyTorch checkpoint as FP32. "Mixed" denotes a TensorRT INT8 engine whose YOLO Detect head stays FP16. "Pure INT8" quantizes the full graph. These are validation results, not an independent held-out test: the TensorRT calibration set is a 512-image, class-balanced sample from the same original validation split. See evaluation/README.md for the exact methodology and limitations.
Inference efficiency
The table below is a dedicated model-forward microbenchmark, measured with synchronized CUDA events after 50 warmup iterations and over 200 timed iterations. Each cell is batch 1 latency in milliseconds / batch 16 model-only throughput in images per second. Lower latency and higher throughput are better.
At batch 1, FP16 can be marginally slower for the smallest models because launch and datatype-conversion costs outweigh tensor-core gains. At batch 16, FP16 is consistently faster. These are model-forward timings, not camera-stream FPS: they exclude RTSP decode, frame acquisition, queueing, tracking, annotation, encoding, and browser playback. The raw benchmark, environment, and reproducible implementation are available in evaluation/yolo26_inference_benchmark.csv, evaluation/inference_benchmark_environment.json, and scripts/benchmark_yolo26_inference.py.
TensorRT compatibility
The published engines were built and tested on:
OS: Linux x86_64 GPU: NVIDIA GeForce RTX 4090 (compute capability 8.9) NVIDIA driver: 580.173.02 CUDA: 13.0 TensorRT: 11.1.0.106 PyTorch: 2.13.0+cu130 Ultralytics: 8.4.113 Engine profile: dynamic batch, max batch 16, imgsz 640
TensorRT engines are hardware-, runtime-, and platform-dependent. Rebuild an engine for another GPU or TensorRT environment rather than assuming it will load. Only deserialize engine files from a trusted release. The reproducible export implementation is available in the main project's export script.
Quick start
from huggingfacehub import hfhub_download from ultralytics import YOLO
checkpoint = hfhubdownload( repo_id="yihong1120/Construction-Hazard-Detection", filename="models/yolo26/pt/yolo26x.pt", ) model = YOLO(checkpoint) results = model("data/examples/demo.jpg", imgsz=640, conf=0.25)
For the compatible TensorRT environment:
from ultralytics import YOLO
model = YOLO("models/yolo26/tensorrt/mixed/yolo26x.engine") results = model("data/examples/demo.jpg", imgsz=640, conf=0.25)
Repository layout
models/ yolo26/ pt/ # FP32/FP16 runtime checkpoints onnx/ # Portable ONNX exports tensorrt/ mixed/ # INT8 backbone/neck with FP16 Detect head int8/ # Full-graph INT8 yolo11/ # Legacy PyTorch and ONNX checkpoints evaluation/ yolo26precision.csv # Raw metrics, artifact hashes, and validation timing yolo26inferencebenchmark.csv # CUDA-event latency and throughput environment.json # Evaluation software and hardware environment inferencebenchmarkenvironment.json README.md # Methodology and reproducibility instructions scripts/ evaluateyolo26precision.py benchmarkyolo26_inference.py
Intended use and limitations
These models support research and prototyping for construction safety monitoring. Detection quality depends on camera placement, lighting, occlusion, PPE appearance, and site-specific conditions. Evaluate on the target site before safety-critical use, and combine detections with tracking and appropriate human review.
The original validation images and annotations are not redistributed in this repository. Do not treat the published validation metrics as a replacement for an independently licensed and held-out test set.
License
This repository, its models, and the associated Ultralytics workflow are released under AGPL-3.0. Review the license obligations before using the models in a networked or commercial deployment.
