- Important ROS Topics
- Building
- Running
- Config File
- Building the Documentation
- SLAM Library
- Semantic Segmentation Library
- Todo
.
├── video_stream # Streams video from bagfile or Realsense Cam.
├── segmentation # Takes streamed video and outputs prediction masks + classes
├── obj_inference # Extracts distance and center point from pred. masks
└── slam # Uses center points of objects to map + localize
/seg/prediction
-- Segmentation masks, object centers, labels/video_stream/input_imgs
-- Depth map + RGB input image/inference/obj_inference
-- Distances, relative positions of objects, labels
- ROS Melodic, built with Python3
- OpenCV >= 4.4.0
$ git clone https://github.com/facebookresearch/detectron2.git && cd detectron2
$ python setup.py install
Then Download Detectron weights, for the R50-FPN Mask R-CNN for COCO InstanceSegmentation, all model weights can be found on the Detectron GitHub
Then download the model metric file.
### SOURCE ROS FIRST ###
# make cane workspace
$ mkdir -p cane_ws/src && cd cane_ws/src
$ git clone https://github.com/clbeggs/Cane.git
# cd to cane_ws
$ cd .. && catkin_make
# Source cane_ws
$ source devel/setup.bash
First, edit the config file
# Start segmentation model node
$ roslaunch segmentation segmentation.launch
# Start object inference node
$ roslaunch obj_inference inference.launch
# Start video stream
$ roslaunch video_stream streamer.launch
Entries to edit:
- RGB + Depth map input source -- video_stream
ROSBag
- Input video from bag fileRawFiles
- input video from rgb directory + depth directory- requires
rgb_dir
anddepth_dir
specifications in config file.
- requires
RealSense
- input video from connected RealSense Came
- Semantic Segmentation Model -- segmentation
detectron
- Facebook's Detectron2 model
##################################
####### Video Input Config #######
##################################
# How the input images are fed to the model
video_stream: "ROSBag" # Valid inputs: ["RawImages", "RealSense"]
publish_rate: 2 # Publish an image every <publish_rate> seconds
visualize: True # Visualize input images via cv2.namedWindow
### Necessary for all input methods ###
rgb_input_topic: "/camera/depth/image_rect_raw/compressed" # RGB Input topic to subscribe to
depth_input_topic: "/camera/color/image_raw/compressed" # Depth input topic to subscribe to
### ROSBag Config ###
bag_file: "./segmentation/bags/rgbd.bag" # Input ROSbag file, only necessary for "ROSBag" video_stream
### RawFiles Config ###
rgb_dir: ".../path/to/rgb_dir"
depth_dir: ".../path/to/depth_dir"
#####################################
##### Segmentation model config #####
#####################################
segmentation_model: "detectron"
# Weights and config for Detectron2
model_weights: "...path/to/weights/model_final_a54504.pkl"
model_config: "...path/to/weights/mask_rcnn_R_50_FPN_1x.yaml"
- Make video streamer asynch, use multiprocessing like torch DataLoader
- example script
- Sphinx documentation