mobilenet_unet
功能介绍
mobilenet_unet分割算法示例使用图片作为输入,利用BPU进行算法推理,发布包含分割结果msg。
mobilenet_unet是使用Cityscapes数据集训练出来的Onnx模型,支持对人、车辆、路面、路标等类别进行分割。
代码仓库: https://github.com/D-Robotics/hobot_dnn
应用场景:mobilenet_unet由MobileNet与UNet组成,能够从像素级别分割图像内容,可实现道路识别、遥感地图分析、医学影像诊断等功能,主要应用于自动驾驶、地质检测,医疗影像分析等领域。
背景虚化案例: https://github.com/rusito-23/mobile_unet_segmentation
支持平台
| 平台 | 运行方式 | 示例功能 |
|---|---|---|
| RDK X3, RDK X3 Module | Ubuntu 20.04 (Foxy), Ubuntu 22.04 (Humble) | · 启动MIPI/USB摄像头/本地回灌,渲染结果保存在本地 |
| RDK X5, RDK X5 Module | Ubuntu 22.04 (Humble) | · 启动MIPI/USB摄像头/本地回灌,渲染结果保存在本地 |
| RDK S100, RDK S100P | Ubuntu 22.04 (Humble) | · 启动MIPI/USB摄像头/本地回灌,渲染结果保存在本地 |
| RDK S600 | Ubuntu 24.04 (Jazzy) | · 启动MIPI/USB摄像头/本地回灌,渲染结果保存在本地 |
| X86 | Ubuntu 20.04 (Foxy) | · 使用本地回灌,渲染结果保存在本地 |
算法信息
| 模型 | 平台 | 输入尺寸 | 推理帧率(fps) |
|---|---|---|---|
| mobilenet_unet | X3 | 1x3x1024x2048 | 24.34 |
| mobilenet_unet | X5 | 1x3x224x224 | 50.33 |
| deeplabv3 | S100 | 1x3x224x224 | 14.70 |
| deeplabv3 | S600 | 1x3x224x224 | 337.15 |
准备工作
RDK平台
-
RDK已烧录好Ubuntu系统镜像。
-
RDK已成功安装TogetheROS.Bot。
-
RDK已安装MIPI或者USB摄像头,无摄像头的情况下通过回灌本地JPEG/PNG格式图片的方式体验算法效果。
X86平台
-
X86环境已配置好Ubuntu 20.04系统镜像。
-
X86环境系统已成功安装tros.b。
使用介绍
RDK平台
使用摄像头发布图片
使用MIPI摄像头发布图片
mobilenet_unet分割示例订阅sensor package发布的图片,经过推理后发布算法msg,并在运行路径下自动保存渲染后的图片,命名方式为render_frameid_时间戳秒_时间戳纳秒.jpg。
- Foxy
- Humble
- Jazzy
# 配置tros.b环境
source /opt/tros/setup.bash
# 配置tros.b环境
source /opt/tros/humble/setup.bash
# 配置tros.b环境
source /opt/tros/jazzy/setup.bash
# 配置MIPI摄像头
export CAM_TYPE=mipi
# 启动launch文件
ros2 launch dnn_node_example dnn_node_example.launch.py dnn_example_dump_render_img:=1 dnn_example_config_file:=config/mobilenet_unet_workconfig.json dnn_example_image_width:=1920 dnn_example_image_height:=1080
使用USB摄像头发布图片
- Foxy
- Humble
- Jazzy
# 配置tros.b环境
source /opt/tros/setup.bash
# 配置tros.b环境
source /opt/tros/humble/setup.bash
# 配置tros.b环境
source /opt/tros/jazzy/setup.bash
# 配置USB摄像头
export CAM_TYPE=usb
# 启动launch文件
ros2 launch dnn_node_example dnn_node_example.launch.py dnn_example_dump_render_img:=1 dnn_example_config_file:=config/mobilenet_unet_workconfig.json dnn_example_image_width:=1920 dnn_example_image_height:=1080