# AI/ML 示例应用程序

Source: [https://docs.qualcomm.com/doc/80-70017-50SC/topic/ai-ml-sample-applications.html](https://docs.qualcomm.com/doc/80-70017-50SC/topic/ai-ml-sample-applications.html)

运行自定义用例，展示如何通过使用 Qualcomm Neural Processing SDK、Qualcomm AI Engine Direct 和 LiteRT（以前称为 TensorFlow Lite 或 TFLite）模型来使用 Qualcomm Linux 的 AI/ML 功能。

在运行 AI/ML 示例应用程序之前，请使用以下步骤在设备上下载模型和标签文件。

## 下载 Qualcomm Neural Processing SDK 的模型、标签和 config JSON 文件 

要为 QCS6490、QCS9075 和 QCS8275 下载并推送模型文件，请在 Linux 主机上执行以下操作：
1. 启用 SSH 并连接至 Wi-Fi。相关说明，可参见[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。
注释： 如果已启用 SSH 并且已连接 Wi-Fi，则可以跳过此步骤。
2. 使用 SSH 登录 Linux 主机设备并将目录更改为 `/opt`：

        ssh root@<ip address of device>Copy to clipboard

        cd /optCopy to clipboard
3. 下载自动化脚本，该脚本可让您将模型、标签和 config JSON 文件下载到设备上的 /opt/ 目录：

        curl -L -O https://raw.githubusercontent.com/quic/sample-apps-for-qualcomm-linux/refs/heads/main/download_artifacts.shCopy to clipboard
4. 设置脚本权限：

        chmod +x download_artifacts.shCopy to clipboard
5. 使用所需参数运行脚本以将模型和标签文件下载至设备：

        ./download_artifacts.sh -v GA1.3-rel -c <soc name>Copy to clipboard

    这里，将 `<soc name>` 替换为 `QCS6490`、`QCS9075` 或 `QCS8275`。

## 下载 LiteRT 和 Qualcomm AI Engine Direct 的模型、标签和 config JSON 文件

1. 从 [IoT-Qualcomm AI Hub](https://aihub.qualcomm.com/iot/models/) 下载模型。 
YOLOv8 和 YOLO-NAS 模型默认不可用。使用 AI Hub API 导出这些模型。相关说明，参见以下内容：
    - [YOLOv8-Detection-Quantized](https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolov8_det_quantized)
    - [Yolo-NAS-Quantized](https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolonas_quantized)

    您可以生成批量模型。要更改模型的批量大小，请更新以下 `export` 命令中的 <var class="keyword varname">&lt;N&gt;</var>：

        python -m qai_hub_models.models.<Model_Name>.export --batch-size <N> --device "QCS6490 (Proxy)"Copy to clipboard
2. 更新 JSON 文件中量化 LiteRT 模型的 q\_offset 和 q\_scale 常量。有关说明，请参阅[获取模型常数](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-15B/integrate-ai-hub-models.html#obtain-model-constants)。
3. 将模型文件推送到设备：
    1. 启用 SSH 以登录主机设备。相关说明，可参见[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。
        如果您已经启用 SSH，则可以跳过此步骤。
    2. 使用以下命令将下载的模型文件推送到设备上：

            scp <model filename> root@<IP addr of the target device>:/opt/Copy to clipboard

        例如：

            scp mobilenet_v2_quantized.tflite root@<IP addr of the target device>:/opt/Copy to clipboard

注释： 如果要从 UART shell 运行示例应用程序，可使用以下命令重新挂载具有读/写权限的文件系统：

            mount -o remount,rw /usrCopy to clipboard
4. 下载自动脚本，该脚本可让您将标签和 config JSON 文件下载到设备上的 /opt/ 目录：

        curl -L -O https://raw.githubusercontent.com/quic/sample-apps-for-qualcomm-linux/refs/heads/main/download_artifacts.shCopy to clipboard
5. 为脚本设置所需的权限：

        chmod +x download_artifacts.shCopy to clipboard
6. 使用所需参数运行脚本以将标签文件下载至设备。

        ./download_artifacts.sh -v GA1.3-rel -c <soc name>Copy to clipboard

    这里，将 `<soc name>` 替换为 `QCS6490`、`QCS9075` 或 `QCS8275`。

注释： 这些命令用于下载模型和标签文件。这些模型文件仅适用于 Qualcomm Neural Processing SDK。对于 LiteRT 和 Qualcomm AI Engine Direct，使用标签文件运行相应的应用程序。

可以使用 Qualcomm 提供的默认模型构建以下示例程序。如果要*使用自己的模型*，请参阅 [AI 开发者工作流](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-15B/ai-ml-developer-workflow.html)。

- **[分类](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gst-ai-classification.html)**  

**gst-ai-classification** 应用程序能够识别图像中的主体。这些用例使用 Qualcomm Neural Processing SDK、LiteRT 或 Qualcomm AI Engine Direct 模型。
- **[目标检测](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gst-ai-object-detection.html)**  

此 **gst-ai-object-detection** 应用程序使您能够检测图像和视频中的对象。这些用例展示了使用 Qualcomm Neural Processing SDK runtime 执行 [YOLOv5](https://github.com/ultralytics/yolov5)、[YOLOv8](https://github.com/ultralytics/ultralytics) 和 [YOLO-NAS](https://github.com/Deci-AI/super-gradients/blob/master/YOLONAS.md)，使用 Qualcomm AI Engine Direct 执行 YOLOv8，以及使用 LiteRT 执行 YOLOv5 和 YOLOv8。
- **[姿态检测](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gst-ai-pose-detection.html)**  

 此 **gst-ai-pose-detection** 应用程序能够检测图像或视频中对象的身体姿态。这些用例使用来自摄像头、文件或 RTSP 源的输入流，使用 LiteRT 和 Qualcomm AI Engine Direct 模型进行姿态检测，并将结果显示在屏幕上。
- **[图像分割](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gst-ai-segmentation.html)**  

**gst-ai-segmentation** 应用程序能够将图像划分为不同且有意义的部分或片段，并根据属性的相似性为每个同质片段分配标签。该应用程序展示了如何使用 Qualcomm Neural Processing SDK runtime、Qualcomm AI Engine Direct runtime 和 LiteRT 进行图像分割。
- **[并行 AI 融合](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gst-ai-parallel-inference.html)**  

**gst-ai-parallel-inference** 应用程序能够对来自不同源（例如摄像头、文件或 RTSP 网络）的输入流执行目标检测、对象分类、姿态检测和图像分割。这些用例使用 LiteRT 模型进行目标检测、图像分割、分类和姿态检测。
- **[多输入 AI 推理](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gst-ai-multi-input-output-object-detection.html)**  

**gst-ai-multi-input-output-object-detection** 应用程序使您能够对来自不同来源（如摄像头、文件）或通过网络（如实时流协议（RTSP））的多个视频流执行目标检测。
- **[菊花链检测与分类](https://docs.qualcomm.com/doc/80-70017-50SC/topic/daisy-chain-detection-and-classification.html)**  

**gst-ai-daisychain-detection-classification** 应用程序使您能够使用摄像头和文件源执行级联目标检测和分类。用例涉及检测对象和对检测到的对象进行分类。
- **[菊花链检测和姿态估计](https://docs.qualcomm.com/doc/80-70017-50SC/topic/daisy-chain-detection-and-pose-detection.html)**  

**gst-ai-daisychain-detection-pose** 应用程序使用户能够使用摄像头、文件源或 RTSP 流执行级联目标检测和姿态检测。这些用例涉及检测对象并估计图像或视频中主体的身体姿态。
- **[视频单目深度](https://docs.qualcomm.com/doc/80-70017-50SC/topic/mono-depth-from-video.html)**  

**gst-ai-monodepth** 应用程序可以从实时摄像头流、文件、或 RTSP 流的推断输入流的深度。
- **[视频超分辨率](https://docs.qualcomm.com/doc/80-70017-50SC/topic/video-super-resolution.html)**  

**gst-ai-superresolution** 应用程序能够使用低分辨率输入生成高分辨率视频帧。
- **[多流推理](https://docs.qualcomm.com/doc/80-70017-50SC/topic/multistream-inference.html)**  

**gst-ai-multistream-inference** 应用程序可对来自摄像头、文件或 RTSP 流的最多 16 个输入流执行 AI 推理（目标检测和分类）。
- **[多流批量推理](https://docs.qualcomm.com/doc/80-70017-50SC/topic/multistream-batch-inference.html)**  

**gst-ai-multistream-batch-inference** 应用程序显示对来自视频文件的最多 24 个输入流的批量 AI 推理（目标检测和分割）。
- **[AI 智能 codec](https://docs.qualcomm.com/doc/80-70017-50SC/topic/ai-smart-codec.html)**  

**gst-ai-smartcodec-example** 应用程序可减少摄像头或文件源的输入的网络带宽和存储资源。
- **[人脸检测](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gst-ai-face-detection.html)**  

**gst-ai-face-detection** 应用程序从摄像头、文件或 RTSP 流采集实时视频输入，并使用 Qualcomm AI Engine Direct 的人脸检测模型生成预览，并在 HDMI 显示器上面叠加 AI 模型输出。
- **[人脸识别](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gst-ai-face-recognition.html)**  

**gst-ai-face-recognition** 应用程序从摄像头或 RTSP 流收集实时视频输入，并共享此输入以进行人脸检测和识别。它使用 three\_dmm Qualcomm AI Engine Direct 模型进行人脸检测。结果是在 HDMI 显示器上预览叠加的 AI 模型。
- **[使用 Python 和容器进行图像分割](https://docs.qualcomm.com/doc/80-70017-50SC/topic/image-segmentation-using-python.html)**  

该应用程序使用户能够使用 Qualcomm Neural Processing SDK 和 Python 绑定来执行图像分割，所有操作都在 Docker 容器内进行。

**上一级主题：** [示例应用程序](https://docs.qualcomm.com/doc/80-70017-50SC/topic/example-applications.html)

Last Published: Nov 11, 2025

[Previous Topic
示例应用程序](https://docs.qualcomm.com/bundle/publicresource/80-70017-50SC/topics/example-applications.md) [Next Topic
分类](https://docs.qualcomm.com/bundle/publicresource/80-70017-50SC/topics/gst-ai-classification.md)