Preparations for Object Detection Tutorial
Table of contents
- Prerequisites
- Computer vision algorithms jupyter notebook
- Testing data
- Running the ROS Bag File in Docker (Only for rss_workspace and smb_docker)
To prepare for the object detection tutorial, please make sure the SMB software stack is installed and is running correctly.
Prerequisites
If you are using rss workspace or smb docker, all the necessary dependencies are already installed. If you installed the SMB software stack locally on your machine, please follow the instructions below to install the necessary dependencies.
Using rss workspace or smb docker (Recommended)
For most users, using the Docker container is the simplest option. The Docker container includes the model and dependencies pre-installed, and the weights are in the correct position.
- The Docker version does not use PyTorch but runs the model with ONNX to keep the size of the Docker image smaller.
Installing Dependencies locally (Only for Local Installation)
To install the object detection package locally, follow these steps:
- Navigate to the repository:
cd <ws_path>/src/object_detection
- Install Python dependencies:
pip install -r requirements.txt
- If you are using a conda environment, install the dependencies inside your environment. Follow the instructions for installing conda at: Conda User Guide
- Build object_detection: catkin build object_detection
- Download the YOLO model weights from here.
- After downloading the weights, place them in the
/usr/share/yolo/models
folder
- After downloading the weights, place them in the
Note: On the robot, dependencies are already installed, and the weights are placed on the Jetson GPU in the desired folder ‘/usr/share/yolo/models’.
Computer vision algorithms jupyter notebook
This notebook will be used during the tutorial. Please download it before coming to the summer school as internet access is limited.
Testing data
These rosbags and yaml files will be used during the tutorial. Please download them beforehand if possible.
Running the ROS Bag File in Docker (Only for rss_workspace and smb_docker)
Copying the ROS Bag File into the Docker Container
If you have downloaded the ROS bag files to your local machine and are using Mac or Windows, you can copy them into the Docker container using the docker cp command. Ensure the Docker container is running before performing these steps:
-
Find the name of the Docker container by running the following command (make sure your Docker container is running)
docker ps
The output will look like this if you are using the rss_workspace:
CONTAINER ID IMAGE COMMAND CREATED STATUS NAMES 1234567890ab vsc-rss_workspace-123asd-uid "/bin/bash" 5 minutes ago Up 5 minutes sad_hawking
or like this if you are using the smb_docker:
CONTAINER ID IMAGE COMMAND CREATED STATUS NAMES 1234567890ab smb_docker "/bin/bash" 5 minutes ago Up 5 minutes sad_hawking
In this example, the name of the Docker container is
sad_hawking
. -
Copy the ROS bag file into the Docker container, replacing
<NAME-OF-CONTAINER>
with the actual name of the Docker container and/path/to/your/rosbag.bag
with the path to the ROS bag file on your local machine:docker cp /path/to/your/rosbag.bag <NAME-OF-CONTAINER>:/workspaces/rss_workspace/src/path_to_bag_storage
If you are using vscode, you can try to drag and drop the rosbag into the vscode file explorer to copy it into the container. But be aware that this might take longer than
docker cp
. For example, it might take a few minutes to copy a 1GB file. -
Navigate to the directory containing the ROS bag file inside the container:
cd /workspaces/rss_workspace/src/rosbags
-
Play the ROS bag file:
rosbag play <rosbag_name>.bag
If the bag file does not run and you see an error like:
[ERROR] [1718830710.056746147]: [registerPublisher] Failed to contact master at [localhost:11311]. Retrying...
You might need to start the ROS master with the following command:
roscore
Note that detection in Docker will not be as effective as on the actual SMB due to the lack of a GPU and the use of ONNX with custom pre and post-processing.
YOLOv5 Supported Object Classes
For a comprehensive list of YOLOv5 supported object classes, please refer to the YOLOv5 Object Classes.