vagheshpatel commited on
Commit
64d34be
·
verified ·
1 Parent(s): d4c4b55

Sync worker-safety-detection from metro-analytics-catalog

Browse files
Files changed (3) hide show
  1. README.md +10 -4
  2. export_and_quantize.sh +10 -0
  3. model-proc.json +14 -0
README.md CHANGED
@@ -90,6 +90,7 @@ The script performs the following steps:
90
  Output files:
91
 
92
  - `./models/worker_safety_gear_detection/deployment/Detection/model/model.xml` -- FP32 OpenVINO IR used by the DLStreamer sample.
 
93
 
94
  > **Note:** The FP32 model is ready for production use on CPU and GPU.
95
  > 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.
@@ -102,9 +103,10 @@ annotated result to `output_dlstreamer.mp4`.
102
 
103
  > **Notes on running this sample:**
104
  >
105
- > - The Geti-exported model embeds post-processing and labels internally.
106
- > `gvadetect` auto-discovers the model type for Geti-exported IRs, so no
107
- > external `model-proc` JSON is required for this flow.
 
108
  > - Export `PYTHONPATH` so the DLStreamer Python module is importable:
109
  >
110
  > ```bash
@@ -127,6 +129,10 @@ MODEL_XML = (
127
  "models/worker_safety_gear_detection/"
128
  "deployment/Detection/model/model.xml"
129
  )
 
 
 
 
130
  INPUT_VIDEO = "test_video.avi"
131
 
132
  # For CPU: change device=GPU to device=CPU.
@@ -134,7 +140,7 @@ INPUT_VIDEO = "test_video.avi"
134
  pipeline_str = (
135
  f"filesrc location={INPUT_VIDEO} ! decodebin3 ! "
136
  f"videoconvert ! "
137
- f"gvadetect model={MODEL_XML} device=GPU "
138
  f"threshold=0.4 ! queue ! "
139
  f"gvawatermark ! videoconvert ! video/x-raw,format=I420 ! "
140
  f"openh264enc ! h264parse ! "
 
90
  Output files:
91
 
92
  - `./models/worker_safety_gear_detection/deployment/Detection/model/model.xml` -- FP32 OpenVINO IR used by the DLStreamer sample.
93
+ - `./models/worker_safety_gear_detection/deployment/Detection/model/model-proc.json` -- DLStreamer post-processing configuration (copied from this repository's `model-proc.json`).
94
 
95
  > **Note:** The FP32 model is ready for production use on CPU and GPU.
96
  > 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.
 
103
 
104
  > **Notes on running this sample:**
105
  >
106
+ > - A `model-proc.json` is stored in this repository and copied into the model directory
107
+ > by `export_and_quantize.sh`. It must be passed explicitly to `gvadetect` via the
108
+ > `model-proc=` property. DLStreamer does **not** auto-discover post-processing from
109
+ > the model directory; omitting it causes `post-processing is NULL` and pipeline failure.
110
  > - Export `PYTHONPATH` so the DLStreamer Python module is importable:
111
  >
112
  > ```bash
 
129
  "models/worker_safety_gear_detection/"
130
  "deployment/Detection/model/model.xml"
131
  )
132
+ MODEL_PROC = (
133
+ "models/worker_safety_gear_detection/"
134
+ "deployment/Detection/model/model-proc.json"
135
+ )
136
  INPUT_VIDEO = "test_video.avi"
137
 
138
  # For CPU: change device=GPU to device=CPU.
 
140
  pipeline_str = (
141
  f"filesrc location={INPUT_VIDEO} ! decodebin3 ! "
142
  f"videoconvert ! "
143
+ f"gvadetect model={MODEL_XML} model-proc={MODEL_PROC} device=GPU "
144
  f"threshold=0.4 ! queue ! "
145
  f"gvawatermark ! videoconvert ! video/x-raw,format=I420 ! "
146
  f"openh264enc ! h264parse ! "
export_and_quantize.sh CHANGED
@@ -14,6 +14,8 @@ MODEL_DIR="${OUTPUT_DIR}/worker_safety_gear_detection"
14
  ZIP_URL="https://github.com/open-edge-platform/edge-ai-resources/raw/main/models/FP32/worker-safety-gear-detection.zip"
15
  ZIP_FILE="${OUTPUT_DIR}/worker-safety-gear-detection.zip"
16
  EXPECTED_XML="${MODEL_DIR}/deployment/Detection/model/model.xml"
 
 
17
 
18
  echo "--- Installing dependencies ---"
19
  pip install -qU openvino
@@ -69,4 +71,12 @@ if [[ ! -f "${EXPECTED_XML}" ]]; then
69
  fi
70
  MODEL_XML="${EXPECTED_XML}"
71
  echo "Model IR found: ${MODEL_XML}"
 
 
 
 
 
 
 
 
72
  echo "--- Done ---"
 
14
  ZIP_URL="https://github.com/open-edge-platform/edge-ai-resources/raw/main/models/FP32/worker-safety-gear-detection.zip"
15
  ZIP_FILE="${OUTPUT_DIR}/worker-safety-gear-detection.zip"
16
  EXPECTED_XML="${MODEL_DIR}/deployment/Detection/model/model.xml"
17
+ MODEL_PROC_SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/model-proc.json"
18
+ MODEL_PROC_DST="${MODEL_DIR}/deployment/Detection/model/model-proc.json"
19
 
20
  echo "--- Installing dependencies ---"
21
  pip install -qU openvino
 
71
  fi
72
  MODEL_XML="${EXPECTED_XML}"
73
  echo "Model IR found: ${MODEL_XML}"
74
+
75
+ echo "--- Copying model-proc.json ---"
76
+ if [[ ! -f "${MODEL_PROC_SRC}" ]]; then
77
+ echo "ERROR: model-proc.json not found at ${MODEL_PROC_SRC}" >&2
78
+ exit 1
79
+ fi
80
+ cp "${MODEL_PROC_SRC}" "${MODEL_PROC_DST}"
81
+ echo "Copied: ${MODEL_PROC_DST}"
82
  echo "--- Done ---"
model-proc.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "json_schema_version": "2.2.0",
3
+ "input_preproc": [],
4
+ "output_postproc": [
5
+ {
6
+ "converter": "label",
7
+ "labels": [
8
+ "Porosity",
9
+ "Good_Weld",
10
+ "No_Weld"
11
+ ]
12
+ }
13
+ ]
14
+ }