Giter VIP home page Giter VIP logo

deit's Introduction

DEIT-ROS2 Wrapper

This is a ROS2 wrapper for the data-efficient transformer with an image classification head, DEIT. 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. We have built all different versions of the algorithm (i.e. base-patch16-224, large-patch16-224, etc.) for each ROS2 distribution.

Data-efficient Image Transformer (DeiT) is model that was pre-trained and fine-tuned on ImageNet-1k (1 million images, 1,000 classes) at resolution 224x224 (we also provide other resolutions in the model versions below).

Installation Guide

Using Docker Pull

  1. Install Docker and ensure the Docker daemon is running in the background.
  2. Run docker pull shaderobotics/deit:${ROS2_DISTRO}-${MODEL_VERSION} we support all ROS2 distributions along with all model versions found in the model version section below.
  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/deit.git
  3. Enter the repo with cd deit
  4. To pick a specific model version, edit the ALGO_VERSION constant in /deit/deit.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

  • base-patch16-224
  • tiny-patch16-224
  • base-distilled-patch16-224
  • small-patch16-224
  • tiny-distilled-patch16-224
  • base-distilled-patch16-384
  • small-distilled-patch16-224

More information about these versions can be found in the paper. tiny, base, large, represent the number of weights stored (i.e. the size of the model). 384 is the resolution size of the image.

Example Docker Command

docker pull shaderobotics/deit:foxy-base-patch16-224

Usage

Run the DEIT Node

Run docker run -t --net=host shaderobotics/deit:${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 (foxy) docs here.

Topics

Name IO Type Use
deit/image_raw sub sensor_msgs.msg.Image Takes the raw camera output to be processed
deit/result pub String Outputs the classification label from ImageNet 100 Classes as a string

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 DEIT node and processes it for you to observe the outputs.

To run this, run docker build . -t [name], then docker run --net=host -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

deit's People

Contributors

bfan1256 avatar emersondove avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.