user@host:~$ pip3 install --upgrade pip
Traceback (most recent call last):
File "/home/user/.local/bin/pip3", line 7, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal'
user@host:~$ python3 -m pip --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
user@host:~$ python3 -m pip install --upgrade pip
Collecting pip
Cache entry deserialization failed, entry ignored
Using cached https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-21.3.1
user@host:~$ pip3 install virtualenv
user@host:~$ pip3 install virtualenvwrapper
user@host:~$ mkdir .virtualenvs
user@host:~$ vi .bashrc
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source $HOME/.local/bin/virtualenvwrapper.sh
user@host:~$ source .bashrc
user@host:~$ mkvirtualenv tao -p /usr/bin/python3
(tao) user@host:~$ deactivate
user@host:~$ lsvirtualenv
user@host:~$ workon tao
(tao) user@host:~$ pip3 install nvidia-pyindex
(tao) user@host:~$ pip3 install nvidia-tao
(tao) user@host:~$ pip3 install jupyter
(tao) user@host:~$ tao info
到 https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/resources/cv_samples 網站
右上角 Download 選 WGET 或 CLI, 會將命令拷貝至剪貼簿,如下命令,並執行
ngc registry resource download-version "nvidia/tao/cv_samples:v1.4.1"
wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/tao/cv_samples/versions/v1.4.1/zip -O cv_samples_v1.4.1.zip
(tao) user@host:~/Data/tao$ unzip -u cv_samples_v1.4.1.zip -d ./cv_samples_v1.4.1 && rm -rf cv_samples_v1.4.1.zip
user@host:~/Data/tao$ cp -ar cv_samples_v1.4.1/yolo_v4_tiny/ yolo_v4_tiny_1.4.1
(tao) user@host:~/Data/tao$ cd cv_samples_v1.4.1/
(tao) user@host:~/Data/tao/cv_samples_v1.4.1$
(tao) user@host:~/Data/tao/cv_samples_v1.4.1$ jupyter notebook --ip 0.0.0.0 --port 8888 --allow-root
依據命令返回說明,開啟網頁
進入 yolo_v4_tiny, 點選 yolo_v4_tiny.ipynb
修改下列環境變數到你真實的位置
%env LOCAL_PROJECT_DIR=YOUR_LOCAL_PROJECT_DIR_PATH
%env LOCAL_PROJECT_DIR=/home/user/Data/tao/yolo_v4_tiny_1.4.1
檢查工具版本
(tao) user@host:~/Data/tao/yolo_v4_tiny_1.4.1$ python3 --version
(tao) user@host:~/Data/tao/yolo_v4_tiny_1.4.1$ docker version
(tao) user@host:~/Data/tao/yolo_v4_tiny_1.4.1$ apt list -a nvidia-container-toolkit
(tao) user@host:~/Data/tao/yolo_v4_tiny_1.4.1$ apt list -a nvidia-docker2
(tao) user@host:~/Data/tao/yolo_v4_tiny_1.4.1$ nvidia-smi
(tao) user@host:~/Data/tao/yolo_v4_tiny_1.4.1$ docker login nvcr.io
到 https://catalog.ngc.nvidia.com/ 搜尋 object
可找到 TAO Pretrained Object Detection
進入,點選右上 Download, 選 CLI,將命令拷貝
可由命令查到真實位置
ngc registry model download-version "nvidia/tao/pretrained_object_detection:cspdarknet_tiny"
參考 https://catalog.ngc.nvidia.com/orgs/nvidia/containers/deepstream
user@host:~/Data/V2Pdetect$ docker run --gpus all -it --rm --net=host --privileged -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream-6.2 nvcr.io/nvidia/deepstream:6.2-devel
查詢已安裝套件的版本
參考 https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Quickstart.html?highlight=compatibility#platform-and-os-compatibility
其中 nvidia driver 的版本, docker 是使用 host 的 driver
root@host:/opt/nvidia/deepstream/deepstream-6.2# pip list
root@host:/opt/nvidia/deepstream/deepstream-6.2# dpkg -l|grep nvinfer
root@host:/opt/nvidia/deepstream/deepstream-6.2# dpkg -l|grep cudnn
root@host:/opt/nvidia/deepstream/deepstream-6.2# dpkg -l|grep cudnn
root@host:/opt/nvidia/deepstream/deepstream-6.2# cat /etc/os-release
root@host:/opt/nvidia/deepstream/deepstream-6.2# update-alternatives --display cuda
root@host:/opt/nvidia/deepstream/deepstream-6.2# nvidia-smi
root@host:/opt/nvidia/deepstream/deepstream-6.2# ./install.sh
root@host:/opt/nvidia/deepstream/deepstream-6.2# ./user_additional_install.sh
user@host:~/Data/DeepStream/deepstream_tao_apps$ git clone https://github.com/NVIDIA-AI-IOT/deepstream_tao_apps.git
user@host:~/Data/DeepStream/deepstream_tao_apps$ cd deepstream_tao_apps
user@host:~/Data/DeepStream/deepstream_tao_apps/deepstream_tao_apps$ git show-ref
user@host:~/Data/DeepStream/deepstream_tao_apps/deepstream_tao_apps$ cd ..
user@host:~/Data/DeepStream/deepstream_tao_apps$ mv deepstream_tao_apps deepstream_tao_apps-tao4.0_ds6.2ga
user@host:~/Data/DeepStream/deepstream_tao_apps$ cd deepstream_tao_apps-tao4.0_ds6.2ga/
user@host:~/Data/V2Pdetect$ docker run --gpus all -it --rm --net=host --privileged \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /etc/localtime:/etc/localtime \
-v /home/user/Data/DeepStream/deepstream_tap_apps/deepstream_tao_apps-tao4.0_ds6.2ga/:/home/deepstream_tao_apps \
-v /home/user/Data/V2Pdetect/multi_rtsp:/home/multi_rtsp \
-e DISPLAY=$DISPLAY \
-w /opt/nvidia/deepstream/deepstream-6.2 \
nvcr.io/nvidia/deepstream:6.2-devel
root@host:/opt/nvidia/deepstream/deepstream-6.2# cd /home/deepstream_tao_apps/
root@host:/home/deepstream_tao_apps# ./download_models.sh
root@host:/home/deepstream_tao_apps# ls models/yolov4-tiny/
root@host:/home/deepstream_tao_apps# cd post_processor/
root@host:/home/deepstream_tao_apps/post_processor# make
Makefile:25: *** "CUDA_VER is not set". Stop.
root@host:/home/deepstream_tao_apps/post_processor# dpkg -l | grep CUDA
root@host:/home/deepstream_tao_apps/post_processor# export CUDA_VER=11.8
root@host:/home/deepstream_tao_apps/post_processor# cd ../apps/tao_detection/
root@host:/home/deepstream_tao_apps/apps/tao_detection# make
自己準備個 sample_720p.h264,以便測試
root@host:/home/deepstream_tao_apps/apps/tao_detection# ./ds-tao-detection -c ../../configs/yolov4-tiny_tao/pgie_yolov4_tiny_tao_config.txt -i file:///home/deepstream_tao_apps/sample/streams/sample_720p.h264 -d
root@host:/home/deepstream_tao_apps/apps/tao_detection# ./ds-tao-detection -c ../../configs/yolov4-tiny_tao/pgie_yolov4_tiny_tao_config.txt -i rtsp://root:passwd@192.168.0.107:554/live1s1.sdp -d
將 tao 產生的 labels.txt, yolov4_cspdarknet_tiny_epoch_080.etlt 拷貝到 deepstream_tao_apps 下
並合併 nvinfer_config.txt 和 pgie_yolov4_tiny_tao_config.txt
root@host:/home/deepstream_tao_apps/apps/tao_detection# ./ds-tao-detection -c ../../configs/yolov4-tiny_tao/pgie_light.txt -i file:///home/deepstream_tao_apps/sample/streams/sample_720p.h264 -d
root@host:/home/multi_rtsp# apt-get update
root@host:/home/multi_rtsp# apt-get install libopencv-dev
root@host:/home/multi_rtsp# apt-get install libclutter-gst-3.0-dev
沒有留言:
張貼留言