Docker image with SAM2 and ROS2 Humble.
- Docker
- NVIDIA Docker
- OSRF Rocker
- Clone this repository:
git clone https://github.com/RobInLabUJI/SAM2.git
-
Create the Docker image:
2.1 Either by building it:
cd SAM2 && ./docker_build.sh2.2 Or pulling it from GitHub:
cd SAM2 && ./docker_pull.sh -
Run a Docker container:
cd SAM2 && ./docker_run.sh
- In a new terminal you can open an additional session in the container:
cd SAM2 && ./bash.sh
Inside the container, build the package:
source /opt/ros/humble/setup.bash
cd /home/user/SAM2/ros2_ws/
colcon build
Run the tracker node:
source /opt/ros/humble/setup.bash
source /home/user/SAM2/ros2_ws/install/setup.bash
ros2 run sam2_tracker sam2_tracker
Initial prompts (lines 71-85 of sam2_tracker.py):
ann_obj_id = 1 # Red pipe
points = np.array([[595, 65], [480,150], [472,120], [425,170], [395,188]], dtype=np.float32)
labels = np.array([1,0,0,1,1], dtype=np.int32)
ann_obj_id = 2 # Floor
points = np.array([[350, 275]], dtype=np.float32)
labels = np.array([1], np.int32)
ann_obj_id = 3 # Yellow pillar
points = np.array([[298, 210]], dtype=np.float32)
labels = np.array([1], np.int32)
Play bag file:
source /opt/ros/humble/setup.bash
ros2 bag play --start-offset 25 4-2024-06-13-17-27-55_ROS2
