A ROS package to run any Tensorflow model for object detection or image segmentation using a camera video feed.
Tested on a Drive PX2 running a SSD-Mobilenet at 19FPS. It takes about 3mins to open a session, so be patient when running this node.
$ sudo apt-get install ros-kinetic-cv-bridge ros-kinetic-cv-camera
Main node is detector_node.py
Model definitions must be placed inside /include/ros_object_detector
As example, the model used is a SSD-Inception detecting potholes
Models' files:
/include/ros_potholes_detector/name-of-your-model/frozen_inference_graph.pb
/include/ros_potholes_detector/name-of-your-model/object-detection.pbtxt
There are three options to use this package.
use a camera:
$ rosrun cv_camera cv_camera_node
Usig default parameters and model definition:
$ rosrun ros_object_detector detector_node.py
If you want to configure the node to set different parameters, you can use roslaunch
and /config/default.yaml
file.
/config/default.yaml
to set your parameters: Your mdoel's definition, topics, etcroslaunch
:$ roslaunch ros_object_detector ros_object_detector.launch
or, to launch also the camera node
$ roslaunch ros_object_detector ros_object_detector_all.launch
You can also set any of the parameters when calling the node, by using any of the arguments below.
$ rosrun ros_object_detector detector_node.py _tf_model/pb_path:=path-to-your-models-pb.pb _tf_model/labels_definition:=path-to-your-labels.pbtxt _tf_model/num_objects:=your-models-num-objects _camera_topic:=input-camera-topic _out_img_topic:=output-image-topic
E.g.: To use a different camera topic:
$ rosrun ros_object_detector detector_node.py _camera_topic:=input-camera-topic
Note that, otherwise specified, node will use default parameters.