更新时间:2021-10-26 GMT+08:00
分享

转换离线模型

离线模型转换工具包含在DDK工具包内,位于目录“<$DDK_HOME>/uihost/bin/omg”下,OMG为命令行工具(可通过-h获得参数信息),用于实现caffe和tensorflow模型转换成Ascend 310支持的om文件。OMG工具的使用说明请参考《模型转换指导》中的“使用OMG工具转换模型”章节。

  1. caffe模型的转换:
    #omg --framework 0 --model <model.prototxt> --weight <model.caffemodel> --output <output name> --insert_op_conf <aipp.cfg>
  2. tensorflow模型的转换:
    #omg --framework 3 --model <model.pb> --input_shape “input_name:1,112,112,3” --output <output_name> --insert_op_conf <aipp.cfg>
    表1 参数说明

    参数

    说明

    framework=0

    指定为caffe模型。

    framework=3

    指定为tensorflow模型。

    model

    指定模型文件。

    weight

    指定caffe的权重文件。

    output

    支持输出om文件的文件名。

    input_shape

    指定输入层的名字和大小,tensorflow默认为“input_layer_name: n, h, w, c”。

    insert_op_conf

    指定AIPP的配置文件。

分享:

    相关文档

    相关产品