Skip to content
☕️ Integrate Caffe model into ROS
C++ Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
caffe @ f1cc905 Add caffe as submodule Aug 25, 2015
data
src Type in README Aug 31, 2015
.gitignore
.gitmodules Add caffe as submodule Aug 25, 2015
CMakeLists.txt Add topics to recievie cv::Mat and publish result Aug 31, 2015
README.md include astra launch instructions Jan 16, 2017
package.xml Add topics to recievie cv::Mat and publish result Aug 31, 2015

README.md

ros_caffe

Purpose

Integrate Caffe model into ROS

Requirements

Grab the source

$ cd [CATKIN_WS]/src

$ git clone --recursive https://github.com/tzutalin/ros_caffe.git

$ cd [CATKIN_WS]/src/ros_caffe

Build

Build Caffe

cd [CATKIN_WS]/src/ros_caffe/caffe

cp Makefile.config.example Makefile.config

$ vi Makefile.config

For CPU-only Caffe, uncomment CPU_ONLY := 1 in Makefile.config.

$ make all ; make distribute

Build ros package

$ cd [CATKIN_WS]

$ catkin_make

$ source ./devel/setup.bash

Run

You can download default caffenet's model. It will be located at data folder

cd data; sh download_caffe_model.sh

Open a terminal, execute

$ roscore

Open another terminal, execute $ roslaunch turtlebot_bringup 3dsensor.launch

if you dont have turtlebot, you could use astra's camera: $ roslaunch astra_launch astra.launch

Open another terminal, execute

$ rosrun ros_caffe ros_caffe_test

Output:

Test default image under /data/cat.jpg
0.1384 - "n02123159 tiger cat"
0.1302 - "n02123045 tabby, tabby cat"
0.1138 - "n02085620 Chihuahua"
0.1076 - "n02094433 Yorkshire terrier"
0.0914 - "n02123394 Persian cat"

You can echo a topic to receive the string message.

$ rostopic echo /caffe_ret

data: [0.138446 - n02123159 tiger cat]
[0.130182 - n02123045 tabby, tabby cat]
[0.113755 - n02085620 Chihuahua]
[0.107584 - n02094433 Yorkshire terrier]
[0.0913549 - n02123394 Persian cat]

ROS Topics

Publish a topic after classifiction

/caffe_ret

Receive an image :

/camera/rgb/image_raw

Optional settting

You can change your Caffe's include and lib path in CMakeLists.txt.

set(CAFFE_INCLUDEDIR caffe/include caffe/distribute/include)
set(CAFFE_LINK_LIBRARAY caffe/lib)
You can’t perform that action at this time.