# 定制示例程序

Source: [https://docs.qualcomm.com/doc/80-70015-15BY/topic/customize-reference-app.html](https://docs.qualcomm.com/doc/80-70015-15BY/topic/customize-reference-app.html)

本节概述了开发者修改现有示例程序的步骤，以便现有示例程序能够与定制的训练模型配合使用。本指南以一个经过定制训练的 YoloV8 模型为例。

需要设置 eSDK (extensible SDK) 才能开发应用程序/插件代码。有关设置 eSDK 以及下载并编译源代码的说明，可参见 [编译应用程序和 Qualcomm IM SDK](https://docs.qualcomm.com/doc/80-70015-15BY/topic/compile-app-esdk.html) 章节。

有关如何下载源代码以及编译定制示例程序的说明，可参见 [创建自己的应用程序](https://docs.qualcomm.com/doc/80-70015-15BY/topic/esdk-create-own-app.html) 章节。

开发者必须先按 [这些](https://docs.qualcomm.com/doc/80-70015-15BY/topic/reference-app.html#concept_q4t_dqx_4bc__section_kps_5wh_qbc_spyrz_06-05-24-1202-58-937) 说明操作，然后才能继续进行下一步操作。

## 示例 1 - 定制训练的 YoloV8 TFLite 模型

Qualcomm IM SDK 示例程序使用 YoloV8 模型进行目标检测。在本示例中，我们将介绍如何尝试使用定制训练的 YoloV8 变体。

按以下步骤操作，通过现有示例程序来运行用户自己的定制训练的 YoloV8 模型。

1. 将示例程序中的现有模型替换为新模型。
2. 使用定制标签来修改标签文件。
3. 使用示例程序来运行修改后的模型。

**修改定制的 YoloV8 模型的标签**

使用 Qualcomm IM SDK 及其示例程序时，程序需要使用特定格式的标签。您需要更新此标签文件中每个标签的值 `<label_name>`、 `<hex_value_for_label_id>`和 `<hex_value_for_color> `。标签文件中每个标签的格式应遵循下方所示的模板。

    (structure)"<label_name>,id=(guint)<hex_value_for_label_id>,color=(guint)<hex_value_for_color>;"Copy to clipboard

示例：

    (structure)"person,id=(guint)0x0,color=(guint)0x00FF00FF;"
    (structure)"bicycle,id=(guint)0x1,color=(guint)0x00FF00FF;"
    (structure)"car,id=(guint)0x2,color=(guint)0x0000FFFF;"
    (structure)"motorcycle,id=(guint)0x3,color=(guint)0x00FF00FF;"Copy to clipboard

如需使用 TFLite runtime 运行目标检测模型，可在命令行参数中指定定制训练模型以及定制标签文件，然后运行以下命令。

    scp yolov8_custom.tflite root@<IP addr of the target device>:/opt/
    scp yolov8_custom.labels root@<IP addr of the target device>:/opt/
    
    # login into the device 
    ssh root@<IP addr of the target device>
    
    #run sample app 
    gst-ai-object-detection --ml-framework=2 –-yolo-model-type=2 --model=/opt/yolov8_custom.tflite --labels=/opt/yolov8_custom.labelsCopy to clipboard

## 备注

- 如需显示可用的帮助选项，可运行以下命令：

        gst-ai-object-detection -hCopy to clipboard
- 如需停止用例，可按下 **CTRL + C**。

Last Published: Jan 26, 2026

[Previous Topic
默认示例程序](https://docs.qualcomm.com/bundle/publicresource/80-70015-15BY/topics/reference-app.md) [Next Topic
开发您自己的应用程序](https://docs.qualcomm.com/bundle/publicresource/80-70015-15BY/topics/develop-own-app.md)