Skip to content

Commit 622f4b8

Browse files
authored
[DL Streamer] Add help messages to scripts and modify hello_dlstreamer arguments (open-edge-platform#127)
1 parent 727f4bf commit 622f4b8

File tree

6 files changed

+156
-51
lines changed

6 files changed

+156
-51
lines changed

libraries/dl-streamer/docs/source/get_started/install/install_guide_ubuntu.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ The script installs all the essential packages needed for most users, including
5656
level-zero
5757
5858
More details about the packages can be found in the following driver links respectively:
59-
`Client GPU <https://dgpu-docs.intel.com/driver/client/overview.html#installing-gpu-packages>`__,
60-
`Data Center GPU <https://dgpu-docs.intel.com/driver/installation.html#installing-data-center-gpu-lts-releases>`__,
59+
`Intel® Client GPU <https://dgpu-docs.intel.com/driver/client/overview.html#installing-gpu-packages>`__,
60+
`Intel® Data Center GPU <https://dgpu-docs.intel.com/driver/installation.html#installing-data-center-gpu-lts-releases>`__,
6161
`Media <https://github.com/intel/media-driver/releases>`__,
6262
`NPU <https://github.com/intel/linux-npu-driver/releases/tag/v1.13.0>`__.
6363

@@ -108,7 +108,7 @@ Step 2: Setup repositories
108108
109109
.. note::
110110

111-
If you have OpenVINO installed in a version different from 2025.0.0, please uninstall the OpenVINO packages using the following commands.
111+
If you have OpenVINO installed in a version different from 2025.0.0, please uninstall the OpenVINO packages using the following commands.
112112

113113
.. code:: sh
114114

libraries/dl-streamer/docs/source/get_started/install/install_guide_ubuntu_wsl2.rst

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ Open a PowerShell prompt as an Administrator and run
1616

1717
.. code:: sh
1818
19-
wsl --install
20-
21-
or
19+
wsl --install
20+
21+
or
2222

2323
.. code:: sh
2424
25-
wsl --update
26-
27-
in case you have installed it before.
25+
wsl --update
26+
27+
in case you have installed it before.
2828

2929
Visit `install-ubuntu-wsl2 <https://documentation.ubuntu.com/wsl/en/latest/howto/install-ubuntu-wsl2>`__ in case of any Ubuntu-WSL2 installation issues.
3030

@@ -45,7 +45,7 @@ Step 1: Edit /etc/bash.bashrc and append lines with http_proxy and https_proxy
4545

4646
.. code:: sh
4747
48-
export http_proxy=""
48+
export http_proxy=""
4949
export https_proxy=""
5050
5151
Step 2: Run command
@@ -82,47 +82,47 @@ Step 1: Check if /dev/dri directory is present, output should look similar to th
8282

8383
.. code:: sh
8484
85-
ls -ltrah /dev/dri
85+
ls -ltrah /dev/dri
8686
87-
total 0
88-
drwxr-xr-x 3 root root 100 Mar 24 16:00 .
89-
crw-rw---- 1 root render 226, 128 Mar 24 16:00 renderD128
90-
crw-rw---- 1 root video 226, 0 Mar 24 16:00 card0
91-
drwxr-xr-x 2 root root 80 Mar 24 16:00 by-path
92-
drwxr-xr-x 16 root root 3.5K Mar 24 16:00 ..
87+
total 0
88+
drwxr-xr-x 3 root root 100 Mar 24 16:00 .
89+
crw-rw---- 1 root render 226, 128 Mar 24 16:00 renderD128
90+
crw-rw---- 1 root video 226, 0 Mar 24 16:00 card0
91+
drwxr-xr-x 2 root root 80 Mar 24 16:00 by-path
92+
drwxr-xr-x 16 root root 3.5K Mar 24 16:00 ..
9393
9494
95-
Step 2: If you don't have renderD12* device, please update GPU drivers and update WSL
95+
Step 2: If you don't have renderD12* device, please update GPU drivers and update WSL
9696
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9797

9898
Step 3: Install GPU libraries
9999
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100100

101101
.. code:: sh
102-
102+
103103
/wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg
104104
echo 'deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu noble arc' | sudo tee /etc/apt/sources.list.d/intel.gpu.noble.list
105-
sudo apt update
105+
sudo apt update
106106
sudo apt-get install -y libze-dev intel-opencl-icd intel-media-va-driver-non-free libmfx1 libvpl2 libegl-mesa0 libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri libglapi-mesa libgles2-mesa-dev libglx-mesa0 libigdgmm12 libxatracker2 mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all
107107
108108
Step 4: Add OpenVINO™ Toolkit and Intel® DL Streamer repositories
109109
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110110

111111
.. code:: sh
112112
113-
sudo -E wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
114-
sudo wget -O- https://eci.intel.com/sed-repos/gpg-keys/GPG-PUB-KEY-INTEL-SED.gpg | sudo tee /usr/share/keyrings/sed-archive-keyring.gpg > /dev/null
115-
sudo echo "deb [signed-by=/usr/share/keyrings/sed-archive-keyring.gpg] https://eci.intel.com/sed-repos/$(source /etc/os-release && echo $VERSION_CODENAME) sed main" | sudo tee /etc/apt/sources.list.d/sed.list
116-
sudo bash -c 'echo -e "Package: *\nPin: origin eci.intel.com\nPin-Priority: 1000" > /etc/apt/preferences.d/sed'
113+
sudo -E wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
114+
sudo wget -O- https://eci.intel.com/sed-repos/gpg-keys/GPG-PUB-KEY-INTEL-SED.gpg | sudo tee /usr/share/keyrings/sed-archive-keyring.gpg > /dev/null
115+
sudo echo "deb [signed-by=/usr/share/keyrings/sed-archive-keyring.gpg] https://eci.intel.com/sed-repos/$(source /etc/os-release && echo $VERSION_CODENAME) sed main" | sudo tee /etc/apt/sources.list.d/sed.list
116+
sudo bash -c 'echo -e "Package: *\nPin: origin eci.intel.com\nPin-Priority: 1000" > /etc/apt/preferences.d/sed'
117117
sudo bash -c 'echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/openvino/2025 ubuntu24 main" | sudo tee /etc/apt/sources.list.d/intel-openvino-2025.list'
118118
119119
Step 5: Install Intel® DL Streamer Pipeline Framework
120120
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121121

122122
.. code:: sh
123123
124-
sudo apt update
125-
sudo apt-get install intel-dlstreamer
124+
sudo apt update
125+
sudo apt-get install intel-dlstreamer
126126
127127
128128
Step 6: Test by running hello_dlstreamer script
@@ -140,8 +140,7 @@ Step 6: Test by running hello_dlstreamer script
140140

141141
.. code-block:: sh
142142
143-
sudo sed -i 's/CPU/GPU\:0/g' /opt/intel/dlstreamer/scripts/hello_dlstreamer.sh
144-
/opt/intel/dlstreamer/scripts/hello_dlstreamer.sh
143+
/opt/intel/dlstreamer/scripts/hello_dlstreamer.sh --device=GPU
145144
146145
-----
147146

libraries/dl-streamer/docs/source/get_started/install/uninstall_guide_ubuntu.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ If you installed via apt package just simple uninstall with apt
1111
1212
sudo apt remove intel-dlstreamer
1313
14-
If you want to remove OpenVINO as well, please use the following commands:
14+
If you want to remove OpenVINO as well, please use the following commands:
1515

1616
.. code:: sh
1717

libraries/dl-streamer/scripts/DLS_install_prerequisites.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,35 @@ npu_driver_version='1.13.0'
99
reinstall_npu_driver='no' # Default value for reinstalling the NPU driver
1010
on_host_or_docker='host'
1111

12+
# Show help message
13+
show_help() {
14+
cat <<EOF
15+
16+
Usage: $(basename "$0") [OPTIONS]
17+
18+
Script for installing and configuring prerequisites for DL Streamer
19+
20+
Options:
21+
-h, --help Show this help message and exit
22+
--reinstall-npu-driver=[yes|no] (Re)install Intel® NPU driver (default: no)
23+
--on-host-or-docker=[host|docker_ubuntu22|docker_ubuntu24] Script execution on host or in Docker container (default: host)
24+
25+
Examples:
26+
$(basename "$0")
27+
$(basename "$0") --reinstall-npu-driver=yes
28+
$(basename "$0") --reinstall-npu-driver=yes --on-host-or-docker=docker_ubuntu24
29+
$(basename "$0") --help
30+
31+
EOF
32+
}
33+
1234
# Parse command-line arguments
1335
for i in "$@"; do
1436
case $i in
37+
-h|--help)
38+
show_help
39+
exit 0
40+
;;
1541
--reinstall-npu-driver=*)
1642
reinstall_npu_driver="${i#*=}"
1743
shift
@@ -22,6 +48,7 @@ for i in "$@"; do
2248
;;
2349
*)
2450
echo "Unknown option: $i"
51+
show_help
2552
exit 1
2653
;;
2754
esac
@@ -885,4 +912,5 @@ else
885912
if [ "$need_to_logout" -eq 1 ]; then
886913
echo_color "User added to render and video groups. Please log out and log back in for the changes to take effect." "cyan"
887914
fi
888-
fi
915+
fi
916+

libraries/dl-streamer/scripts/build_deb_packages.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,45 @@ IMAGE_NAME="dls_debs_temp_image"
1414
CONTAINER_NAME="dls_debs_temp_container"
1515
DEBS_DESTINATION_PATH="./deb_packages"
1616

17+
# Show help message
18+
show_help() {
19+
cat <<EOF
20+
21+
Usage: $(basename "$0") [OPTIONS]
22+
23+
Script for building DL Streamer Debian packages
24+
25+
Options:
26+
-h, --help Show this help message and exit
27+
--ubuntu_version=[ubuntu22|ubuntu24] Choosing Ubuntu version to build .deb packages (default: ubuntu24)
28+
29+
Examples:
30+
$(basename "$0")
31+
$(basename "$0") --ubuntu_version=ubuntu22
32+
$(basename "$0") --help
33+
34+
EOF
35+
}
36+
1737
# Set inputs
1838
ubuntu_version="ubuntu24"
1939
for i in "$@"; do
2040
case $i in
41+
-h|--help)
42+
show_help
43+
exit 0
44+
;;
2145
--ubuntu_version=*)
2246
ubuntu_version="${i#*=}"
47+
if [[ "$MODEL" != "ubuntu22" ]] && [[ "$MODEL" != "ubuntu24" ]]; then
48+
echo "Error! Wrong Ubuntu version parameter. Supported versions: ubuntu22 | ubuntu24"
49+
exit 1
50+
fi
2351
shift
2452
;;
2553
*)
2654
echo "Unknown option: $i"
55+
show_help
2756
exit 1
2857
;;
2958
esac

libraries/dl-streamer/scripts/hello_dlstreamer.sh

Lines changed: 70 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,74 @@
55
# SPDX-License-Identifier: MIT
66
# ==============================================================================
77

8-
# variables required by Intel(R) DL Streamer
8+
# Show help message
9+
show_help() {
10+
cat <<EOF
11+
12+
Usage: $(basename "$0") [OPTIONS]
13+
14+
This script provides a simple way to construct and execute
15+
a sample DL Streamer detection pipeline with YOLO model.
16+
17+
Options:
18+
-h, --help Show this help message and exit
19+
-m=MODEL, --model=MODEL YOLO model name to be used for detection (default: yolo11s)
20+
Available models: yolov5s | yolov8s | yolo11s
21+
-o=OUTPUT, --output=OUTPUT Type of output from a pipeline (default: display)
22+
Available types: display | file
23+
-d=DEVICE, --device=DEVICE Device to perform detection operations on (default: CPU)
24+
Available devices: CPU | GPU | NPU
25+
Note: GPU and NPU devices require drivers (DLS_install_prerequisites.sh)
26+
27+
Examples:
28+
$(basename "$0")
29+
$(basename "$0") --model=yolov8s
30+
$(basename "$0") --model=yolov8s --output=file --device=NPU
31+
$(basename "$0") --help
32+
33+
EOF
34+
}
35+
36+
# Parse options
37+
MODEL="yolo11s"
38+
OUTPUT="display"
39+
DEVICE="CPU"
40+
for arg in "$@"; do
41+
case $arg in
42+
-h|--help)
43+
show_help
44+
exit 0
45+
;;
46+
-m=*|--model=*)
47+
MODEL="${arg#*=}"
48+
if [[ "$MODEL" != "yolov5s" ]] && [[ "$MODEL" != "yolov8s" ]] && [[ "$MODEL" != "yolo11s" ]]; then
49+
echo "Error! Wrong MODEL parameter. Supported models: yolov5s | yolov8s | yolo11s"
50+
exit 1
51+
fi
52+
;;
53+
-o=*|--output=*)
54+
OUTPUT="${arg#*=}"
55+
if [[ "$OUTPUT" != "display" ]] && [[ "$OUTPUT" != "file" ]]; then
56+
echo "Error! Wrong value for OUTPUT parameter. Supported values: display | file"
57+
exit 1
58+
fi
59+
;;
60+
-d=*|--device=*)
61+
DEVICE="${arg#*=}"
62+
if [[ "$DEVICE" != "CPU" ]] && [[ "$DEVICE" != "GPU" ]] && [[ "$DEVICE" != "NPU" ]]; then
63+
echo "Error! Wrong value for DEVICE parameter. Supported values: CPU | GPU | NPU"
64+
exit 1
65+
fi
66+
;;
67+
*)
68+
echo "Unknown option: '$arg'"
69+
show_help
70+
exit 1
71+
;;
72+
esac
73+
done
74+
75+
# variables required by DL Streamer
976
export LIBVA_DRIVER_NAME=iHD
1077
export GST_PLUGIN_PATH=/opt/intel/dlstreamer/build/intel64/Release/lib:/opt/intel/dlstreamer/gstreamer/lib/gstreamer-1.0:/opt/intel/dlstreamer/gstreamer/lib/:
1178
export LD_LIBRARY_PATH=/opt/intel/dlstreamer/gstreamer/lib:/opt/intel/dlstreamer/build/intel64/Release/lib:/opt/intel/dlstreamer/lib/gstreamer-1.0:/usr/lib:/opt/intel/dlstreamer/build/intel64/Release/lib:/opt/opencv:/opt/openh264:/opt/rdkafka:/opt/ffmpeg:/usr/local/lib/gstreamer-1.0:/usr/local/lib
@@ -36,12 +103,7 @@ else
36103
echo "---------------------------------------------------------------------------------------"
37104
fi
38105

39-
# check if the inference model is set correctly; yolov5s, yolov8s and yolo11s are supported on this level
40-
MODEL=${3:-"yolo11s"}
41-
if [[ "$MODEL" != "yolov5s" ]] && [[ "$MODEL" != "yolov8s" ]] && [[ "$MODEL" != "yolo11s" ]]; then
42-
echo "Error! Wrong MODEL parameter. Supported models: yolov5s | yolov8s | yolo11s".
43-
exit
44-
fi
106+
# check if the model exists
45107
if [ -d "$MODELS_PATH"/public/"$MODEL"/FP32 ]; then
46108
echo "$MODEL model exists."
47109
else
@@ -57,19 +119,6 @@ echo ""
57119

58120
export GST_PLUGIN_FEATURE_RANK=${GST_PLUGIN_FEATURE_RANK},ximagesink:MAX
59121

60-
# check if the output is set to file or display, only two options are supported
61-
OUTPUT=${1:-"display"}
62-
if [[ "$OUTPUT" != "display" ]] && [[ "$OUTPUT" != "file" ]]; then
63-
echo "Error! Wrong value for OUTPUT parameter. Supported values: display | file".
64-
exit
65-
fi
66-
# check if the device for inference is set correctly; only CPU, GPU and NPU options are supported
67-
DEVICE=${2:-"CPU"}
68-
if [[ "$DEVICE" != "CPU" ]] && [[ "$DEVICE" != "GPU" ]] && [[ "$DEVICE" != "NPU" ]]; then
69-
echo "Error! Wrong value for DEVICE parameter. Supported values: CPU | GPU | NPU".
70-
exit
71-
fi
72-
73122
# print pipeline and run it
74123
execute() { echo "$*"$'\n' ; "$@" ; }
75-
execute /opt/intel/dlstreamer/samples/gstreamer/gst_launch/detection_with_yolo/yolo_detect.sh $MODEL "$DEVICE" '' "$OUTPUT"
124+
execute /opt/intel/dlstreamer/samples/gstreamer/gst_launch/detection_with_yolo/yolo_detect.sh $MODEL "$DEVICE" '' "$OUTPUT"

0 commit comments

Comments
 (0)