# AI/ML 示例程序

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

运行定制用例以展示如何通过 Qualcomm Neural Processing SDK 和 TensorFlow Lite (TFLite) 模型使用 Qualcomm Linux 的 AI/ML 功能。

在运行 AI 示例程序之前，应确保模型和标签文件在设备上可用。

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

要下载模型和标签文件并将其推送到 QCS6490 和 QCS9075，可在 Linux 主机上执行以下操作：

1. 从 GitHub 下载文件并进行解压：

        wget https://github.com/quic/sample-apps-for-qualcomm-linux/releases/download/GA1.2-rel/GA1.2-rel.zipCopy to clipboard

        unzip GA1.2-rel.zipCopy to clipboard
2. 将模型和标签文件推送到设备：
    1. 启用 SSH 以登录目标设备。相关说明，可参见 [SSH 使用指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#how-to-ssh-)
    2. 推送文件：
        - **QCS6490**

                scp -r GA1.2-rel/QCS6490/* root@<IP address of target device>:/opt/Copy to clipboard
        - **QCS9075**

                scp -r GA1.2-rel/QCS9075/* root@<IP address of target device>:/opt/Copy to clipboard

## 从 AI Hub 下载 TFLite 的模型和标签文件

1. 从 [https://aihub.qualcomm.com/iot/models](https://aihub.qualcomm.com/iot/models) 下载模型。
    有关更新量化模型的 q\_offset 和 q\_scale 常量的信息，可参见 [AI 开发者工作流](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-15B/integrate-aihub-model.html)。
2. 下载 YOLOv8 和 YOLO-NAS TFLite 模型或使用 AI Hub API 创建您自己的模型。

| 下载模型 | 从... |
    | :--- | :--- |
    | 从 Hugging Face 下载模型。 | <ul class="ul" id="ai-ml-sample-applications__ul_t3v_flz_5cc"><br>                                            <li class="li"><a href="https://huggingface.co/qualcomm/YOLOv8-Detection-Quantized/blob/main/YOLOv8-Detection-Quantized.tflite" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://huggingface.co/qualcomm/YOLOv8-Detection-Quantized/blob/main/YOLOv8-Detection-Quantized.tflite')">YOLOv8-Detection-Quantized</a></li><br><br>                                            <li class="li"><a href="https://huggingface.co/qualcomm/Yolo-NAS-Quantized/blob/main/Yolo-NAS-Quantized.tflite" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://huggingface.co/qualcomm/Yolo-NAS-Quantized/blob/main/Yolo-NAS-Quantized.tflite')">Yolo-NAS-Quantized</a></li><br><br>                                        </ul> |
    | 安装 AI Hub 并使用 AI Hub API 创建您自己的 TFLite 模型。 | <ul class="ul" id="ai-ml-sample-applications__ul_umh_3lz_5cc"><br>                                            <li class="li"><a href="https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolov8_det_quantized" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolov8_det_quantized')">YOLOv8-Detection-Quantized</a></li><br><br>                                            <li class="li"><a href="https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolonas_quantized" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolonas_quantized')">Yolo-NAS-Quantized</a></li><br><br>                                        </ul><br><br>                                        <br>Note: 安装 AI Model Efficiency Toolkit (AIMET) 以生成量化模型。相关说明，可参见 [AIMET 安装](https://quic.github.io/aimet-pages/releases/latest/install/index.html)。 |
    | 使用 AI Hub API 生成批处理 TFLite 模型。 | <ul class="ul" id="ai-ml-sample-applications__ul_zjp_wlz_5cc"><br>                                            <li class="li"><a href="https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolov8_det_quantized" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolov8_det_quantized')">YOLOv8-Detection-Quantized</a></li><br><br>                                            <li class="li"><a href="https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/deeplabv3_plus_mobilenet_quantized" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/deeplabv3_plus_mobilenet_quantized')">deeplabv3_plus_mobilenet</a></li><br><br>                                        </ul><br><br>                                        <br>gst-ai-multistream-batch-inference 程序使用 `batch-size=4` 模型。要更改模型的批处理大小，可更新 `export` 命令：<br><br><br>                                        <br><br>        python -m qai_hub_models.models.<Model_Name>.export --batch-size 4 --device "QCS6490 (Proxy)"Copy to clipboard |
3. 将模型和标签文件推送到设备：
    1. 启用 SSH 以登录主机设备。相关说明，可参见 [SSH 使用指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#how-to-ssh-)
    2. 推送模型文件：

            scp mobilenet_v2_quantized.tflite root@<IP addr of the target device>:/opt/Copy to clipboard
    3. 将标签推送到设备：

            wget https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/labels/imagenet_labels.txtCopy to clipboard

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

Note: 确保推送的标签文件与模型相匹配。

要在使用 TFLite runtime 时启用性能模式，可更新应用程序源代码中的 HTP 外部 delegate 参数：

    external-delegate-options="QNNExternalDelegate,backend_type=htp,htp_device_id=(string)0,htp_performance_mode=(string)2,htp_precision=(string)1;"Copy to clipboard

Note: 可以使用 Qualcomm 提供的默认模型编译以下示例程序。如果要*使用自己的模型*，可参见 [AI 开发者工作流](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-15B)。

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

**gst-ai-classification** 程序可以识别图像中的主题。这些用例使用 Qualcomm Neural Processing SDK runtime 或 TensorFlow Lite (TFLite) runtime。
- **[目标检测](https://docs.qualcomm.com/doc/80-70015-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)，以及如何使用 TFLite runtime 执行 YOLOv5 和 YOLOv8。
- **[姿态检测](https://docs.qualcomm.com/doc/80-70015-50SC/topic/gst-ai-pose-detection.html)**  

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

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

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

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

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

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

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

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

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

**gst-ai-multistream-inference** 程序展示了对来自视频文件的多达 24 个输入流进行批量 AI 推理（目标检测和分割）。
- **[使用 Python 进行图像分割](https://docs.qualcomm.com/doc/80-70015-50SC/topic/image-segmentation-using-python.html)**  

该程序可以使用 Qualcomm Neural Processing SDK 和绑定的 Python 来执行图像分割，且全部在一个 Docker 容器中完成。

**Parent Topic:** [示例程序](https://docs.qualcomm.com/doc/80-70015-50SC/topic/example-applications.html)

**Related Resources**  

- [Qualcomm GStreamer 插件](https://docs.qualcomm.com/doc/80-70015-50SC/topic/qim-sdk-plugins.html)

Last Published: Nov 11, 2025

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