备注:(以下操作最好在搭建梯子或者更换国内源的情况下进行,否则下载速度很慢)
请参考ROS官方安装连接: 官方安装教程 也可按以下步骤安装:
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- sudo apt install curl
- curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -(**若出现`gpg: no valid OpenPGP data found`可直接跳过 **)
- sudo apt update
- sudo apt install ros-melodic-desktop-full
- echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
- source ~/.bashrc
- source /opt/ros/melodic/setup.bash
- sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
- sudo apt install python-rosdep
- sudo rosdep init
- rosdep update
roscore
命令,若出现下图所示,说明ros安装正常: (备注):若使用SDKManager软件对TX2进行刷机,且刷入系统时选择了DeepStream 5.0选项,便会自动安装 DeepStream,无需进行以下手动安装。
执行下面命令来安装需要的软件包:
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=2.11-1
(1)进入官方DeepStream SDK选择DeepStream 5.0 for Jetson
并下载(Jetpack 4.5 向下兼容) (2)下载后得到压缩文件deepstream_sdk_5.0_jetson.tbz2
,输入以下命令以提取并安装DeepStream SDK:
sudo tar -xvf deepstream_sdk_5.0_jetson.tbz2 -C /
cd /opt/nvidia/deepstream/deepstream-5.0
sudo ./install.sh
sudo ldconfig
(3) DeepStream测试
cd /opt/nvidia/deepstream/deepstream-5.0/sources/objectDetector_Yolo
sudo CUDA_VER=10.2 make -C nvdsinfer_custom_impl_Yolo
出现如下图所示结果,说明编译成功:
sudo ./prebuild.sh
deepstream-app -c deepstream_app_config_yoloV3_tiny.txt
若能生成相关engine引擎并启动视频流检测,则说明DeepStream SDK安装成功,如下图所示:
cv-detect-ros
项目,并将本人设计好的yolov5-ros-deepstream
子项目的相关子文件夹拷贝到相应目录下进行编译cv-detect-ros
项目(建议在搭建梯子的环境下进行git clone)先按
ctrl + alt +t
进入终端(默认克隆的文件在家目录下)
git clone https://github.com/guojianyang/cv-detect-ros.git
sudo chmod -R 777 /opt/nvidia/deepstream/deepstream-5.0/sources/
sudo cp ~/cv-detect-ros/yolov5-ros-deepstream/yolov5-ros /opt/nvidia/deepstream/deepstream-5.0/sources/
cd /opt/nvidia/deepstream/deepstream-5.0/sources
在该文件夹下有yolov5-ros目录,但是打开目录后没有发现下图中的
video
文件夹,这是由于video
体量大,受到github上传容量限制,video
视频文件可自行在以下百度网盘链接下载:
链接: https://pan.baidu.com/s/1V_AftufqGdym4EEKJ0RnpQ 密码: fr8u
vdsinfer_custom_impl_Yolo--------------------------存放yolov5-ros-deepstream子项目的源码及被编译文件夹
client_ros.py-------------------------------------------存放python版本的发布目标检测数据的ros节点
video----------------------------------------------------存放被检测的相关视频文件
config_infer_number_sv30.txt------------------------自定义的数字检测引擎number_v30.engnine的基础配置文件
deepstream_app_number_sv30.txt------------------启动数字检测引擎number_v30.engnine的启动配置文件
config_infer_primary.txt-------------------------------官方提供的yolov5s.engine引擎的基础配置文件
deepstream_app_config.txt---------------------------官方提供的yolov5s.engine引擎的启动配置文件
abels.txt-------------------------------------------------官方提供的yolov5s.engine引擎的标签配置文件
number_v30.txt----------------------------------------自定义的数字检测引擎number_v30.engnin的标签配置文件
download_engine.txt----------------------------------通过里面的链接下载“number_v30.engnine”和“yolov5s.engine”
source1_csi_dec_infer_yolov5.txt--------------------启动csi摄像头实时检测
source1_usb_dec_infer_yolov5.txt--------------------启动csi摄像头实时检测
由于受到github上传容量限制
请通过以下百度网盘链接下载引擎文件夹engine_file(包含“number_v30.engine”和“yolov5s.engine”): 链接: https://pan.baidu.com/s/1xzR8UdZWM2dk3iqGWDG46Q 密码: 4e4d
或者 将yolov5-ros-deepstream/yolo5-ros文件夹下的引擎文件“number_v30.engine”和“yolov5s.engine”复制到本目录下
cd /opt/nvidia/deepstream/deepstream-5.0/sources/yolov5-ros
CUDA_VER=10.2 make -C nvdsinfer_custom_impl_Yolo
sudo cp -r ~/cv-detect-ros/yolov5-ros-deepstream/boxes_ws ~/
cd ~/boxes_ws
rm -r build devel
catkin_make
sudo gedit .bashrc
打开.bashrc文件后,将
source ~/boxes_ws/devel/setup.bash
添加进去
cd /opt/nvidia/deepstream/deepstream-5.0/sources/yolov5-ros deepstream-app -c deepstream_app_number_sv30.txt
number_v30.engine
引擎后,会出现实时检测数字的视频流,在命令框里可看到运行帧率(FPS)g++ yolov5_tensor.cpp -o yolov5_tensor ./yolov5_tensor 看到如下画面,说明运行成功:
cd /opt/nvidia/deepstream/deepstream-5.0/sources/yolov5-ros deepstream-app -c deepstream_app_config.txt
deepstream-app -c source1_usb_dec_infer_yolov5.txt
deepstream-app -c source1_csi_dec_infer_yolov5.txt