使用动态分辨率参数转模型时,其他档位设置了-1,模型转换失败
2023/09/12
286
问题信息
问题来源 | 产品大类 | 产品子类 | 关键字 |
---|---|---|---|
官方 | 模型推理 | 模型转换 | ATC、模型转换、动态分辨率、动态维度、shape分档 |
问题现象描述
使用ATC工具进行模型转换时,使用--dynamic_image_size参数转换支持多个分辨率的模型,提示E10019报错信息。
atc --model=./resnet50_tensorflow_1.7.pb --input_shape="Placeholder:-1,-1,-1,3" --dynamic_image_size="448,448;224,224" --soc_version=Ascend310 --output=./out/test --framework=3
报错信息如下:
ATC run failed, Please check the detail log, Try 'atc --help' for more information E10019: When [--dynamic_image_size] is included, only the height and width axes can be –1 in [--input_shape]. Possible Cause: When [--dynamic_image_size] is included, only the height and width axes can be –1 in the shape. Solution: Try again with a valid [--input_shape] argument. Make sure that axes other than height and width are not –1.
原因分析
使用ATC工具进行模型转换,如果使用了--dynamic_image_size参数,shape中只有H、W支持设置为"-1",且只支持format为NCHW、NHWC格式;其他format场景,设置分辨率请使用--dynamic_dims参数。上述模型转换命令,shape中N、H、W都设置了"-1",不符合参数设置要求。
解决措施
重新设置模型转换时的参数信息,只设置shape中的H,W为"-1"。改后样例如下:
atc --model=./resnet50_tensorflow_1.7.pb --input_shape="Placeholder:1,-1,-1,3" --dynamic_image_size="448,448;224,224" --soc_version=Ascend310 --output=./out/test --framework=3
本页内容