Autoware 笔记No.9,SSD车辆、行人(障碍物)识别(ssd vision detect)
一. 前言
本小结着重介绍一下vision_ssd_detect部分。
二. 安装
(1)下载ssdcaffe,一定要安装在home目录下,否则vision_ssd_detect.launch文件中的network_definition_file和pretrained_model_file路径会有变化。
% git clone -b ssd https://github.com/weiliu89/caffe.git ssdcaffe % cd ssdcaffe % git checkout 4817bf8b4200b35ada8ed0dc378dceaf38c539e4
(2)修改Makefile.config,我用的CUDA10.0,直接贴出我的Makefile.config
(3)编译
make && make distribute
(4)下载预先训练好的模型,网址:https://github.com/weiliu89/caffe/tree/ssd,在readme,models中选一个SSD512的模型,解压,并拷贝到~/ssdcaffe/models/目录。
$ tar -xvzf ~/Downloads/models_VGGNet_VOC0712_SSD_512x512.tar.gz $ cp -r ~/Downloads/models/VGGNet ~/ssdcaffe/models/
(5)执行vision_ssd_detect节点
$ cd ~/autoware.ai $ source install/setup.bash $ roslaunch vision_ssd_detect vision_ssd_detect.launch
如果没有vision_ssd_detect.launch文件,删除build和install里面的vision_ssd_detect,单独编译vision_ssd_detect。
$ cd ~/autoware.ai $ AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-select vision_ssd_detect
如果出现:libcaffe.so.1.0.0-rc3: cannot open shared object file: No such file or directory错误
需要执行
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:~/ENet/caffe-enet/distribute/lib $ AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-select vision_ssd_detect
运行vision_ssd_detect.launch文件
如果出现错误:Check failed: fd != -1 (-1 vs. -1) File not found: data/VOC0712/labelmap_voc.prototxt
将/home/xxx/ssdcaffe/models/VGGNet/VOC0712/SSD_512x512/deploy.prototxt文件最后的label_map_file: "data/VOC0712/labelmap_voc.prototxt"改为绝对路径label_map_file: "/home/xxx/ssdcaffe/data/VOC0712/labelmap_voc.prototxt"
原创博文,转载请标明出处。