Skip to content

RobInLabUJI/SAM2

Repository files navigation

SAM2

Docker image with SAM2 and ROS2 Humble.

Prerequisites

  • Docker
  • NVIDIA Docker
  • OSRF Rocker

Docker Image

  1. Clone this repository:
git clone https://github.com/RobInLabUJI/SAM2.git
  1. Create the Docker image:

    2.1 Either by building it:

    cd SAM2 && ./docker_build.sh
    

    2.2 Or pulling it from GitHub:

    cd SAM2 && ./docker_pull.sh
    
  2. Run a Docker container:

cd SAM2 && ./docker_run.sh
  1. In a new terminal you can open an additional session in the container:
cd SAM2 && ./bash.sh

ROS2 SAM2 Tracker

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

Example with bag file

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

rqt view

Acknowledgments

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors