Skip to main content
ROS 2 (Robot Operating System) is the open-source framework that most modern robots are built on. It lets the many parts of a robot - sensing, perception, decision-making, and motion - share information and work together in real time. edgeimpulse_ros is an open-source ROS 2 package that plugs an Edge Impulse model straight into your robot’s software. It runs a Linux .eim binary inside a ROS 2 node so that whatever your model understands - objects, categories, or anomalies - becomes available to the rest of your robot with no hand-written glue code.
The node is a pure inference processor: images in, vision_msgs out.
camera driver → edgeimpulse_detector (decode → preprocess → Edge Impulse runner → convert) → vision_msgs topics
Because it subscribes to a standard sensor_msgs/Image topic, it drops straight into the pipeline you already have, and it works with QoS, image_transport, namespaces, and multi-camera setups.

Highlights

  • Camera-agnostic: Subscribe to any image topic with configurable QoS; optional CompressedImage input.
  • Handles the hard encodings: Decodes bgr8, rgb8, mono8/16, bgra8, rgba8, yuyv, uyvy, and nv12/nv21 natively.
  • Correct timestamps: The source image’s stamp and frame_id propagate to every output, so TF and sensor fusion keep working.
  • Every image model type: Object detection, image classification, FOMO, and visual anomaly detection (FOMO-AD).
  • Accurate coordinates: Detections are mapped from model-input space back to the original image resolution (crop/pad/squash aware).
  • Idiomatic messages: vision_msgs/Detection2DArray and Classification, plus latched VisionInfo/LabelInfo.
  • Observability built in: An optional annotated debug image and a diagnostic_msgs/DiagnosticArray with FPS, latency, and model health.

Prerequisites

  • A ROS 2 workspace running Jazzy or Rolling (which ship vision_msgs 4.x). Humble support is on the roadmap but not yet validated in CI.
  • The Edge Impulse Linux Python SDK installed in the same interpreter as ROS, along with OpenCV and NumPy. The SDK imports pyaudio at load time (even for image models), so portaudio19-dev is required to build it.
  • A model exported from your Edge Impulse project as a Linux .eim binary that matches your device architecture. You can train a model in Edge Impulse Studio or start from a public project.
Install the ROS dependencies and the Edge Impulse Linux SDK for your platform:
On a standard Ubuntu machine (Ubuntu 24.04 pairs with ROS 2 Jazzy), use apt and pip. On Ubuntu 24.04 the system Python is externally managed (PEP 668), so install the SDK into your user site with --break-system-packages:
sudo apt update
sudo apt install ros-$ROS_DISTRO-vision-msgs ros-$ROS_DISTRO-diagnostic-msgs \
                 ros-$ROS_DISTRO-v4l2-camera \
                 python3-opencv python3-numpy portaudio19-dev

pip install --user --break-system-packages edge_impulse_linux pyaudio
Use the x86-64 (or aarch64 on Arm-based machines) .eim build from the Studio.

Get started in five minutes

Install the package into your ROS 2 workspace, then run the bundled webcam demo:
# In your ROS 2 workspace
colcon build --packages-select edgeimpulse_ros
source install/setup.bash

# One-command demo with a USB camera (needs ros-$ROS_DISTRO-v4l2-camera)
ros2 launch edgeimpulse_ros edgeimpulse_with_camera.launch.py \
  model_path:=/absolute/path/to/model.eim \
  publish_debug_image:=true
Then watch the results flow:
ros2 topic echo /edgeimpulse_detector/detections
ros2 run rqt_image_view rqt_image_view /edgeimpulse_detector/debug_image

Use your existing camera node

Already have a camera node? Skip the demo launch and point the detector at your existing topic:
ros2 launch edgeimpulse_ros edgeimpulse_detector.launch.py \
  model_path:=/path/to/model.eim \
  image_topic:=/camera/image_raw \
  image_qos:=sensor_data
The input topic, QoS, resize mode, confidence threshold, and debug overlay are all ROS 2 parameters, with ready-to-use launch files and a documented config file, so you can configure the node without editing code.

NV12 and Qualcomm QRB cameras

Qualcomm’s qrb_ros_camera publishes NV12 frames. edgeimpulse_ros can decode NV12 (and NV21/YUYV) directly to BGR inside the node, so you can point it straight at the camera:
ros2 launch edgeimpulse_ros edgeimpulse_detector.launch.py \
  model_path:=/path/to/model.eim \
  image_topic:=/qrb_camera/image \
  image_qos:=sensor_data

Visual anomaly detection

FOMO-AD models are well suited to quality control and “something’s wrong here” monitoring. edgeimpulse_ros publishes the spatial anomaly grid as boxes on ~/detections and the peak anomaly score on ~/anomaly, and overlays the flagged regions on the debug image.

Learn more

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