The value of knowledge lies not in possession, but in share.

0%

基于ROS安装Caffe和SSD【通用】

安装ROS Caffe SSD MobileNet

1
2
3
4
5
6
7
8
9
10
11
# 安装Caffe_ROS
cd ~/catkin_ws/src
git clone https://github.com/tzutalin/ros_caffe.git
# 安装Caffe_SSD
cd ~/catkin_ws/src/ros_caffe
git clone https://github.com/weiliu89/caffe.git
cd ~/catkin_ws/src/ros_caffe/caffe
git chechout ssd
# 安装MobileNet_SSD
cd ~/catkin_ws/src/ros_caffe/caffe/examples
git clone https://github.com/chuanqi305/MobileNet-SSD.git

安装依赖包

1
2
3
4
5
6
7
8
9
10
11
sudo apt-get install libatlas-base-dev
sudo apt-get install libprotobuf-dev
sudo apt-get install libleveldb-dev
sudo apt-get install libsnappy-dev
sudo apt-get install libopencv-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libgflags-dev
sudo apt-get install libgoogle-glog-dev
sudo apt-get install liblmdb-dev
sudo apt-get install protobuf-compiler

安装OpenCV

1
2
3
4
5
6
cd caffe
sudo git clone https://github.com/jayrambhia/Install-OpenCV
cd Install-OpenCV/Ubuntu
sudo sh dependencies.sh
cd 2.4
sudo sh opencv2_4_10.sh

编译Caffe

1
2
3
4
5
6
7
8
9
cd catkin_ws/src/ros_caffe/caffe
# 修改配置文件
cp Makefile.config.example Makefile.config
sudo gedit Makefile.config #参考文末链接
# 编译
make all # make all = make = make bzImage + make modules
make -j8
make py
make test -j8

安装usb_cam

1
2
cd catkin_ws/src
git clone https://github.com/bosch-ros-pkg/usb_cam.git

编译ROS

1
2
cd catkin_ws
catkin_make

运行外部程序

1
2
3
4
5
6
# 启动ROS
roscore
# 开启摄像头节点
# 提示找不到节点,参考:http://wangcong.info/article/ROSGazeboPixhawk.html#仿真
roslaunch usb_cam usb_cam-test.launch
# 运动外部程序

Debugs

1
2
3
4
5
6
7
# Bug
/usr/bin/ld: cannot find -lopenblas
collect2: error: ld return 1 eixt statues
makefile: 566: recipe for target 'build_rekease/lib/libcaffe.so.1.0.0-rc3' failed

# Debug
sudo apt-get install libopenblas-dev
1
2
3
4
5
6
7
# Bug
fatal error: caffe/proto/caffe.pb.h: No such file or directory

# Debug
protoc src/caffe/proto/caffe.proto --cpp_out=.
sudo mkdir include/caffe/proto
sudo mv src/caffe/proto/caffe.pb.h include/caffe/proto

参考:安装Caffe

🍭支持一根棒棒糖吧!