Skip to main content
sample_object_detection 示例应用使用 ROS 2 节点检测并分类图像中的物体。它使用 Qualcomm® AI Engine Direct SDK (QNN) 进行模型推理。 该示例使用 Ultralytics YOLOv8 模型来预测图像中物体的边界框和类别。
注意有关更多信息,请参见 GitHub 上的 sample_object_detection。

图:sample_object_detection 的示例效果

sample_object_detection 的流水线流程

图:sample_object_detection 的流水线流程

sample_object_detection 中使用的 ROS 节点

sample_object_detection 中使用的 ROS topic

注意yolo_detection_overlay_node 使用严格时间戳(exact-time)策略同步 /yolo_detect_result 和 /resized_image 两个输入。两者都必须处于发布状态,才能产生 /yolo_detect_overlay。

前提条件

生成 YOLOv8 模型

  1. 在主机计算机上设置 QAI-Hub。
    1. 登录 QAI-Hub 并获取你的 API token。
    2. 安装 QAI-Hub。
  2. 在主机计算机上导出模型。
    SSH Session
有关更多信息,请参见 GitHub 上的 qrb_ros_tensor_process。

开箱即用运行 sample_object_detection

1

在开发套件上运行示例

SSH Session
2

在主机计算机上检查结果

在主机计算机的终端中,用 rqt 检查名称为 /yolo_detect_overlay 的 ROS topic。

构建并运行 sample_object_detection

以下步骤以 Dragonwing IQ-9075 Evaluation Kit 为例构建 sample_object_detection 包。
1

在主机计算机上构建并打包

  1. 构建示例应用项目。
  2. 打包并将示例应用推送到设备。
2

在开发套件上安装并运行

  1. 安装示例应用。
    SSH Session
  2. 按照 开箱即用运行 sample_object_detection 中的步骤运行示例应用。