PaddleDetection icon indicating copy to clipboard operation
PaddleDetection copied to clipboard

ppyolo模型转化为onnx后infer_shapes失败

Open coffezhou opened this issue 2 years ago • 2 comments

问题确认 Search before asking

  • [X] 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

ppyolo_mbv3_large_coco模型转化为onnx后infer_shapes失败,报如下错误: onnx.onnx_cpp2py_export.shape_inference.InferenceError: [ShapeInferenceError] (op_type:Gather, node name: Gather_12): [ShapeInferenceError] Inferred shape and existing shape differ in dimension 0: (1) vs (-1) 同时,使用TVM加载转化后onnx模型,也无法通过,报如下错误: Check failed: *axis_ptr == 1 (-1 vs. 1) : cannot squeeze axis with dimension not equal to 1

但是,使用onnx的check_model对模型进行验证,一切正常。 所以不知道上述问题是什么原因造成的,还是说转化过程需要什么特别操作。 转化步骤参考了EXPORT_ONNX_MODEL.md中的步骤。 其余模型如ppyolov2_r50vd_dcn_365e_coco同样存在这个问题。 环境: OS:ubuntu 18.04 paddle2onnx:0.9.8/1.0.0rc onnx:1.11/1.12

coffezhou avatar Jul 17 '22 09:07 coffezhou

你好,请问运行的命令是什么?

wangxinxin08 avatar Jul 18 '22 06:07 wangxinxin08

@wangxinxin08 我在导出human det的模型的时候碰到同样的shape问题 python tools/export_model.py -c configs/pphuman/ppyoloe_crn_s_36e_crowdhuman.yml -o weights=output_inference/mot_ppyoloe_s_36e_pipeline/mot_ppyoloe_s_36e_pipeline.pdparams --output_dir export

然后使用paddle2onnx --model_dir . --model_filename model.pdmodel --params_filename model.pdiparams --save_file model.onnx --enable_dev_version True --opset_version 15 --input_shape_dict="{'image': [1,3,640,640], 'scale_factor':[1, 2]}"导出onnx 使用onnxruntime加载时出下面错误,都是使用最新版本代码 image

mmxuan18 avatar Jul 28 '22 03:07 mmxuan18

Hi, was the issue somehow resolved? I'm seeing the same problem while converting pp models to onnx with paddle2onnx converter

derrkater avatar Oct 13 '22 12:10 derrkater