> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 预构建示例应用程序

**Qualcomm Intelligent Multimedia SDK（IMSDK）** 包含一组预构建的示例应用程序，旨在帮助开发者快速评估 Qualcomm® 硬件上的多媒体和 AI 能力。这些应用程序基于 **GStreamer 管线**和 **IMSDK 插件**构建，是摄像头采集、视频播放、目标检测、姿态估计等常见用例的参考实现。

预构建示例应用提供了一种快速可靠的方式来：

* **验证硬件功能**：确认摄像头、显示、音频和 AI 加速器在您的开发板上正常工作。
* **理解管线结构**：了解如何使用 `qtivtransform`、`qtimltflite` 和 `qtivcomposer` 等 IMSDK 插件构建 GStreamer 管线。
* **进行性能基准测试**：使用优化的管线测量实时多媒体和 AI 任务的吞吐量和延迟。
* **加速开发**：将可运行的示例作为构建自定义应用程序的起点。每个示例都演示了零拷贝数据流、硬件卸载和插件配置的最佳实践。

要开始在目标设备上探索预构建示例应用程序，请按照以下分步说明安装所需的依赖项并配置系统。

**前提条件：**\
在启动示例应用之前，请确保目标设备满足以下所有前提条件。

* 完成设备设置。
* 确保 IQ‑9075 设备正在运行 Ubuntu 操作系统。
* 设置 Wi-Fi 并通过 SSH 访问 IQ-9075 EVK 设备
* 如果尚未安装 PPA 软件包，请执行**安装所需软件包**步骤。

## 安装所需软件包

要安装所需的预构建软件包，请参阅[**🔗安装所需软件包**](../devices/iq9075-evk/Install_required_software_packages)章节，并运行提供的 Install PPA Packages 脚本。

## 下载并运行工件脚本

在运行任何示例应用程序之前，您必须下载所需的模型、标签和媒体资源。`download_artifacts.sh` 脚本会自动获取所有必需的组件，包括：

* 模型 – 示例应用程序用于推理的预训练机器学习模型。
* 标签 – 将模型输出映射为人类可读类别名称的元数据文件。
* 媒体文件 – 用于运行和验证应用程序的示例输入数据（如图像或视频）。

您可以通过 SSH 或在设备本地登录后运行以下命令。

```shell theme={null}
cd /home/ubuntu 
curl -L -O https://raw.githubusercontent.com/quic/sample-apps-for-qualcomm-linux/refs/heads/main/qualcomm-linux/scripts/download_artifacts.sh
sudo chmod +x download_artifacts.sh 
sudo ./download_artifacts.sh
```

## 验证模型/标签/媒体文件

在启动任何示例应用程序之前，请确保所需文件已就位。

检查以下目录：\
**模型文件** → `/etc/models/`\
**标签文件** → `/etc/labels/`\
**媒体文件** → `/etc/media/`

<Note>
  **注意：**  这些文件对于 AI 应用的正常运行至关重要。如果缺失，请重新运行工件下载脚本。
</Note>

## 预构建示例应用程序列表

***输入源*** – 媒体文件；***输出源*** - Waylandsink\
***模型精度*** - 量化模型；***运行时*** - TFLite；使用脚本 - JSON

对于**多媒体示例应用程序**，请确保已连接 **CSI 摄像头**。

| 示例应用名称                                          | 详情                                                                                                        | AI Hub 模型（默认）                 |
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ----------------------------- |
| gst-ai-object-detection                         | [目标检测](https://docs.qualcomm.com/doc/80-70020-50/topic/gst-ai-object-detection.html)                      | yolox\_quantized              |
| gst-ai-daisychain-detection-pose                | [菊花链检测与姿态](https://docs.qualcomm.com/doc/80-70023-50/topic/daisy-chain-detection-and-pose-detection.html) | Yolo-X\_w8a8, HRNetPose\_w8a8 |
| gst-ai-face-detection                           | [人脸检测](https://docs.qualcomm.com/doc/80-70023-50/topic/gst-ai-face-detection.html)                        | face\_det\_lite               |
| gst-ai-segmentation                             | [图像分割](https://docs.qualcomm.com/doc/80-70023-50/topic/gst-ai-segmentation.html)                          | Deeplabv3\_plus\_mobilenet    |
| gst-ai-pose-detection                           | [姿态检测](https://docs.qualcomm.com/doc/80-70023-50/topic/gst-ai-pose-detection.html)                        | hrnet\_pose                   |
| gst-ai-monodepth                                | [视频单目深度](https://docs.qualcomm.com/doc/80-70023-50/topic/mono-depth-from-video.html)                      | midas                         |
| gst-camera-single-stream-example                | [单摄像头流](https://docs.qualcomm.com/doc/80-70023-50/topic/gst-camera-single-stream-example.html)            | NA                            |
| gst-multi-camera-example                        | [多摄像头流](https://docs.qualcomm.com/doc/80-70023-50/topic/gst-multi-camera-stream-example.html)             | NA                            |
| gst-activate-deactivate-streams-runtime-example | [运行时激活/停用流](https://docs.qualcomm.com/doc/80-70023-50/topic/gst-activate-deactivate-streams-runtime.html) | NA                            |

## 运行目标检测示例应用程序

***gst-ai-object-detection*** 应用程序可用于检测图像和视频中的对象。这些用例展示了使用 Qualcomm Neural Processing SDK 运行时执行 YOLOv5、YOLOv8 和 YOLOX，使用 Qualcomm AI Engine Direct 执行 YOLOv8，以及使用 LiteRT 执行 YOLOv5 和 YOLOv8。

**gst-ai-object-detection 管线：**

<img src="https://mintlify.s3.us-west-1.amazonaws.com/qualcomm-prod/images/run-sample-applications/IQ-9075_object_detection.png" alt="" />

1. 使用 SSH 或 SBC 终端登录。
2. 设置所需的环境变量，将 Wayland 应用程序连接到当前的用户会话。

```bash theme={null}
export XDG_RUNTIME_DIR=/run/user/$(id -u ubuntu)
export WAYLAND_DISPLAY=wayland-1
```

3. 对于 Ubuntu Desktop：\
   运行以下额外命令以创建缺失的符号链接（针对 TensorFlow Lite C 库）。

```bash theme={null}
sudo ln -s /lib/aarch64-linux-gnu/libtensorflowlite_c.so.2 /lib/aarch64-linux-gnu/libtensorflowlite_c.so
```

4. 使用以下命令运行 gst-ai-object-detection 应用程序。\\

```shell theme={null}
gst-ai-object-detection
```

<img src="https://mintlify.s3.us-west-1.amazonaws.com/qualcomm-prod/images/run-sample-applications/object_detection.png" alt="" />

5. 要显示可用的帮助选项，请在 SSH shell 中运行以下命令：

```shell theme={null}
gst-ai-object-detection -h
```

**调试消息：**\
设置 GStreamer 用于控制调试消息详细程度和类别的 GST\_DEBUG 环境变量：

```shell theme={null}
export GST_DEBUG=3
```

6. 要停止应用程序，请按 **CTRL + C**

## 参考文档

* [**运行 AI/ML 示例应用程序**](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-50/ai-ml-sample-applications.html)
* [**Qualcomm IM SDK 入门**](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-51/install-sdk.html#panel-0-VWJ1bnR1)
