Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit beae849

Browse files
committed
SVET Linux sample appliction 2021.1.0 release
Dependency: MediaSDK 21.1.3 and OpenVINO 2021.3 Signed-off-by: Wang Elaine <[email protected]>
1 parent 057ee01 commit beae849

File tree

75 files changed

+4592
-829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+4592
-829
lines changed

LICENSE

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
1-
BSD 3-Clause License
2-
3-
Copyright (c) 2021, Intel Corporation
1+
/******************************************************************************\
2+
Copyright (c) 2005-2021, Intel Corporation
43
All rights reserved.
54

6-
Redistribution and use in source and binary forms, with or without
7-
modification, are permitted provided that the following conditions are met:
8-
9-
1. Redistributions of source code must retain the above copyright notice, this
10-
list of conditions and the following disclaimer.
11-
12-
2. Redistributions in binary form must reproduce the above copyright notice,
13-
this list of conditions and the following disclaimer in the documentation
14-
and/or other materials provided with the distribution.
15-
16-
3. Neither the name of the copyright holder nor the names of its
17-
contributors may be used to endorse or promote products derived from
18-
this software without specific prior written permission.
19-
20-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8+
9+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10+
11+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14+
15+
\**********************************************************************************/
16+
17+

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ See [user guide](./doc/concurrent_video_analytic_sample_application_user_guide_2
3838
# System requirements
3939

4040
**Operating System:**
41-
* Ubuntu 18.04.02
41+
* Ubuntu 18.04.05
4242

4343
**Software:**
44-
* [MediaSDK 20.3.0](https://github.com/Intel-Media-SDK/MediaSDK/releases/tag/intel-mediasdk-20.3.0)
45-
* [OpenVINO™ 2021.1](https://software.intel.com/en-us/openvino-toolkit)
44+
* [MediaSDK 21.1.3](https://github.com/Intel-Media-SDK/MediaSDK/releases/tag/intel-mediasdk-21.1.3)
45+
* [OpenVINO™ 2021.3](https://software.intel.com/en-us/openvino-toolkit)
4646

4747
**Hardware:**
48-
* Intel® platforms supported by the MediaSDK 20.3.0 and OpenVINO 2021.1.
48+
* Intel® platforms supported by the MediaSDK 21.1.3 and OpenVINO 2021.3.
4949
* For Media SDK, the major platform dependency comes from the back-end media driver. https://github.com/intel/media-driver
5050
* For OpenVINO™, see details from here: https://software.intel.com/en-us/openvino-toolkit/documentation/system-requirements
5151

5252
# How to build
5353

5454
Run build_and_install.sh to install dependent software packages and build sample application video_e2e_sample.
5555

56-
Please refer to ”Installation Guide“ in [user guide](./doc/concurrent_video_analytic_sample_application_user_guide_2020.3.0.pdf) for details.
56+
Please refer to ”Installation Guide“ in [user guide](./doc/concurrent_video_analytic_sample_application_user_guide.pdf) for details.
5757

5858
## Build steps
5959

@@ -68,7 +68,16 @@ cd cva_sample
6868
```
6969
This script will install the dependent software packages by running command "apt install". So it will ask for sudo password. Then it will download libva, libva-util, media-driver and MediaSDK source code and install these libraries. It might take 10 to 20 minutes depending on the network bandwidth.
7070

71-
After the script finishing, the sample application video_e2e_sample can be found under ./bin. Please refer to "Run sample application" in [user guide](./doc/concurrent_video_analytic_sample_application_user_guide_2020.3.0.pdf) for details.
71+
After the script finishing, the sample application video_e2e_sample can be found under ./bin.
72+
73+
In order to enable the media SDK installed by SVET to coexist with different versions of media SDK installed on the same computer, we suggest (we have done so in our build script) that the media SDK environment variables of SVET should only be set in the current bash, not saved to the global system environment.
74+
So please run 'source ./svet_env_setup.sh' first when you start a new shell (or change user in shell such as run 'su -') to run ./bin/video_e2e_sample".
75+
76+
```sh
77+
cd cva_sample
78+
source ./svet_env_setup.sh
79+
```
80+
Please refer to "Run sample application" in [user guide](./doc/concurrent_video_analytic_sample_application_user_guide.pdf) for details.
7281

7382
# Known limitations
7483

build_and_install.sh

Lines changed: 138 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@
33
root_path=$PWD
44
#download_method="git"
55
download_method="wget"
6+
built_with_ocv=true
7+
LIBVA_INSTALL_PREFIX="/opt/intel/svet/msdk"
8+
LIBVA_INSTALL_PATH="${LIBVA_INSTALL_PREFIX}/lib"
9+
LIBVA_DRIVERS_PATH="${LIBVA_INSTALL_PATH}/dri"
10+
LIBVA_DRIVER_NAME="iHD"
611

7-
if [[ ! -d "${INTEL_OPENVINO_DIR}" ]];
12+
while getopts b: flag
13+
do
14+
case "${flag}" in
15+
b)
16+
if [[ "no_ocv" == ${OPTARG} ]]
17+
then
18+
echo "Build SVET without OpenVINO"
19+
built_with_ocv=false
20+
fi
21+
;;
22+
esac
23+
done
24+
25+
if [ ! -d "${INTEL_OPENVINO_DIR}" ] && [ $built_with_ocv = true ];
826
then echo "Please make sure openvino has been installed and enviroment variables has been set by "
927
echo "source intel/openvino/bin/setupvars.sh"
1028
exit -1;
@@ -36,11 +54,11 @@ if [[ $download_method == "wget" ]]
3654
then
3755
echo "Checking the md5sum of downloaded packages"
3856
declare -A media_packages_md5sum
39-
media_packages_md5sum[intel-gmmlib-20.3.2.tar.gz]=583d9fbef52d880238629f2ced50a9be
40-
media_packages_md5sum[intel-media-20.3.0.tar.gz]=9c9219c09447567254aec00ade5dd3b8
41-
media_packages_md5sum[intel-mediasdk-20.3.0.tar.gz]=1fd2cb03d15b3c308e6a9bd1735d2845
42-
media_packages_md5sum[libva.tar.gz]=fdc00aedad4a51e058403f5f24d9abac
43-
media_packages_md5sum[libva-utils.tar.gz]=a22479f85f7693536c5756ad46192b32
57+
media_packages_md5sum[intel-gmmlib-21.1.1.tar.gz]=100ff57bff1cb19763f729fcd00269d1
58+
media_packages_md5sum[intel-media-21.1.3.tar.gz]=98f59d7fd2c6c08808acf0ba741216b0
59+
media_packages_md5sum[intel-mediasdk-21.1.3.tar.gz]=a4747e315448ded38171b245232a5a7c
60+
media_packages_md5sum[libva.tar.gz]=ba136b5a02ee4c7bf093d09bc1635560
61+
media_packages_md5sum[libva-utils.tar.gz]=010243cc8217fd455d0ad11f2025d43c
4462

4563
for c in ${!media_packages_md5sum[@]}; do
4664
md5_res=`md5sum $c`
@@ -80,40 +98,49 @@ then
8098
rm -f bin
8199
ln -s MediaSDK/build/__bin/release/ bin
82100

83-
84-
va_env_set=`grep "LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri" ~/.bashrc -c`
85-
86-
if (( va_env_set == 0 ))
87-
then
88-
set -x
89-
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/lib
90-
export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri
91-
export LIBVA_DRIVER_NAME=iHD
92-
export MFX_HOME=/opt/intel/mediasdk
93-
set +x
94-
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/lib' >> ~/.bashrc
95-
echo "export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri" >> ~/.bashrc
96-
echo "export LIBVA_DRIVER_NAME=iHD" >> ~/.bashrc
97-
echo "export MFX_HOME=/opt/intel/mediasdk" >> ~/.bashrc
98-
99-
fi
100101

101-
if [[ -d "/opt/intel/mediasdk/lib64" ]]
102-
then
103-
echo "A old MediaSDK version is found under folder /opt/intel/mediasdk/lib64"
104-
echo "Rename /opt/intel/mediasdk/lib64 as /opt/intel/mediasdk/oldlib64"
105-
mv /opt/intel/mediasdk/lib64 /opt/intel/mediasdk/oldlib64
106-
fi
107-
108-
if [[ $LD_LIBRARY_PATH != *"/opt/intel/mediasdk/lib/"* ]]
109-
then
110-
export LD_LIBRARY_PATH="/opt/intel/mediasdk/lib/:$LD_LIBRARY_PATH"
111-
echo 'export LD_LIBRARY_PATH="/opt/intel/mediasdk/lib/:$LD_LIBRARY_PATH"' >> ~/.bashrc
112-
fi
102+
#va_env_set=`grep "LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri" ~/.bashrc -c`
103+
set -x
104+
export LD_LIBRARY_PATH=$LIBVA_INSTALL_PATH:$LD_LIBRARY_PATH
105+
export LIBRARY_PATH=$LIBVA_INSTALL_PATH:$LIBRARY_PATH
106+
export LIBVA_DRIVERS_PATH=$LIBVA_DRIVERS_PATH
107+
export LIBVA_DRIVER_NAME=$LIBVA_DRIVER_NAME
108+
export MFX_HOME=$LIBVA_INSTALL_PREFIX
109+
set +x
110+
111+
#if (( va_env_set == 0 ))
112+
#then
113+
#set -x
114+
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/lib
115+
#export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri
116+
#export LIBVA_DRIVER_NAME=iHD
117+
#export MFX_HOME=/opt/intel/mediasdk
118+
#set +x
119+
#echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/lib' >> ~/.bashrc
120+
#echo "export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri" >> ~/.bashrc
121+
#echo "export LIBVA_DRIVER_NAME=iHD" >> ~/.bashrc
122+
#echo "export MFX_HOME=/opt/intel/mediasdk" >> ~/.bashrc
123+
124+
#fi
125+
126+
#if [[ -d "/opt/intel/mediasdk/lib64" ]]
127+
#then
128+
# echo "A old MediaSDK version is found under folder /opt/intel/mediasdk/lib64"
129+
# echo "Rename /opt/intel/mediasdk/lib64 as /opt/intel/mediasdk/oldlib64"
130+
# mv /opt/intel/mediasdk/lib64 /opt/intel/mediasdk/oldlib64
131+
#fi
132+
133+
#if [[ $LD_LIBRARY_PATH != *"/opt/intel/mediasdk/lib/"* ]]
134+
#then
135+
# export LD_LIBRARY_PATH="/opt/intel/mediasdk/lib/:$LD_LIBRARY_PATH"
136+
# echo 'export LD_LIBRARY_PATH="/opt/intel/mediasdk/lib/:$LD_LIBRARY_PATH"' >> ~/.bashrc
137+
#fi
113138

114139
if [[ -d $cl_cache_dir ]];
115140
then
116141
echo "cl_cache is enabled. \$cl_cache_dir : $cl_cache_dir"
142+
echo "Clean previous cl kernel cache"
143+
sudo rm -f $cl_cache_dir/*
117144
else
118145
echo "Add enabling cl_cache commands to ~\.bashrc"
119146
set -x
@@ -123,36 +150,93 @@ then
123150
echo "export cl_cache_dir=~/cl_cache" >> ~/.bashrc
124151
fi
125152

153+
#install library for metric_monitor
154+
sudo cp MediaSDK/build/__bin/release/libcttmetrics.so /usr/lib/
155+
126156
#Start to build SVET sample application
127157
#Copy MediaSDK sample headers and libraries that weren't installed by default
128-
sudo mkdir -p /opt/intel/mediasdk/include/sample_common
129-
sudo mkdir -p /opt/intel/mediasdk/include/vpp_plugin
130-
sudo mkdir -p /opt/intel/mediasdk/include/rotate_cpu
131-
sudo cp -rf MediaSDK/samples/sample_common/include/ /opt/intel/mediasdk/include/sample_common/
132-
sudo cp -rf MediaSDK/samples/sample_plugins/vpp_plugin/include/ /opt/intel/mediasdk/include/vpp_plugin/
133-
sudo cp -rf MediaSDK/samples/sample_plugins/rotate_cpu/include/ /opt/intel/mediasdk/include/rotate_cpu/
134-
sudo cp -f MediaSDK/build/__lib/release/libsample_common.a /opt/intel/mediasdk/lib/
135-
sudo cp -f MediaSDK/build/__lib/release/libvpp_plugin.a /opt/intel/mediasdk/lib/
158+
sudo -E mkdir -p $MFX_HOME/include/sample_common
159+
sudo -E mkdir -p $MFX_HOME/include/vpp_plugin
160+
sudo -E mkdir -p $MFX_HOME/include/rotate_cpu
161+
sudo -E cp -rf MediaSDK/samples/sample_common/include/ $MFX_HOME/include/sample_common/
162+
sudo -E cp -rf MediaSDK/samples/sample_plugins/vpp_plugin/include/ $MFX_HOME/include/vpp_plugin/
163+
sudo -E cp -rf MediaSDK/samples/sample_plugins/rotate_cpu/include/ $MFX_HOME/include/rotate_cpu/
164+
sudo -E cp -f MediaSDK/build/__lib/release/libsample_common.a $LIBVA_INSTALL_PATH/
165+
sudo -E cp -f MediaSDK/build/__lib/release/libvpp_plugin.a $LIBVA_INSTALL_PATH/
166+
167+
rm -rf video_e2e_sample/build
136168

137169
mkdir -p video_e2e_sample/build
170+
171+
if [ $built_with_ocv != true ]
172+
then
173+
echo "Use the CMakefile.txt that excludes inference source code"
174+
cp script/CMakeLists_woOpenVINO.txt video_e2e_sample/CMakeLists.txt
175+
fi
176+
138177
cd video_e2e_sample/build
139178
cmake ../ | tee /tmp/svet_build.log
140179
cat /tmp/svet_build.log >> svet_build.log
141180
make -j4 | tee /tmp/svet_build.log
142181
cat /tmp/svet_build.log >> svet_build.log
182+
fi
183+
184+
cd $root_path
185+
if [ $built_with_ocv = true ]
186+
then
187+
#Download openvino models
188+
echo "Check if openvino models IR files have been downloaded...."
189+
source ./script/download_and_copy_models.sh
190+
fi
191+
192+
cd $root_path
143193

144-
cd $root_path
145-
if [[ -f bin/video_e2e_sample ]];
194+
if [[ ! -d video ]]
195+
then
196+
mkdir -p video
197+
fi
198+
199+
if [[ ! -f video/1080p.h264 ]]
200+
then
201+
echo "Download test clip video/1080p.h264"
202+
cd video/
203+
wget -O main.zip https://github.com/elainewangprc/testvideo/archive/refs/heads/main.zip
204+
if [[ ! -f "main.zip" ]]
205+
then
206+
echo "Failed to download https://github.com/elainewangprc/testvideo/archive/refs/heads/main.zip"
207+
echo "Please download it manually"
208+
else
209+
unzip main.zip
210+
cp testvideo-main/*.h264 .
211+
fi
212+
cd ../
213+
fi
214+
215+
cd $root_path
216+
if [[ -f bin/video_e2e_sample ]]
217+
then
218+
echo "************************************************************************"
219+
echo "SVET sample application building has completed!"
220+
221+
gen12=`sudo cat /sys/kernel/debug/dri/0/i915_capabilities | grep "gen: 12"`
222+
if [[ ! -z $gen12 ]];
146223
then
147-
echo "SVET sample application building has completed!"
148-
echo "Please use ./bin/video_e2e_sample for testing"
149-
else
150-
echo "SVET sample application building failed!"
151-
echo "Please create an IPS with SVET in title on premiersupport.intel.com and upload ./svet_build.log ./svet_download.log to IPS."
224+
ver=`uname -a`
225+
if [[ $ver != *5.4.102* ]] ;
226+
then
227+
echo "For TigerLake CPU, please refer to user guide chapter 1.3 to upgrade the kernel with https://github.com/intel/linux-intel-lts/releases/tag/lts-v5.4.102-yocto-210310T010318Z";
228+
fi
152229
fi
153-
fi
154230

155-
#Download openvino models
156-
echo "Check if openvino models IR files have been downloaded...."
157-
source ./script/download_and_copy_models.sh
231+
echo "Please run the cmd below to setup running environment:"
232+
echo " "
233+
echo "source ./svet_env_setup.sh"
234+
echo " "
235+
echo "Then use ./bin/video_e2e_sample for testing"
236+
echo "IMPORTANT NOTICE: please run 'source ./svet_env_setup.sh' first when you start a new shell (or change user in shell such as run 'su -') to run ./bin/video_e2e_sample"
237+
echo "************************************************************************"
238+
else
239+
echo "SVET sample application building failed!"
240+
echo "Please create an IPS with SVET in title on premiersupport.intel.com and upload ./svet_build.log ./svet_download.log to IPS."
241+
fi
158242

doc/FAQ.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Frequently asked questions (SVET sample application)
22

33
## Where can I find the descritpion of options used in par file?
4-
See chapter 2.4 in doc/svet_sample_application_user_guide_2020.1.0.pdf
4+
See chapter 2.4 in doc/svet_sample_application_user_guide_2021.1.0.pdf
55
Running the SVET sample applicton with option "-?" can show the usage of options.
66

77
## Why does the system need to be switched to text console mode before running the sample application
@@ -44,7 +44,7 @@ It can be caused by the decoded frames aren't fed to inference engine efficientl
4444
Please refer to https://github.com/opencv/open_model_zoo/tree/master/models/intel. The names of models used in sample application are
4545
face-detection-retail-0004, human-pose-estimation-0001, vehicle-attributes-recognition-barrier-0039, vehicle-license-plate-detection-barrier-0106.
4646

47-
## Can I use other OpenVINO version rather than 2020.3 ?
47+
## Can I use other OpenVINO version rather than 2021.3 ?
4848
Yes, but you have to modify some code due to interfaces changing. And also you need to download the IR files and copy them to ./model manually. Please refer to script/download_and_copy_models.sh for how to download the IR files.
4949

5050
## When run 4 channel decode plus inference and display on APL, the CPU occupy ratio is very high and fps is low
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)