Sync worker-safety-detection from metro-analytics-catalog
Browse files- .gitattributes +1 -0
- README.md +15 -13
- expected_output_dlstreamer.gif +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
expected_output_dlstreamer.gif filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
# Worker Safety Detection
|
| 2 |
|
| 3 |
-
> **Validated with:** OpenVINO 2026.1.0, DLStreamer 2026.0, Python 3.11+
|
| 4 |
-
|
| 5 |
| Property | Value |
|
| 6 |
|---|---|
|
| 7 |
| **Category** | Object Detection (PPE / Safety Compliance) |
|
|
@@ -80,7 +78,7 @@ Output files:
|
|
| 80 |
|
| 81 |
The pipeline below runs the worker safety FP32 detector on the sample video via
|
| 82 |
`gvadetect`, overlays bounding boxes with `gvawatermark`, and saves the
|
| 83 |
-
annotated result to `
|
| 84 |
|
| 85 |
> **Notes on running this sample:**
|
| 86 |
>
|
|
@@ -108,16 +106,16 @@ Gst.init(None)
|
|
| 108 |
MODEL_XML = "models/worker-safety-gear-detection/deployment/Detection/model/model.xml"
|
| 109 |
INPUT_VIDEO = "test_video.avi"
|
| 110 |
|
| 111 |
-
# For
|
| 112 |
-
#
|
| 113 |
-
# pre-process-backend=vaapi-surface-sharing on gvadetect.
|
| 114 |
-
# For NPU: change device=CPU to device=NPU (batch-size=1, nireq=4 recommended).
|
| 115 |
pipeline_str = (
|
| 116 |
f"filesrc location={INPUT_VIDEO} ! decodebin3 ! "
|
| 117 |
-
f"
|
|
|
|
|
|
|
| 118 |
f"gvawatermark ! videoconvert ! video/x-raw,format=I420 ! "
|
| 119 |
f"openh264enc ! h264parse ! "
|
| 120 |
-
f"mp4mux ! filesink name=sink location=
|
| 121 |
)
|
| 122 |
pipeline = Gst.parse_launch(pipeline_str)
|
| 123 |
|
|
@@ -158,7 +156,7 @@ Expected console output (representative):
|
|
| 158 |
[PPE] safety_jacket conf=0.82
|
| 159 |
```
|
| 160 |
|
| 161 |
-
The annotated video is saved to `
|
| 162 |
`gvawatermark` around each detected `safety_helmet` and `safety_jacket`.
|
| 163 |
|
| 164 |
> **Known warning:** The `openh264enc` element prints
|
|
@@ -167,11 +165,15 @@ The annotated video is saved to `output.mp4` with bounding boxes drawn by
|
|
| 167 |
> video is encoded correctly. The warning comes from the OpenH264 library's
|
| 168 |
> internal logging and does not indicate a real error.
|
| 169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
**Device targets:**
|
| 171 |
|
| 172 |
-
- `device=
|
| 173 |
-
- `device=
|
| 174 |
-
- `device=NPU` -- use `batch-size=1` and `nireq=4` for best NPU utilization.
|
| 175 |
|
| 176 |
---
|
| 177 |
|
|
|
|
| 1 |
# Worker Safety Detection
|
| 2 |
|
|
|
|
|
|
|
| 3 |
| Property | Value |
|
| 4 |
|---|---|
|
| 5 |
| **Category** | Object Detection (PPE / Safety Compliance) |
|
|
|
|
| 78 |
|
| 79 |
The pipeline below runs the worker safety FP32 detector on the sample video via
|
| 80 |
`gvadetect`, overlays bounding boxes with `gvawatermark`, and saves the
|
| 81 |
+
annotated result to `output_dlstreamer.mp4`.
|
| 82 |
|
| 83 |
> **Notes on running this sample:**
|
| 84 |
>
|
|
|
|
| 106 |
MODEL_XML = "models/worker-safety-gear-detection/deployment/Detection/model/model.xml"
|
| 107 |
INPUT_VIDEO = "test_video.avi"
|
| 108 |
|
| 109 |
+
# For CPU: change device=GPU to device=CPU.
|
| 110 |
+
# For NPU: change device=GPU to device=NPU (batch-size=1, nireq=4 recommended).
|
|
|
|
|
|
|
| 111 |
pipeline_str = (
|
| 112 |
f"filesrc location={INPUT_VIDEO} ! decodebin3 ! "
|
| 113 |
+
f"videoconvert ! "
|
| 114 |
+
f"gvadetect model={MODEL_XML} device=GPU "
|
| 115 |
+
f"threshold=0.4 ! queue ! "
|
| 116 |
f"gvawatermark ! videoconvert ! video/x-raw,format=I420 ! "
|
| 117 |
f"openh264enc ! h264parse ! "
|
| 118 |
+
f"mp4mux ! filesink name=sink location=output_dlstreamer.mp4"
|
| 119 |
)
|
| 120 |
pipeline = Gst.parse_launch(pipeline_str)
|
| 121 |
|
|
|
|
| 156 |
[PPE] safety_jacket conf=0.82
|
| 157 |
```
|
| 158 |
|
| 159 |
+
The annotated video is saved to `output_dlstreamer.mp4` with bounding boxes drawn by
|
| 160 |
`gvawatermark` around each detected `safety_helmet` and `safety_jacket`.
|
| 161 |
|
| 162 |
> **Known warning:** The `openh264enc` element prints
|
|
|
|
| 165 |
> video is encoded correctly. The warning comes from the OpenH264 library's
|
| 166 |
> internal logging and does not indicate a real error.
|
| 167 |
|
| 168 |
+
#### Expected Output
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
|
| 172 |
**Device targets:**
|
| 173 |
|
| 174 |
+
- `device=GPU` -- default in the sample code.
|
| 175 |
+
- `device=CPU` -- change `device=GPU` to `device=CPU`.
|
| 176 |
+
- `device=NPU` -- change `device=GPU` to `device=NPU`; use `batch-size=1` and `nireq=4` for best NPU utilization.
|
| 177 |
|
| 178 |
---
|
| 179 |
|
expected_output_dlstreamer.gif
ADDED
|
Git LFS Details
|