File size: 7,641 Bytes
80fb551 ca15802 8588238 ca15802 aacc916 ca15802 aacc916 ca15802 aacc916 ca15802 8588238 aacc916 ca15802 2667e45 aacc916 2667e45 8588238 aacc916 ca15802 aacc916 ca15802 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | ---
license: other
license_name: intel-custom
license_link: LICENSE
library_name: openvino
pipeline_tag: object-detection
tags:
- openvino
- intel
- geti
- worker-safety
- ppe-detection
- safety-helmet
- safety-jacket
- edge-ai
- metro
- dlstreamer
language:
- en
---
# Worker Safety Detection
| Property | Value |
|---|---|
| **Category** | Object Detection (PPE / Safety Compliance) |
| **Base Model** | [Worker Safety Gear Detection](https://github.com/open-edge-platform/edge-ai-resources/blob/main/models/FP32/worker-safety-gear-detection.zip) (Intel Edge AI Resources, Geti-trained) |
| **Source Framework** | Intel Geti (OpenVINO IR) |
| **Supported Precisions** | FP32 |
| **Inference Engine** | OpenVINO |
| **Hardware** | CPU, GPU, NPU |
| **Detected Class(es)** | `safety_jacket` (class 0), `safety_helmet` (class 1) |
---
## Overview
Worker Safety Compliance Detection is a Metro Analytics use case that detects safety gear on workers to verify compliance with personal protective equipment (PPE) requirements.
It uses a pre-trained FP32 detection model from [Intel Edge AI Resources](https://github.com/open-edge-platform/edge-ai-resources), trained with [Intel Geti](https://geti.intel.com/) on worker safety imagery.
The model detects two classes: `safety_jacket` (high-visibility vest) and `safety_helmet` (hard hat).
Frames where expected PPE is not detected indicate non-compliance.
The FP32 model ships as an OpenVINO IR, ready for deployment on Intel CPUs and GPUs without additional conversion steps.
Typical deployments include:
- **Construction Site Safety** -- verify that all workers wear hard hats and high-visibility vests before entering active zones.
- **Warehouse Compliance** -- enforce PPE policies at loading docks and forklift areas.
- **Industrial Zone Monitoring** -- continuous compliance scanning at facility entry points.
- **Automated Incident Reporting** -- generate alerts when expected `safety_helmet` or `safety_jacket` detections are absent for detected persons.
---
## Prerequisites
- Python 3.11+
- [Install OpenVINO](https://docs.openvino.ai/2026/get-started/install-openvino.html) (latest version)
- [Install Intel DLStreamer](https://docs.openedgeplatform.intel.com/2026.0/edge-ai-libraries/dlstreamer/get_started/install/install_guide_ubuntu.html) (latest version)
Create and activate a Python virtual environment before running the scripts:
```bash
python3 -m venv .venv --system-site-packages
source .venv/bin/activate
```
> **Note:** The `--system-site-packages` flag is required so the virtual
> environment can access the system-installed OpenVINO and DLStreamer Python
> packages.
---
## Getting Started
### Download Model
Run the provided script to download and extract the pre-trained FP32 model from Intel Edge AI Resources:
```bash
chmod +x export_and_quantize.sh
./export_and_quantize.sh
```
The script performs the following steps:
1. Installs dependencies (`openvino`).
2. Downloads a sample test video (`test_video.avi`) from Intel Edge AI Resources.
3. Downloads `worker-safety-gear-detection.zip` from the Intel Edge AI Resources repository.
4. Extracts the FP32 OpenVINO IR model.
Output files:
- `./models/worker-safety-gear-detection/` -- extracted model directory containing the FP32 OpenVINO IR (`model.xml`, `model.bin`).
> **Note:** The FP32 model is ready for production use on CPU and GPU.
> An INT8 variant is also available from the [INT8 models directory](https://github.com/open-edge-platform/edge-ai-resources/tree/main/models/INT8) for higher throughput.
### DLStreamer Sample
The pipeline below runs the worker safety FP32 detector on the sample video via
`gvadetect`, overlays bounding boxes with `gvawatermark`, and saves the
annotated result to `output_dlstreamer.mp4`.
> **Notes on running this sample:**
>
> - The Geti-exported model embeds post-processing and labels internally.
> `gvadetect` auto-discovers the model type for Geti-exported IRs.
> - Export `PYTHONPATH` so the DLStreamer Python module is importable:
>
> ```bash
> source /opt/intel/openvino_2026/setupvars.sh
> source /opt/intel/dlstreamer/scripts/setup_dls_env.sh
> export PYTHONPATH=/opt/intel/dlstreamer/python:\
> /opt/intel/dlstreamer/gstreamer/lib/python3/dist-packages:${PYTHONPATH:-}
> ```
```python
import gi
gi.require_version("Gst", "1.0")
gi.require_version("GstVideo", "1.0")
from gi.repository import Gst
from gstgva import VideoFrame
Gst.init(None)
MODEL_XML = "models/worker-safety-gear-detection/deployment/Detection/model/model.xml"
INPUT_VIDEO = "test_video.avi"
# For CPU: change device=GPU to device=CPU.
# For NPU: change device=GPU to device=NPU (batch-size=1, nireq=4 recommended).
pipeline_str = (
f"filesrc location={INPUT_VIDEO} ! decodebin3 ! "
f"videoconvert ! "
f"gvadetect model={MODEL_XML} device=GPU "
f"threshold=0.4 ! queue ! "
f"gvawatermark ! videoconvert ! video/x-raw,format=I420 ! "
f"openh264enc ! h264parse ! "
f"mp4mux ! filesink name=sink location=output_dlstreamer.mp4"
)
pipeline = Gst.parse_launch(pipeline_str)
def on_buffer(pad, info):
buf = info.get_buffer()
caps = pad.get_current_caps()
frame = VideoFrame(buf, caps=caps)
for region in frame.regions():
label = region.label()
print(f" [PPE] {label} conf={region.confidence():.2f}", flush=True)
return Gst.PadProbeReturn.OK
sink = pipeline.get_by_name("sink")
sink_pad = sink.get_static_pad("sink")
sink_pad.add_probe(Gst.PadProbeType.BUFFER, on_buffer)
pipeline.set_state(Gst.State.PLAYING)
bus = pipeline.get_bus()
bus.timed_pop_filtered(
Gst.CLOCK_TIME_NONE,
Gst.MessageType.EOS | Gst.MessageType.ERROR,
)
pipeline.set_state(Gst.State.NULL)
```
### Try It on a Sample Video
The `export_and_quantize.sh` script downloads `test_video.avi` automatically.
Run the DLStreamer sample above.
The buffer probe prints one line per detected safety item per frame.
Expected console output (representative):
```text
[PPE] safety_helmet conf=0.87
[PPE] safety_jacket conf=0.82
```
The annotated video is saved to `output_dlstreamer.mp4` with bounding boxes drawn by
`gvawatermark` around each detected `safety_helmet` and `safety_jacket`.
> **Known warning:** The `openh264enc` element prints
> `[OpenH264] this = 0x..., Error:CWelsH264SVCEncoder::EncodeFrame(), cmInitParaError.`
> on the first frame. This is a benign initialization message — the output
> video is encoded correctly. The warning comes from the OpenH264 library's
> internal logging and does not indicate a real error.
#### Expected Output

**Device targets:**
- `device=GPU` -- default in the sample code.
- `device=CPU` -- change `device=GPU` to `device=CPU`.
- `device=NPU` -- change `device=GPU` to `device=NPU`; use `batch-size=1` and `nireq=4` for best NPU utilization.
---
## License
Copyright (C) Intel Corporation. All rights reserved.
Licensed under the MIT License. See [LICENSE](LICENSE) for details.
## References
- [Intel Edge AI Resources -- Worker Safety Gear Detection Model](https://github.com/open-edge-platform/edge-ai-resources/blob/main/models/FP32/worker-safety-gear-detection.zip)
- [Worker Safety Gear Detection Application (Edge AI Suites)](https://github.com/open-edge-platform/edge-ai-suites/tree/main/manufacturing-ai-suite/industrial-edge-insights-vision)
- [Intel Geti Platform](https://geti.intel.com/)
- [OpenVINO Documentation](https://docs.openvino.ai/)
- [Intel DLStreamer](https://docs.openedgeplatform.intel.com/2026.0/edge-ai-libraries/dlstreamer/index.html)
|