# 机器学习用例

Source: [https://docs.qualcomm.com/doc/80-70014-50Y/topic/machine-learning-use-cases.html](https://docs.qualcomm.com/doc/80-70014-50Y/topic/machine-learning-use-cases.html)

TensorFlow Lite runtime 和 Qualcomm Neural Processing SDK runtime 用于机器学习用例中的推理。

在执行用例之前，请完成 [GStreamer 命令行用例](https://docs.qualcomm.com/doc/80-70014-50Y/topic/gstreamer-application-use-cases.html) 中提到的前提条件。

AI 示例程序需要设备中的模型和标签文件才能运行程序。运行 AI 示例程序的先决条件如下：

如需将文件推送到设备，可在 Linux 主机上运行以下命令：

1. 下载模型和标签文件：

        wget https://github.com/quic/sample-apps-for-qualcomm-linux/releases/download/v0.1.0/v0.1.0.tar.gzCopy to clipboard
2. 提取文件：

        tar -zxvf v0.1.0.tar.gzCopy to clipboard
3. 将模型和标签文件推送到设备：

        scp -r v0.1.0/* root@<IP address of target device>:/opt/Copy to clipboard
4. 启用摄像头的 Permissive 模式：

        setenforce 0Copy to clipboard

所描述的用例使用 MobileNet TFLite 模型对场景、单个摄像头流进行分类，并叠加或组合分类标签。

1. 要生成 yolov5.tflite 模型，请创建 Python 3.8 虚拟环境：

        sudo apt-get install python3.8Copy to clipboard

        python3.8 -m venv py3.8Copy to clipboard

        source py3.8/bin/activateCopy to clipboard
2. 要生成 yolov5.tflite 模型，请运行以下命令：

        git clone https://github.com/ultralytics/yolov5.gitCopy to clipboard

        cd yolov5Copy to clipboard

        python -m pip install -r requirements.txt tensorflow-cpuCopy to clipboard

        python export.py --weights yolov5m.pt --img 320 --include tflite --int8 -- data data/coco128.yamlCopy to clipboard

        scp yolov5m-int8.tflite root@<IP address of the device>:/opt/yolov5.tfliteCopy to clipboard

YOLO-NAS 和 YOLOv5 模型在同一数据集上进行训练。也对 YOLOv5 使用相同的标签文件。

    ssh root@<ip-addr of the target device>aCopy to clipboard

    cp /opt/yolonas.labels /opt/yolov5.labelsCopy to clipboard

- **[TensorFlow Lite 用例](https://docs.qualcomm.com/doc/80-70014-50Y/topic/tensorflow-lite-use-cases.html)**  

TensorFlow Lite 是一套可帮助开发人员在移动、嵌入式和边缘设备上运行模型，从而实现设备端机器学习的工具。借助 TensorFlow lite 用例，可以运行图像分类、目标检测、图像分割和姿势估计的用例。
- **[Qualcomm Neural Processing SDK 用例](https://docs.qualcomm.com/doc/80-70014-50Y/topic/qualcomm-neural-processing-sdk-use-cases.html)**  

Qualcomm Neural Processing SDK（原称为 Qualcomm Snapdragon Neural Processing Engine (SNPE)）用于执行深度神经网络进行推理。这些用例描述了使用不同 ML 模型的图像分类、目标检测和图像分割场景。

**Parent Topic:** [GStreamer 命令行用例](https://docs.qualcomm.com/doc/80-70014-50Y/topic/gstreamer-application-use-cases.html)

Last Published: Nov 11, 2025

[Previous Topic
GStreamer 命令行用例](https://docs.qualcomm.com/bundle/publicresource/80-70014-50Y/topics/gstreamer-application-use-cases.md) [Next Topic
TensorFlow Lite 用例](https://docs.qualcomm.com/bundle/publicresource/80-70014-50Y/topics/tensorflow-lite-use-cases.md)