5.3.1 Model Inference
功能简介
本章节介绍深度学习模型推理节点的基本使用方式,支持以下功能:
- 输入本地图片进行模型推理,输出渲染图像并保存至本地;
- 通过 Web 界面实时可视化推理结果;
- 通过 MIPI 或 USB 摄像头输入视频流,在 Web 页面中显示目标检测结果。
本章节以目标检测模型为例,更多 DNN 算法参考 5.4 常用算法库。
支持平台
| 平台类型 | 操作系统 |
|---|---|
| SpaceMiT RISC-V 系列板 | bianbu desktop 24.04 (Humble) |
| x86 平台 | Ubuntu 22.04 (Humble) |
环境准备
安装依赖项
sudo apt install python3-opencv ros-humble-cv-bridge ros-humble-camera-info-manager \
ros-humble-image-transport python3-spacemit-ort
平台要求
SpaceMiT RISC-V:
- 已烧录 bianbu desktop 24.04 系统镜像;
- 已完成 Bianbu Robot 安装。
x86 平台:
- 已安装 Ubuntu 22.04;
- 已配置 ROS2 Humble 及 Bianbu Robot SDK 环境。
支持的模型配置列表
可执行以下命令,查看当前系统中已支持的模型配置:
ros2 launch br_perception infer_info.launch.py
示例输出:
[YAML files in 'br_perception']:
- config/segmentation/unet.yaml
- config/detection/yolov8.yaml
- config/detection/yolov6.yaml
- config/detection/yolov11_640.yaml
- config/detection/yolov5.yaml
- config/detection/yolov11_320.yaml
- config/classification/resnet18.yaml
- config/classification/resnet50.yaml
- config/classification/mobilenet_v2.yaml
后续推理时,将 config_path 设置为相应的 .yaml 文件路径,即可使用对应模型。
图片推理
激活 ROS2 环境
source /opt/bros/humble/setup.bash

