This ROS package wraps the Official YOLOv7 repo. Further, nvidia-docker is used to build an image with all the necessary YOLOv7 dependencies. Then, docker compose can be used to create a container to launch a ROS node. Note that the docker-compose.yml file shares the container network with the host network---thus, the node will be able to communicate with other ROS nodes on the host machine.
Tested on:
- Docker version 23.0.0, build e92dd87
- NVIDIA Container Runtime Hook version 1.12.0, commit: 62bd015475656ef795cb0d59cc4030a6bd4a9526
- NVIDIA GTX 1070 8GB
- Ubuntu 20.04 / ROS Noetic
Install docker, docker-compose, nvidia-docker (i.e., nvidia-container-toolkit). Note that you do not need CUDA installed on your host machine, but you do need an NVIDIA driver installed on the host for your particular NVIDIA GPU.
$ git clone --recurse-submodules https://github.com/mit-acl/yolov7_ros # get YOLOv7 submodule
$ cd yolov7_ros
$ docker compose build
$ docker compose upYou can use docker compose run to set the ROS_NAMESPACE environment variable:
docker compose run -e ROS_NAMESPACE=robot/camera yolov7_ros roslaunch yolov7_ros detect.launch- Install your favorite ROS web camera package. We will use
usb_cam:sudo apt install ros-noetic-usb-cam. - Start a
roscore. - Start the USB camera (with remapping):
rosrun usb_cam usb_cam_node usb_cam/image_raw:=image_raw - Start
yolov7_rosviadocker compose up