Ubuntu18.04 Deepstream5.1运行环境搭建
安装必要的基础环境
安装Anaconda并添加环境变量:
sudo vim ~/.bashrc
export PATH=~/anaconda3/bin:$PATH
创建虚拟环境:conda create -n 名字 python=需要的版本 更新pip: python -m pip install --upgrade pip 更换conda和pip为国内源。 我的系统为Ubuntu 18.04,显卡为Nvidai Tesla T4(根据自己的显卡型号去灵活选择相关的驱动和CUDA等版本)
需要安装的运行环境
- Ubuntu 18.04
- GStreamer 1.14.1
- NVIDIA Driver 460.32
- CUDA 11.1
- cuDNN 8.0.5
- cuBLAS
- TensorRT 7.2.3
1.清除原安装环境:
sudo rm -rf /usr/local/deepstream /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnv* /usr/bin/deepstream* /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libnvdsgst*
/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream* /opt/nvidia/deepstream/deepstream*
sudo rm -rf /usr/lib/x86_64-linux-gnu/libv41/plugins/libcuvidv4l2_plugin.so
如果安装Deepstream之前版本,则先卸载
To remove DeepStream 4.0 or later installations: Open the uninstall.sh file in /opt/nvidia/deepstream/deepstream/ Set PREV_DS_VER as 4.0 Run the following script as sudo: ./uninstall.sh
2.在安装DeepStream SDK之前,请输入以下命令安装必要的软件包
sudo apt install \
libssl1.0.0 \
libgstreamer1.0-0 \
gstreamer1.0-tools \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
libgstrtspserver-1.0-0 \
libjansson4
3.下载和安装NVIDIA驱动460.32 驱动下载
chmod 755 NVIDIA-Linux-x86_64-460.32.03.run
./NVIDIA-Linux-x86_64-460.32.03.run
nvidia-smi
wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run
sudo sh cuda_11.1.0_455.23.05_linux.run
sudo vim ~/.bashrc
export PATH=/usr/local/cuda-11.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source ~/.bashrc
nvcc -V
注:若是出现安装问题则可以尝试命令
sudo ./cuda_11.1.0_455.23.05_linux.run --librartpath=/usr/local/cuda-11.1
tar -xzvf cudnn-11.2-linux-x86-v8.1.1.33.tgz(8.1兼容11.0、11.1、11.2)
sudo cp cuda/include/* /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
sudo dpkg -i libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb
sudo dpkg -i libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64
sudo dpkg -i libcudnn8-samples_8.1.1.33-1+cuda11.2_amd64.deb
cd /usr/src/cudnn_samples_v8/mnistCUDNN
sudo make clean
sudo make
./mnistCUDNN
tar -xzvf TensorRT-7.2.3.4.Ubuntu-18.04.x86_64-gnu.cuda-11.1.cudnn8.1.tar.gz
cd ~/TensorRT-7.2.3.4/
sudo cp -r ./lib/* /usr/lib
sudo cp -r ./include/* /usr/include
sudo vim ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/用户名/TensorRT-7.2.3.4/lib
source ~/.bashrc
conda create -n 虚拟环境名字 python=3.8
conda activate 虚拟环境名字
cd ~/TensorRT-7.2.3.4/python
pip3 install tensorrt-7.2.3.4-cp38-none-linux_x86_64.whl
cd ~/TensorRT-7.2.3.4/graphsurgeon
pip3 install graphsurgeon-0.4.5-py2.py3-none-any.whl
cd ~/TensorRT-7.2.3.4/onnx_graphsurgeon
pip3 install onnx_graphsurgeon-0.2.6-py2.py3-none-any.whl
pip3 install pycuda
python3
import tensorrt
print(tensorrt.__version__)(7.2.3.4)
7.安装librdkafka
git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
git reset --hard 7101c2310341ab3f4675fc565f64f0967e135a6a
./configure
make
sudo make install
sudo mkdir -p /opt/nvidia/deepstream/deepstream-5.1/lib
sudo cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-5.1/lib
8.安装Deep Stream SDK下载文件
sudo tar -xvf deepstream_sdk_v5.1.0_x86_64.tbz2 -C /
cd /opt/nvidia/deepstream/deepstream-5.1/
sudo ./install.sh
sudo ldconfig
deepstream-app --version-all
9.验证Deepstream环境(测试官方Demo)
cd /opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app
sudo vim source30_1080p_dec_infer-resnet_tracker_sgie_titled_display_int8.txt
sudo deepstream-app -c source30_1080p_dec_infer-resnet_tracker_sgie_titled_display_int8.txt
Deepstream运行环境搭建完毕,下一步看看源代码,慢慢研究。。。
|