Sign inSign up

shaderobotics/yolos

By shaderobotics

•Updated about 4 years ago

This is a ROS2 wrapper for the You Only Look at One Sequence for Object Detection

Image
0

356

shaderobotics/yolos repository overview

⁠YOLOS-ROS2 Wrapper

This is a ROS2 wrapper for the You Only Look at One Sequence (via Vision Transformers for Object Detection), YOLOS⁠. We utilize huggingface and the transformers for the source of the algorithm⁠. The main idea is for this container to act as a standalone interface and node, removing the necessity to integrate separate packages and solve numerous dependency issues.

The algorithm utilizes of the vanilla ViT pre-trained on mid-sized ImageNet-1k to the more challenging COCO object detection benchmark.

⁠Installation Guide

⁠Using Docker Pull

  1. Install Docker⁠ and ensure the Docker daemon is running in the background.
  2. Run docker pull shaderobotics/yolos:${ROS2_DISTRO}-${MODEL_VERSION}
  3. Follow the run commands in the usage section below

⁠Build Docker Image Natively

  1. Install Docker⁠ and ensure the Docker daemon is running in the background.
  2. Clone this repo with git pull https://github.com/open-shade/yolos.git
  3. Enter the repo with cd yolos
  4. To pick a specific model version, edit the ALGO_VERSION constant in /yolos/yolos.py
  5. Build the container with docker build . -t [name]. This will take a while. We have also provided associated cloudbuild.sh scripts to build on GCP all of the associated versions.
  6. Follow the run commands in the usage section below.

⁠Model Versions

  • tiny
  • base
  • small

More information about these versions can be found in the paper⁠. tiny, base, small, represent the number of weights stored (i.e. the size of the model).

⁠Example Docker Command

docker pull shaderobotics/yolos:foxy-small

⁠Usage

⁠Run the YOLOS Node

Run docker run -t --net=host shaderobotics/yolos:${ROS_DISTRO}-${MODEL_VERSION}. Your node should be running now. Then, by running ros2 topic list, you should see all the possible pub and sub routes.

For more details explaining how to run Docker images, visit the official Docker documentation here⁠. Also, additional information as to how ROS2 communicates between external environment or multiple docker containers, visit the official ROS2 docs here⁠.

⁠Parameters

This wrapper utilizes 4 optional parameters to modify the data coming out of the published topics as well as the dataset YOLOS utilizes for comparison. Most parameters can be modified during runtime. However, if you wish to use your own dataset, you must pass that parameter in before runtime. If you are unsure how to pass or update parameters before or during runtime, visit the official ROS2 docs here⁠.

The supported, optional parameters are...

NameTypeDefaultUse
pub_imageBooleanTrueEnable or disable the pub of the processed image (with bounding boxes)
pub_boxesBooleanTrueEnable or disable the pub of the bounding boxes as a Detection2DArray
pub_detectionsBooleanTrueEnable or disable the publishing of detections (whether or not to send back a string with all detections found)

You do not need to specify any parameters, unless you wish to modify the defaults.

⁠Topics

NameIOTypeUse
yolos/image_rawsubsensor_msgs.msg.Image⁠Takes the raw camera output to be processed
yolos/imagepubsensor_msgs.msg.Image⁠Outputs the processed image with bounding boxes drawn on the image
yolos/detectionspubstd_msgs.msg.String⁠Outputs all detected classes in the image
yolos/detection_boxespubvision_msgs.msg.Detection2DArray⁠Outputs the detected bounding box location in a unified format

⁠Testing / Demo

To test and ensure that this package is properly installed, replace the Dockerfile in the root of this repo with what exists in the demo folder. Installed in the demo image contains a camera stream emulator⁠ by klintan⁠ which directly pubs images to the YOLOS node and processes it for you to observe the outputs.

To run this, run docker build . -t --net=host [name], then docker run -t [name]. Observing the logs for this will show you what is occuring within the container. If you wish to enter the running container and preform other activities, run docker ps, find the id of the running container, then run docker exec -it [containerId] /bin/bash

Tag summary

Content type

Image

Digest

Size

4.5 GB

Last updated

about 4 years ago

docker pull shaderobotics/yolos:galactic-tiny