Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ venv.bak/

#idea
.idea/

# vscode
.vscode/

# log
log/
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,55 @@ This project depends on ROS [vision_msgs](http://wiki.ros.org/vision_msgs), whic
You can select a specific model using the `model_file` ros parameter, which specifies a given `.yaml` file under `detectron2/configs`. Detectron2 is then initialized with that model, and you can send it images to be segmented through the `/detectron/segment` service. See the [service message specification](segmentation_msgs/srv/SegmentImage.srv) for details about the output format.

If the `publish_visualization` parameter is set to true, the node also publishes a version of image annotated with the masks and scores, on a topic specified through the `visualization_topic` parameter.

## Usage with [Voxeland](https://github.com/MAPIRlab/Voxeland)

### 1. Build the Workspace

Clean previous build artifacts and execute `colcon build` to compile the workspace. Please adapt the paths if necessary:

```bash
cd ~/ros2_ws
rm -rf build/ install/ log/
colcon build --symlink-install --cmake-clean-cache
```

### 2. Launch the Detectron2 ROS 2 Node

Please adapt the paths if necessary:

```bash
cd ~/ros2_ws
source install/setup.bash
ros2 run detectron_ros detectron_ros_node
```

### 3. Run Voxeland and Play a ScanNet ROS Bag

Create and execute a bash script that contains the following commands. Please adapt the paths if necessary:

```bash
cd ~/ros2_ws

# Init voxeland_robot_perception with Detectron2 detector
gnome-terminal -- bash -c "source ~/.bashrc; source /home/ubuntu/ros2_ws/venvs/voxenv/bin/activate; ros2 launch voxeland_robot_perception semantic_mapping.launch.py object_detector:=detectron; exec bash"

# Init voxeland server
gnome-terminal -- bash -c "ros2 launch voxeland voxeland_server.launch.xml; exec bash"

# Open bag folder and play ros2 bag
gnome-terminal -- bash -c "cd /home/ubuntu/ros2_ws/bag/ScanNet/to_ros/ROS2_bags/scene0000_01/; ros2 bag play scene0000_01.db3; exec bash"
```

### Service Interface

**Service:** `/yoloe/segment`
**Type:** `segmentation_msgs/srv/SegmentImage`

**Request:**
- `sensor_msgs/Image image` - Input RGB image

**Response:**
- `segmentation_msgs/SemanticInstance2D[] instances` - Detected objects with masks and bounding boxes

**Visualization Topic:** `/segmentedImage` (if enabled)
2 changes: 1 addition & 1 deletion detectron_ros/detectron_ros/detectron_ros.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self):
self.interest_classes = self.declare_parameter("interest_classes", [*range(80)]).value

self.publish_visualization = self.declare_parameter("publish_visualization", True).value
visualization_topic = self.declare_parameter("visualization_topic", "/detectron/segmentedImage").value
visualization_topic = self.declare_parameter("visualization_topic", "/segmentedImage").value
self.visualization_pub = self.create_publisher(sensor_msgs.msg.Image, visualization_topic, 1)

self.cv_bridge = CvBridge()
Expand Down