HiroIshida / detic_ros

ROS wrapper for pretrained Detic instance segmentation and detection (and some utils to work with point cloud)
MIT License
28 stars 14 forks source link
instance-segmentation object-detection ros

detic_ros rostest peripheral

ROS package for Detic. Run on both CPU and GPU, GPU is way performant, but work fine also with CPU (take few seconds to process single image).

image

example of custom vocabulary. Left: default (lvis), Right: custom ('bottle,shoe')

example of three dimensional pose recognition for cups, bottles, and bottle caps.

step1: build docker container

Ofcourse you can build this pacakge on your workspace and launch as normal ros package. But for those using CUDA, the following docker based approach might be safer and easy.

Prerequsite: You need to preinstall nvidia-container-toolkit beforehand. see (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html)

Build docker image

git clone https://github.com/HiroIshida/detic_ros.git
cd detic_ros
docker build -t detic_ros .

step2: launch Detic-segmentor node

Example for running node on pr1040 (please replace pr1040 by you robot hostname or localhost):

python3 run_container.py -host pr1040 -mount ./launch -name sample.launch \
    out_debug_img:=true \
    out_debug_segimg:=false \
    compressed:=false \
    device:=auto \
    input_image:=/kinect_head/rgb/image_color

The minimum necessary argument of run_container.py is host, mount and name:

Another example for running three dimensional object pose detection using point cloud filtered by segmentation.

python3 run_container.py -host pr1040 -mount ./launch -name sample_detection.launch \
    debug:=true \
    vocabulary:=custom \
    custom_vocabulary:=bottle,cup

Or rosrun detic_ros run_container.py if you catkin build this package on the hosting computer side. As in this example, by putting required sub-launch files inside the directory that will be mounted on, you can combine many node inside the container.

Note:

step3a (Subscribe from node in step3 and do anything you want)

Example for using the published topic from the node above is masked_image_publisher.py. This will be helpful for understanding how to apply SegmentationInfo message to a image. The test file for this example also might be helpful.

step3b (Service call)

See definition of srv/DeticSeg.srv

ROS node information

As for rosparam, see node_cofig.py.

Running without roscore to batch processing a bag file

rosrun detic_ros batch_processor.py path/to/bagfile

See source code for the options.