Skip to content

Commit aa97743

Browse files
authored
Feature/rkatakol/ibvs model update (open-edge-platform#1748)
1 parent a6e5c12 commit aa97743

File tree

8 files changed

+110
-27
lines changed

8 files changed

+110
-27
lines changed

metro-ai-suite/image-based-video-search/chart/templates/dlstreamer-pipeline-server/configmap.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ data:
3737
"name": "filter-pipeline",
3838
"source": "gstreamer",
3939
"queue_maxsize": 50,
40-
"pipeline": "{auto_source} name=source ! decodebin3 ! gvadetect model=/models/person-vehicle-bike-detection-2004/FP32/person-vehicle-bike-detection-2004.xml model-proc=/home/pipeline-server/person-vehicle-bike-detection-2004.json inference-interval=3 threshold=0.4 model-instance-id=detect1 device=CPU ! queue ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml inference-region=1 name=classification model-instance-id=infer1 device=CPU ! queue ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
40+
"pipeline": "{auto_source} name=source ! decodebin3 ! gvadetect model=/models/public/yolo11s/FP16/yolo11s.xml batch_size=1 inference-interval=1 nireq=2 threshold=0.7 model-instance-id=instcpu0 name=detection device=CPU ! queue ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml inference-region=1 name=classification model-instance-id=infer1 device=CPU ! queue ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
4141
"auto_start": false,
4242
"mqtt_publisher": {
4343
"publish_frame": true,
@@ -61,7 +61,7 @@ data:
6161
"name": "filter-pipeline",
6262
"source": "gstreamer",
6363
"queue_maxsize": 50,
64-
"pipeline": "{auto_source} ! decodebin3 ! gvadetect model=/models/person-vehicle-bike-detection-2004/FP32/person-vehicle-bike-detection-2004.xml model-proc=/home/pipeline-server/person-vehicle-bike-detection-2004.json inference-interval=3 threshold=0.4 model-instance-id=detect1 device=GPU ! queue ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml inference-region=1 device=GPU model-instance-id=classify1 ! queue ! vapostproc ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
64+
"pipeline": "{auto_source} name=source ! decodebin3 ! gvadetect model=/models/public/yolo11s/FP16/yolo11s.xml batch_size=1 inference-interval=1 inference-region=0 nireq=2 threshold=0.7 model-instance-id=instgpu0 name=detection device=GPU ! queue ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml inference-region=1 device=GPU model-instance-id=classify1 ! queue ! vapostproc ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
6565
"auto_start": false,
6666
"mqtt_publisher": {
6767
"publish_frame": true,
@@ -77,6 +77,30 @@ data:
7777
]
7878
}
7979
}
80+
config.npu.json: |
81+
{
82+
"config": {
83+
"pipelines": [
84+
{
85+
"name": "filter-pipeline",
86+
"source": "gstreamer",
87+
"queue_maxsize": 50,
88+
"pipeline": "{auto_source} ! decodebin3 ! gvadetect model=/models/public/yolo11s/FP16/yolo11s.xml batch_size=1 inference-interval=1 nireq=2 threshold=0.7 model-instance-id=instnpu0 name=detection device=NPU ! queue ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml inference-region=1 device=NPU model-instance-id=infer1 ! queue ! vapostproc ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
89+
"auto_start": false,
90+
"mqtt_publisher": {
91+
"publish_frame": true,
92+
"topic": "edge_video_analytics_results"
93+
}
94+
},
95+
{
96+
"name": "search_image",
97+
"source": "image_ingestor",
98+
"queue_maxsize": 50,
99+
"pipeline": "appsrc name=source ! decodebin3 ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml model-instance-id=infer2 device=NPU ! gvametaconvert add-tensor-data=true ! appsink name=destination"
100+
}
101+
]
102+
}
103+
}
80104
person-vehicle-bike-detection-2004.json: |
81105
{
82106
"json_schema_version": "2.2.0",

metro-ai-suite/image-based-video-search/chart/templates/dlstreamer-pipeline-server/deployment.yaml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,50 @@ spec:
5353
omz_downloader --name resnet-50-pytorch --output_dir models &&
5454
omz_converter --name resnet-50-pytorch --download_dir models --output_dir models &&
5555
cp -r ./models/public/resnet-50-pytorch /output
56-
) &&
57-
test -d /output/person-vehicle-bike-detection-2004 || (
58-
rm -fr /output/person-vehicle-bike-detection-2004 &&
59-
omz_downloader --name person-vehicle-bike-detection-2004 --output_dir models &&
60-
omz_converter --name person-vehicle-bike-detection-2004 --download_dir models --output_dir models &&
61-
cp -r ./models/intel/person-vehicle-bike-detection-2004 /output
62-
)
56+
)
6357
volumeMounts:
6458
- name: '{{ include "image_based_video_search.fullname" . }}-dlstreamer-pipeline-server-models'
6559
mountPath: /output
60+
- name: model-downloader
61+
image: intel/dlstreamer:2025.1.2-ubuntu24
62+
securityContext:
63+
allowPrivilegeEscalation: false
64+
runAsNonRoot: true
65+
runAsUser: 1000
66+
env:
67+
- name: http_proxy
68+
value: {{ $.Values.httpProxy }}
69+
- name: https_proxy
70+
value: {{ $.Values.httpsProxy }}
71+
- name: no_proxy
72+
value: "{{ $.Values.noProxy }}"
73+
command:
74+
- /bin/sh
75+
- -c
76+
- |
77+
mkdir -p /output
78+
cd /tmp/repo/
79+
git clone --depth 1 --filter=blob:none --sparse \
80+
{{- if eq $.Values.dlstreamerpipelineserver.modelDownloader.gitSource.type "tag" }}
81+
--branch {{ $.Values.dlstreamerpipelineserver.modelDownloader.gitSource.ref }} \
82+
{{- else }}
83+
--branch {{ $.Values.dlstreamerpipelineserver.modelDownloader.gitSource.ref }} \
84+
{{- end }}
85+
https://github.com/open-edge-platform/edge-ai-suites.git
86+
87+
cd edge-ai-suites
88+
git sparse-checkout set \
89+
metro-ai-suite/metro-vision-ai-app-recipe/smart-parking/src/dlstreamer-pipeline-server/models
90+
cp -r metro-ai-suite/metro-vision-ai-app-recipe/smart-parking/src/dlstreamer-pipeline-server/models/* /output/
91+
cd /home/dlstreamer/dlstreamer/samples
92+
rm -rf /tmp/repo/edge-ai-suites
93+
export MODELS_PATH=/output
94+
./download_public_models.sh yolo11s coco128
95+
volumeMounts:
96+
- name: '{{ include "image_based_video_search.fullname" . }}-dlstreamer-pipeline-server-models'
97+
mountPath: /output
98+
- name: repo-volume
99+
mountPath: /tmp/repo
66100
containers:
67101
- envFrom:
68102
- configMapRef:
@@ -134,6 +168,8 @@ spec:
134168
- name: '{{ include "image_based_video_search.fullname" . }}-dlstreamer-pipeline-server-models'
135169
emptyDir:
136170
sizeLimit: 10Gi
171+
- name: repo-volume
172+
emptyDir: {}
137173
- name: dev-gpu
138174
hostPath:
139175
path: /dev/dri

metro-ai-suite/image-based-video-search/chart/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ dlstreamerpipelineserver:
120120
# key: dlstreamerpipelineserver.serviceAccount
121121
serviceAccount: ""
122122

123+
# Model downloader config
124+
modelDownloader:
125+
# Git source configuration for downloading models
126+
gitSource:
127+
# Use 'tag' for releases or 'branch' for branches
128+
type: branch # Options: 'tag' or 'branch'
129+
# Name of the tag or branch
130+
ref: main # e.g., 'v1.0.0' for tag or 'main' for branch
131+
123132
# mediamtx configuration
124133
mediamtx:
125134
# key: mediamtx.repository

metro-ai-suite/image-based-video-search/compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ services:
186186
- "/dev:/dev"
187187
- dlstreamer-pipeline-server-tmp:/tmp
188188
# - "../mr_models:/home/pipeline-server/mr_models:rw"
189-
- "./src/dlstreamer-pipeline-server/models/person-vehicle-bike-detection-2004:/models/person-vehicle-bike-detection-2004"
190-
- "./src/dlstreamer-pipeline-server/models/resnet-50-pytorch:/models/resnet50"
189+
- "./src/dlstreamer-pipeline-server/models/public:/models/public"
190+
- "./src/dlstreamer-pipeline-server/models/resnet-50-pytorch:/models/resnet-50-pytorch"
191191
group_add:
192192
# render group ID for ubuntu 20.04 host OS
193193
- "109"

metro-ai-suite/image-based-video-search/docs/user-guide/get-started.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,30 @@ By following this guide, you will learn how to:
6161
cp -r ./models/public/resnet-50-pytorch /output && \
6262
chown -R $(id -u):$(id -g) /output"
6363
64-
# Download and convert the Person-Vehicle-Bike Detection model
65-
docker run --rm \
66-
--user=root \
67-
-e http_proxy -e https_proxy -e no_proxy \
68-
-v "$MODELS_PATH:/output" \
69-
openvino/ubuntu22_dev:2024.6.0 bash -c \
70-
"omz_downloader --name person-vehicle-bike-detection-2004 --output_dir models && \
71-
omz_converter --name person-vehicle-bike-detection-2004 --download_dir models --output_dir models && \
72-
cp -r ./models/intel/person-vehicle-bike-detection-2004 /output && \
73-
chown -R $(id -u):$(id -g) /output"
64+
# Download and quantize the yolov11s model
65+
docker run --rm --user=root \
66+
-e http_proxy -e https_proxy -e no_proxy \
67+
-v "$MODELS_PATH:/output" \
68+
intel/dlstreamer:2025.1.2-ubuntu24 bash -c "$(cat <<EOF
69+
70+
mkdir -p src/dlstreamer-pipeline-server/models/public
71+
72+
export MODELS_PATH=/output
73+
chmod +x /home/dlstreamer/dlstreamer/samples/download_public_models.sh
74+
if [ ! -e "src/dlstreamer-pipeline-server/models/public/yolo11s/INT8/yolo11s.xml" ]; then
75+
for attempt in {1..3}; do
76+
echo "Attempt $attempt: Running model download and quantization..."
77+
if /home/dlstreamer/dlstreamer/samples/download_public_models.sh yolo11s coco128; then
78+
echo "Model download and quantization successful!"
79+
break
80+
else
81+
echo "Download attempt $attempt failed. Retrying..."
82+
sleep 2
83+
fi
84+
done
85+
fi
86+
EOF
87+
)"
7488
```
7589
7690
</details>

metro-ai-suite/image-based-video-search/src/dlstreamer-pipeline-server/configs/filter-pipeline/config.cpu.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "filter-pipeline",
66
"source": "gstreamer",
77
"queue_maxsize": 50,
8-
"pipeline": "{auto_source} name=source ! decodebin3 ! gvadetect model=/models/person-vehicle-bike-detection-2004/FP32/person-vehicle-bike-detection-2004.xml model-proc=/models/person-vehicle-bike-detection-2004/person-vehicle-bike-detection-2004.json inference-interval=3 threshold=0.4 model-instance-id=detect1 device=CPU ! queue ! gvainference model=/models/resnet50/FP32/resnet-50-pytorch.xml inference-region=1 name=classification model-instance-id=infer1 device=CPU ! queue ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
8+
"pipeline": "{auto_source} name=source ! decodebin3 ! gvadetect model=/models/public/yolo11s/FP16/yolo11s.xml batch_size=1 inference-interval=1 nireq=2 threshold=0.7 model-instance-id=instcpu0 name=detection device=CPU ! queue ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml inference-region=1 name=classification model-instance-id=infer1 device=CPU ! queue ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
99
"auto_start": false,
1010
"mqtt_publisher": {
1111
"publish_frame": true,
@@ -16,7 +16,7 @@
1616
"name": "search_image",
1717
"source": "image_ingestor",
1818
"queue_maxsize": 50,
19-
"pipeline": "appsrc name=source ! decodebin3 ! gvainference model=/models/resnet50/FP32/resnet-50-pytorch.xml model-instance-id=infer2 device=CPU ! gvametaconvert add-tensor-data=true ! appsink name=destination"
19+
"pipeline": "appsrc name=source ! decodebin3 ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml model-instance-id=infer2 device=CPU ! gvametaconvert add-tensor-data=true ! appsink name=destination"
2020
}
2121
]
2222
}

metro-ai-suite/image-based-video-search/src/dlstreamer-pipeline-server/configs/filter-pipeline/config.gpu.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "filter-pipeline",
66
"source": "gstreamer",
77
"queue_maxsize": 50,
8-
"pipeline": "{auto_source} ! decodebin3 ! gvadetect model=/models/person-vehicle-bike-detection-2004/FP32/person-vehicle-bike-detection-2004.xml model-proc=/models/person-vehicle-bike-detection-2004/person-vehicle-bike-detection-2004.json inference-interval=3 threshold=0.4 model-instance-id=detect1 device=GPU ! queue ! gvainference model=/models/resnet50/FP32/resnet-50-pytorch.xml inference-region=1 device=GPU model-instance-id=classify1 ! queue ! vapostproc ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
8+
"pipeline": "{auto_source} name=source ! decodebin3 ! gvadetect model=/models/public/yolo11s/FP16/yolo11s.xml batch_size=1 inference-interval=1 inference-region=0 nireq=2 threshold=0.7 model-instance-id=instgpu0 name=detection device=GPU ! queue ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml inference-region=1 device=GPU model-instance-id=classify1 ! queue ! vapostproc ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
99
"auto_start": false,
1010
"mqtt_publisher": {
1111
"publish_frame": true,
@@ -16,7 +16,7 @@
1616
"name": "search_image",
1717
"source": "image_ingestor",
1818
"queue_maxsize": 50,
19-
"pipeline": "appsrc name=source ! decodebin3 ! gvainference model=/models/resnet50/FP32/resnet-50-pytorch.xml model-instance-id=infer2 device=GPU ! gvametaconvert add-tensor-data=true ! appsink name=destination"
19+
"pipeline": "appsrc name=source ! decodebin3 ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml model-instance-id=infer2 device=GPU ! gvametaconvert add-tensor-data=true ! appsink name=destination"
2020
}
2121
]
2222
}

metro-ai-suite/image-based-video-search/src/dlstreamer-pipeline-server/configs/filter-pipeline/config.npu.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "filter-pipeline",
66
"source": "gstreamer",
77
"queue_maxsize": 50,
8-
"pipeline": "{auto_source} ! decodebin3 ! gvadetect model=/models/person-vehicle-bike-detection-2004/FP32/person-vehicle-bike-detection-2004.xml model-proc=/models/person-vehicle-bike-detection-2004/person-vehicle-bike-detection-2004.json inference-interval=3 threshold=0.4 model-instance-id=detect1 device=NPU ! queue ! gvainference model=/models/resnet50/FP32/resnet-50-pytorch.xml inference-region=1 device=NPU model-instance-id=classify1 ! queue ! vapostproc ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
8+
"pipeline": "{auto_source} ! decodebin3 ! gvadetect model=/models/public/yolo11s/FP16/yolo11s.xml batch_size=1 inference-interval=1 nireq=2 threshold=0.7 model-instance-id=instnpu0 name=detection device=NPU ! queue ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml inference-region=1 device=NPU model-instance-id=infer1 ! queue ! vapostproc ! videoconvertscale ! gvametaconvert add-tensor-data=true name=metaconvert ! jpegenc ! appsink name=destination",
99
"auto_start": false,
1010
"mqtt_publisher": {
1111
"publish_frame": true,
@@ -16,7 +16,7 @@
1616
"name": "search_image",
1717
"source": "image_ingestor",
1818
"queue_maxsize": 50,
19-
"pipeline": "appsrc name=source ! decodebin3 ! gvainference model=/models/resnet50/FP32/resnet-50-pytorch.xml model-instance-id=infer2 device=NPU ! gvametaconvert add-tensor-data=true ! appsink name=destination"
19+
"pipeline": "appsrc name=source ! decodebin3 ! gvainference model=/models/resnet-50-pytorch/FP32/resnet-50-pytorch.xml model-instance-id=infer2 device=NPU ! gvametaconvert add-tensor-data=true ! appsink name=destination"
2020
}
2121
]
2222
}

0 commit comments

Comments
 (0)