# 下载模型和标签文件

Source: [https://docs.qualcomm.com/doc/80-70018-50SC/topic/download-model-and-label-files.html](https://docs.qualcomm.com/doc/80-70018-50SC/topic/download-model-and-label-files.html)

下载 QCS6490、QCS9075 和 QCS8275 的模型和标签文件，以运行 AI/ML 示例应用程序。

在 Linux 主机上执行以下操作：
1. 启用 SSH 并连接至 Wi-Fi。有关说明，请参阅[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-254/how_to.html#use-ssh)。
Note: 如果已启用 SSH 并且已连接 Wi-Fi，请跳过此步骤。
2. 使用 SSH 登录目标设备：

        ssh root@<ip address of target device>Copy to clipboard
3. 下载自动化脚本，用于将模型和标签文件下载到目标设备上的 etc/models 和 etc/labels 目录：

        curl -L -O https://raw.githubusercontent.com/quic/sample-apps-for-qualcomm-linux/refs/heads/main/download_artifacts.shCopy to clipboard

Note: 在目标设备上运行此脚本。确保目标设备具有有效的互联网连接。
4. 设置脚本权限：

        chmod +x download_artifacts.shCopy to clipboard
5. 提供所需的参数来运行脚本，在目标设备上下载模型和标签文件：

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

    这里，将 `<soc name>` 替换为 `QCS6490`、`QCS9075` 或 `QCS8275`。
6. YOLOv8 和 YOLO-NAS 模型默认不可用。您可以使用以下选项，使用脚本下载模型或使用 AI Hub API 导出模型。
                                
    如果使用的是[多流批量推理](https://docs.qualcomm.com/doc/80-70018-50SC/topic/multistream-batch-inference.html)应用程序，则可以生成批量模型。

    - 使用脚本下载模型：
        1. 创建 [Qualcomm AI Hub
                                        帐户](https://app.aihub.qualcomm.com/account/)。
        2. 选择账户名，然后转到右上角的 Settings，选择 API
                                        令牌。
        3. 在 Linux
                                            主机上导出模型并设置所需的权限：

                curl -L -O https://raw.githubusercontent.com/quic/sample-apps-for-qualcomm-linux/refs/heads/main/scripts/export_model.shCopy to clipboard

                chmod +x export_model.shCopy to clipboard

            将
                                                <var class="keyword varname">API_TOKEN</var>
                                        替换为所选密钥：

                ./export_model.sh --api-token=<API_TOKEN>Copy to clipboard
    - 使用 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
7. 更新 JSON 文件中量化 LiteRT 模型的 `q_offset` 和 `q_scale` 常量。有关说明，请参阅[获取模型常数](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-15B/integrate-ai-hub-models.html#obtain-model-constants)。

如果下载脚本文件后某些模型不可用，您可以从 [IoT–Qualcomm AI Hub](https://aihub.qualcomm.com/iot/models/) 下载模型并将其推送到目标设备：

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

例如：

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

Note: 如果要从 UART shell 运行示例应用程序，请在目标设备上使用以下命令重新挂载文件系统以获取读写权限：

    mount -o remount,rw /usrCopy to clipboard

**Parent Topic:** [运行 AI/ML 示例应用程序](https://docs.qualcomm.com/doc/80-70018-50SC/topic/ai-ml-sample-applications.html)

Last Published: Nov 12, 2025

[Previous Topic
运行 AI/ML 示例应用程序](https://docs.qualcomm.com/bundle/publicresource/80-70018-50SC/topics/ai-ml-sample-applications.md) [Next Topic
图像分类](https://docs.qualcomm.com/bundle/publicresource/80-70018-50SC/topics/gst-ai-classification.md)