This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TDA4VM:使用 edgeai-tidl-tools 针对 TDA4VM 的 AI 模型的量化、校准和编译

Guru**** 2576165 points
Other Parts Discussed in Thread: TDA4VM

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1570768/tda4vm-quantization-calibration-and-compilation-of-ai-models-for-tda4vm-using-edgeai-tidl-tools

器件型号:TDA4VM


工具/软件:

您好、

我使用 edgeai-tidl 工具设置 Docker。 我有一个对象识别模型 SSD_320_320.tflite、其图像为 320 x 320 并识别对象。 它可以识别 80 类 COCO 数据集。

我想对该模型以及通常用于在 TDA4VM 上部署的任何模型进行筛选、校准和编译、并在 PC 上进行仿真。  

我期待此主题提供全面的支持(从开始到结束)。

此致、

Vishnu

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好;

    感谢您问这个问题。  

    为了编译模型、我们建议使用 OSRT 流程。 此处提供了有关如何设置和运行该流程的链接。 您将需要编辑“model_configs.py"文件“文件以插入您的模型。 然后进行编译。

    https://github.com/TexasInstruments/edgeai-tidl-tools?tab=readme-ov-file#edgeai-tidl-tools

    此致

    Wen Li

      

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Wen :

    感谢您的答复。

    我已经介绍了 model_configs.py。 我无法理解该配置文件中大多数属性及其值的含义。 是否有任何资源可用于了解配置文件中的每个属性?

    此致、

    Vishnu

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Vishnu:

    指定的工程师已离开办公室、明天将回来。 感谢您的耐心。

    此致、

    Christina

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Christina:

    感谢您的确认。

    此致、

    Vishnu

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Vishnu:

    OSRT 流程中可用的选项(来自 ort/目录)位于 ../common_utils.py。  但一般而言、最好的启动方法是将配置从../ modle_configs.py 复制到您的模型中、例如:

    “cl-ort-resnet18-v1":“:create_model_config (
    Source=AttrDict (
    model_url=“git.ti.com/.../re
    推断形状=真、
    )、
    前进程=AttrDict(
    调整大小=256、
    作物=224、
    data_layout=“NCHW",“,</s>、
    resize_with_pad=False、
    REVERSE_CHANNES=False、
    )、
    Session=AttrDict(
    session_name=“onnxrt",“,</s>、
    model_path=os.path.join (models_base_path、“resnet18_opset9.onnx")“)、
    Input_Mean=[123.675,116116.28,103.53]、
    INPUT_SCALE=[0.017125、0.017507、0.017429]、
    Input_optimization=True、
    )、
    TASK_TYPE=“Classification",“,</s>、
    Extra_info=AttrDict (num_images=numImages、num_class=1000)、
    )、

    添加如上所示的部分并将  cl-ort-resnet18-v1 更改为 Vishnu-model 、然后在 model_path=os.path.join (models_base_path、“resnet18_opset9.onnx")“)中设置模型的路径。  首先只需更改这个值。  不要与../ common_utils.py 中的其他选项一团糟,直到这对您有用。   编译(从 ort/目录)、  

    python3 ./onnxrt_ep.py -c -m vishnu-model

    要运行:

    python3 ./ onnxrt_ep.py -m vishnu-model

    输出将在../../../model-artifacts/vishnu-model、../../../output_binaries 和../../../output_images 中提供

    希望这能让您快速上手。

    此致、

    Chris

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Chris   

    我遵循了你上面所说的步骤。 我通过添加如下所示的条目来更新 model_configs.py 文件=>

    “vishnu_model":“:create_model_config (
        task_type=“detection",“,</s>、
        Source=dict(
          model_url=“",“,</s>、
          推断形状=真、
      )、
      preproception=dict(
        调整大小=512、
        作物=512、
        data_layout=“NCHW",“,</s>、
        REVERSE_CHANNES=False、如果是 RGB 输入则#
        resize_with_pad=False、
      )、  
      Session=dict(
        session_name=“onnxrt",“,</s>、  
        model_path=os.path.join (models_base_path、“ssd_mobilenetv2_lite_512x512_20201214_model.onnx")“)、
        Input_Mean=[127.5127127.5127.5]、   
        INPUT_SCALE=[1/128.0、1/128.0、1/128.0]、
        Input_optimization=True、
      )、
      postprocess = dict (
        格式化板=“DetectionBox",“,</s>、
        detection_threshold=0.3、
        NMS_THRESHOLD=0.45、
        TOP_k=200、
      )、
      extra_info=dict (  
        num_images=numImages、
        NUM_CLASS=81、# 80 个 CLASS +后台
      )、
    )

    我已将 model_url 指定为空字符串。

    但我在执行“onnxrt_ep.py"时“时遇到错误

    出现的错误如下所示==>

    “"</s>“

    (Docker_env) root@14ba05668324:/home/root/examples/osrt_python/ort python3 onnxrt_ep.py -m Vishnu_model
    可用的执行提供程序:['TIDLExecutionProvider '、'TIDLCompilationProvider '、'CPUExecutionProvider ']

    运行 1 个模型-['Vishnu_model']


    Running_Model:vishnu_model

    但不具有
    vishnu_model 在模型配置的可用列表中找到 — dict_keys (['\n “cl-ort-resnet18-v1":“:create_model_config (\n task_type=“category",“,\n、\n source=dict (\n model_url=“ https://git.ti.com/cgit/jacinto-ai/jacinto-ai-modelzoo/plain/models/vision/classification/imagenet1k/torchvision/resnet18_opset9.onnx“,\n 0.017429]、\n input_optimization=True、\n)、\n postprocess=dict()、\n extra_info=dict (num_images=numImages、num_class=1000)、\n)、\n Vishnu_model'])
    外部
    处理过程 1:
    回溯(最近一次呼叫):
    在_sbootstrap 中输入/usr/lib/python3.10/multiprocessing/process.py 第 314 行
    self.run()
    文件“/usr/lib/python3.10/multiprocessing/process.py、第 108 行、运行中
    self._target (* self._args、** self._kwargs)
    文件“run_model 中的/home/root/examples/osrt_python/ort/onnxrt_ep.py 第 233 行
    config = models_configs[model]
    关键错误:“Vishnu_model"</s>“

    “"</s>“

    此致

    Vishnu K K

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好、Vishnu;

    似乎您无法单独编译模型。  

    您能否尝试编译“model_configs.py"中“中已有的模型之一?

    例如:

    python3 onnxrt_ep.py -c -m cl-ort-resnet18-v1.

    如果无法运行上述命令、您的 Docker 容器可能已损坏。 请启动新的 Docker。

    此致

    Wen Li