# TGL Sales Kit with OpenVINO 2021.4 LTS Release ###### tags: `Intel AI Sales Kit` - Table of Content [ToC] ### 1. Prepare docker image patch #### Get required files from openvino/ubuntu20_data_dev:2021.4_tgl ```bash= docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v ~/Downloads:/mnt --device /dev/dri:/dev/dri --group-add=$(stat -c "%g" /dev/dri/render*) -u root --rm openvino/ubuntu20_data_dev:2021.4_tgl mkdir -p /mnt/openvino_2021.4.582/python/python3.8/openvino/ cp -ar /opt/intel/openvino_2021.4.582/python/python3.8/openvino/tools /mnt/openvino_2021.4.582/python/python3.8/openvino/ mkdir -p /mnt/openvino_2021.4.582/deployment_tools/tools/benchmark_tool/ cp -ar /opt/intel/openvino_2021.4.582/deployment_tools/tools/benchmark_tool/* /mnt/openvino_2021.4.582/deployment_tools/tools/benchmark_tool/ mkdir -p /mnt/openvino_2021.4.582/data_processing/dl_streamer/samples/ cp -ar /opt/intel/openvino_2021.4.582/data_processing/dl_streamer/samples/model_proc/ /mnt/openvino_2021.4.582/data_processing/dl_streamer/samples/ exit ``` #### Prepare YOLO v3/v4/v5l FP32/FP16/FP16-INT8 model YOLO v3 : https://hackmd.io/lKCVqs5xQ3WSFvl33wLnjQ YOLO v4 : https://hackmd.io/mQHIp8vgTViF9Ao4mnI5rw YOLO v5l : https://hackmd.io/EwcxDpOETz-Ujz6q6pFWXQ At last steps of above three model conversion, in the container, copy /home/openvino/openvino_models foler to /mnt folder. They will be accessable in ~/Downloads folder in the host ```=bash cd ~/Downloads tar -czf openvino_2021.4.582_saleskit.tgz openvino_2021.4.582 tar -czf openvino_models.tgz openvino_models ``` ### 2. Build docker image ```bash= cd mkdir tgl_saleskit_2021.4_tgl cd tgl_saleskit_2021.4_tgl cp ~/Downloads/penvino_2021.4.582_saleskit.tgz . cp ~/Downloads/openvino_models.tgz . # Add smartcity_demo.sh here docker build --build-arg models_url=openvino_models.tgz --build-arg patch_url=openvino_2021.4.582_saleskit.tgz -t tgl_saleskit:2021.4_tgl . ``` #### smartcity_demo.sh (2021.4_tgl) ``` #!/bin/bash source /opt/intel/openvino/bin/setupvars.sh cd gst-launch-1.0 filesrc location=/mnt/NewVideo2.mp4 ! decodebin ! gvadetect model=/opt/intel/openvino_models/public/yolo-v3-tf/FP16-INT8/yolo-v3-tf.xml model-proc=/opt/intel/openvino_2021.4.582/data_processing/dl_streamer/samples/model_proc/public/object_detection/yolo-v3-tf.json device=GPU ! queue ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=xvimagesink sync=false ``` #### Dockerfile ```dockerfile= # Copyright (C) 2019-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 FROM openvino/ubuntu20_data_runtime:2021.4_tgl AS base USER openvino WORKDIR /opt/intel/openvino_2021.4.582 SHELL ["/bin/bash", "-xo", "pipefail", "-c"] ARG patch_url ADD ${patch_url} /opt/intel ARG models_url ADD ${models_url} /opt/intel # setup Python ENV PYTHON_VER python3.8 RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt && \ ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/tools/benchmark_tool/requirements.txt; ADD smartcity_demo.sh /home/openvino CMD ["/bin/bash"] ``` ### 3. Upload docker image to dockerhub #### 3.1 docker login ``` docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: your_dockerhub_id Password: WARNING! Your password will be stored unencrypted in /home/openvino/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded ``` #### 3.2 docker push (uploade docker image to dockerhub) ``` docker tag tgl_saleskit:2021.4_tgl your_dockerhub_id/tgl_saleskit:2021.4_tgl docker push your_dockerhub_id/tgl_saleskit:2021.4_tgl ``` ##### logs ```bash= dlcv@dlcv-NUC11PAHi7:~/tgl_saleskit_2021.4_tgl$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE tgl_saleskit 2021.4_tgl 292fb6a5c80c 17 minutes ago 3.01GB openvino/ubuntu20_data_dev 2021.4_tgl 2844df1d1032 5 weeks ago 6.72GB openvino/ubuntu20_data_runtime 2021.4_tgl e42518d8e4c0 5 weeks ago 1.98GB your_dockerhub_id/openvino 2021.3_developer_models 3a1328523841 3 months ago 3.29GB dlcv@dlcv-NUC11PAHi7:~/tgl_saleskit_2021.4_tgl$ docker tag tgl_saleskit:2021.4_tgl your_dockerhub_id/tgl_saleskit:2021.4_tgl dlcv@dlcv-NUC11PAHi7:~/tgl_saleskit_2021.4_tgl$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE your_dockerhub_id/tgl_saleskit 2021.4_tgl 292fb6a5c80c 19 minutes ago 3.01GB tgl_saleskit 2021.4_tgl 292fb6a5c80c 19 minutes ago 3.01GB openvino/ubuntu20_data_dev 2021.4_tgl 2844df1d1032 5 weeks ago 6.72GB openvino/ubuntu20_data_runtime 2021.4_tgl e42518d8e4c0 5 weeks ago 1.98GB your_dockerhub_id/openvino 2021.3_developer_models 3a1328523841 3 months ago 3.29GB ``` ### 4. Run Smart City Demo ```bash= wget -O ~/Downloads/NewVideo2.mp4 https://github.com/incluit/OpenVino-For-SmartCity/raw/master/data/NewVideo2.mp4 docker pull your_dockerhub_id/tgl_saleskit:2021.4_tgl docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v ~/Downloads:/mnt --device /dev/dri:/dev/dri --group-add=$(stat -c "%g" /dev/dri/render*) --rm your_dockerhub_id/tgl_saleskit:2021.4_tgl /home/openvino/smartcity_demo.sh ``` ### 5. Run Benchmark #### YOLO v3 416x416 : Throughput: 59 FPS ```bash= docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v ~/Downloads:/mnt --device /dev/dri:/dev/dri --group-add=$(stat -c "%g" /dev/dri/render*) --rm your_dockerhub_id/tgl_saleskit:2021.4_tgl python3 /opt/intel/openvino/deployment_tools/tools/benchmark_tool/benchmark_app.py -m /opt/intel/openvino_models/public/yolo-v3-tf/FP16-INT8/yolo-v3-tf.xml -d GPU -api async -t 60 ``` #### YOLO V4 vs YOLO v5-l @ 640x640 input resolution YOLO v4 640x640 : Throughput: 23.12 FPS ```bash= docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v ~/Downloads:/mnt --device /dev/dri:/dev/dri --group-add=$(stat -c "%g" /dev/dri/render*) --rm your_dockerhub_id/tgl_saleskit:2021.4_tgl python3 /opt/intel/openvino/deployment_tools/tools/benchmark_tool/benchmark_app.py -m /mnt/openvino_models/public/yolo-v4-tf/FP16-INT8/yolo-v4-tf.xml -d GPU -shape [1,3,640,640] ``` YOLO v5l 640x640 : Throughput: 30.59 FPS ```bash= docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v ~/Downloads:/mnt --device /dev/dri:/dev/dri --group-add=$(stat -c "%g" /dev/dri/render*) --rm your_dockerhub_id/tgl_saleskit:2021.4_tgl python3 /opt/intel/openvino/deployment_tools/tools/benchmark_tool/benchmark_app.py -m /mnt/openvino_models/public/yolo-v5l-v5-pt/FP16-INT8/yolo_v5l-v5.xml -d GPU ``` ### 6. Add New Models for Benchmark Follow steps in link below to convert models to FP32, FP16 and INT8 IR in /home/openvino/openvino_models. Then copy it to /mnt folder. They will be available in ~/Downloads folder in the host. https://hackmd.io/3jNqTlEMTZe93rAKOpyMDA ### Appendix. Install OS and tool (skip this if your system have Ubuntu 20.04.2 or later version installed) #### Make sure BIOS setting is correct Please refer to https://hackmd.io/UZ8LWR30Qn-SFPbC21_j5Q #### Download and Install Ubuntu 20.04.2.0 LTS URL to donwload Ubuntu 20.04.2.0 LTS ISO image: https://ubuntu.com/download/desktop/thank-you?version=20.04.2.0&architecture=amd64 URL to donwload Ubuntu 20.04.3 LTS ISO image: https://ubuntu.com/download/desktop/thank-you?version=20.04.3&architecture=amd64 #### Install Ubuntu 20.04 https://phoenixnap.com/kb/install-ubuntu-20-04 #### Install Docker Utility ``` sudo apt update sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt install curl curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker $USER ## Need to logout or reboot to run docker as non-root user docker run hello-world ``` If you see error messages below, reboot your system. ``` openvino@openvino-TGL:~$ docker run hello-world docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create: dial unix /var/run/docker.sock: connect: permission denied. See 'docker run --help'. ```