Paddle2ONNX icon indicating copy to clipboard operation
Paddle2ONNX copied to clipboard

blazeface_keypoint模型转ONNX失败

Open jiangjiajun opened this issue 5 years ago • 1 comments

0.4版本,命令和错误如下

(paddle) BDSZYF000132754:dcn jiangjiajun$ paddle2onnx --model_dir /Users/jiangjiajun/Downloads/inference_model/blazeface_keypoint/ --model_filename __model__.paddle --params_filename __params__ --save_file solov2.onnx --opset_version 10
Traceback (most recent call last):
  File "/Users/jiangjiajun/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle2onnx/op_mapper/op_mapper.py", line 91, in mapping
    mapper_func(graph, node, **kw)
  File "/Users/jiangjiajun/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle2onnx/op_mapper/detection/prior_box.py", line 89, in opset_9
    out_boxes = np.zeros(out_dim).astype('float32')
ValueError: negative dimensions are not allowed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jiangjiajun/anaconda3/envs/paddle/bin/paddle2onnx", line 8, in <module>
    sys.exit(main())
  File "/Users/jiangjiajun/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle2onnx/command.py", line 139, in main
    enable_onnx_checker=args.enable_onnx_checker)
  File "/Users/jiangjiajun/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle2onnx/command.py", line 111, in program2onnx
    enable_onnx_checker=enable_onnx_checker)
  File "/Users/jiangjiajun/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle2onnx/convert.py", line 74, in program2onnx
    export_onnx(paddle_graph, save_file, opset_version, enable_onnx_checker)
  File "/Users/jiangjiajun/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle2onnx/convert.py", line 30, in export_onnx
    onnx_graph = ONNXGraph.build(paddle_graph, opset_version, verbose)
  File "/Users/jiangjiajun/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle2onnx/graph/onnx_graph.py", line 162, in build
    status = OpMapper.mapping(onnx_graph, node)
  File "/Users/jiangjiajun/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle2onnx/op_mapper/op_mapper.py", line 96, in mapping
    format(node.layer_name, node.type, node.inputs, node.outputs))
Exception: Error happened when mapping node ['prior_box@0'] to onnx, which op_type is 'prior_box' with inputs: {'Image': ['image'], 'Input': ['elementwise_add_7.tmp_1']} and outputs: {'Boxes': ['prior_box_0.tmp_0'], 'Variances': ['prior_box_0.tmp_1']}

模型文件 链接: https://pan.baidu.com/s/1LRzTSJwsLOul99Tj5_43wQ 密码: d3dg --来自百度网盘超级会员V5的分享

jiangjiajun avatar Dec 10 '20 02:12 jiangjiajun

@jiangjiajun 目前prior_box的转换依赖输入的shape来生成,所以需要输入的shape是固定的,考虑未来支持动态输入

Channingss avatar Jan 07 '21 06:01 Channingss

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jul 09 '25 03:07 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jul 23 '25 03:07 github-actions[bot]