Skip to main content
ROS 2 (Robot Operating System) is an open source framework for robot software. It lets the parts of a robot, such as sensing, perception, planning, and motion control, exchange data in real time. edgeimpulse_ros is an open source ROS 2 package that runs an Edge Impulse Linux .eim model inside a ROS 2 node. The node subscribes to an image topic and publishes the model’s results as vision_msgs messages that the rest of your robot can use.
Robot arm and mobile robot examples using Edge Impulse vision models through ROS 2

Edge Impulse vision models running on ROS 2 robots

The node only runs inference. Images go in and vision_msgs messages come out:
It subscribes to a standard sensor_msgs/Image topic, so it fits into an existing pipeline. It supports QoS settings, image_transport, namespaces, and multi-camera setups.

Features

  • Any camera. Subscribes to any image topic with configurable QoS, and optionally to CompressedImage.
  • Common encodings. Decodes bgr8, rgb8, mono8, mono16, bgra8, rgba8, yuyv, uyvy, nv12, and nv21.
  • Source timestamps. Copies the input image’s stamp and frame_id to every output, so TF and sensor fusion keep working.
  • All image model types. Object detection, image classification, FOMO, and visual anomaly detection (FOMO-AD).
  • Original image coordinates. Maps detections from the model’s input size back to the original image, taking the crop, pad, or squash resize into account.
  • Standard messages. Publishes vision_msgs/Detection2DArray and Classification, plus latched VisionInfo and LabelInfo.
  • Diagnostics. Optionally publishes an annotated debug image and a diagnostic_msgs/DiagnosticArray with FPS, latency, and model health.

Prerequisites

  • A ROS 2 Jazzy or Rolling workspace. Both ship vision_msgs 4.x. Humble isn’t tested in CI yet.
  • The Edge Impulse Linux Python SDK, OpenCV, and NumPy, installed in the same Python interpreter as ROS. The SDK imports pyaudio even for image models, so you also need portaudio19-dev.
  • A Linux .eim binary of your model for your device’s architecture.
Install the ROS dependencies and the Edge Impulse Linux SDK for your platform:
Ubuntu 24.04 pairs with ROS 2 Jazzy. Its system Python is externally managed (PEP 668), so install the SDK into your user site with --break-system-packages:
Use the x86-64 .eim build, or the aarch64 build on Arm machines.

Run the webcam demo

Build the package in your ROS 2 workspace, then launch the demo with a USB camera. The demo needs ros-$ROS_DISTRO-v4l2-camera.
View the detections and the debug image:

Use your existing camera node

To use a camera node you already run, launch only the detector and point it at your image topic:
The input topic, QoS, resize mode, confidence threshold, and debug overlay are all ROS 2 parameters. The repository includes launch files and a documented config file.

NV12 and Qualcomm QRB cameras

The Qualcomm qrb_ros_camera driver publishes NV12 frames. edgeimpulse_ros converts NV12 to BGR inside the node, so you can subscribe to the camera topic without a color conversion node:

Visual anomaly detection

FOMO-AD models suit quality control and other tasks that flag unusual scenes. For these models, the node publishes the anomaly grid as boxes on ~/detections, publishes the peak anomaly score on ~/anomaly, and draws the flagged regions on the debug image.

Learn more

edgeimpulse_ros is open source under the BSD-3-Clause-Clear license.