Personal protective equipment detection, running in your browser
A YOLOv8 model trained in 2023 to spot safety equipment on industrial worksites — and, more usefully, to spot when it is missing. It was a desktop application built with PyQt. This is the same model, compiled to ONNX and executed client-side, so the detection happens on your machine rather than on a server.
What it looks for
Five items of equipment, each detected in two states. The pair matters: a model that only recognises a helmet tells you nothing useful, because the safety question is whether someone is missing one.
| Equipment | Present | Absent |
|---|---|---|
| Helmet | helmet | no_helmet |
| Mask | mask | no_mask |
| Jacket | jacket | no_jacket |
| Shoe | shoe | no_shoe |
| Harness | harness | no_harness |
How the detection runs
- Letterbox — the frame is scaled to fit 640×640 with its aspect ratio intact and padded with grey, matching what the model saw in training.
- Inference — ONNX Runtime Web runs the graph, preferring WebGPU and falling back to multi-threaded WebAssembly. Output is a
[1, 14, 8400]tensor: 8400 candidate boxes, each with four coordinates and ten class scores. - Decode — candidates below the confidence threshold are dropped, per-class non-maximum suppression removes duplicate boxes, and the survivors are mapped back out of letterbox space onto the original image.
- Draw — boxes are painted on a canvas overlay, green for equipment present and red for equipment missing.
No backend
The server hosting this page only ever sends files. Your camera frames and any image you choose are processed by your own browser and never leave your machine — there is no endpoint for them to be uploaded to. The model is fetched once and cached.
Stack: Next.js static export · ONNX Runtime Web · Caddy on a single EC2 instance.
About the model
Trained during a 2023 internship at HIXAA (Pune) as a real-time PPE detection system. YOLOv8n, 640×640 input, trained for 750 epochs on a custom dataset of 303 annotated industrial-safety images. The original deliverable was a desktop app: a PyQt window with five checkboxes feeding an OpenCV webcam loop. The checkboxes on the live and upload pages here are the same control, ported.
Limitations worth knowing
- 303 training images is a small dataset. The model does well on imagery that resembles it — construction and industrial photography, workers facing the camera, reasonable lighting — and noticeably worse outside that.
no_*classes are inferred from appearance, not from reasoning about people. A helmet held in someone's hand can read as compliance.- It is a demonstration of a detection pipeline, not a safety system. Nothing here should be used to make an actual site-safety decision.