PaddleDetection模型转onnx报错
Created by: JerryDeepl
版本:
paddle2onnx 0.2
paddlepaddle-gpu 1.7.2.post107
PaddleDetection release/0.2
onnx 1.6.0(1.5.0也试过)
模型:
python -u tools/train.py -c configs/yolov3_mobilenet_v1_fruit.yml \
--use_tb=True \
--tb_log_dir=tb_fruit_dir/scalar \
--eval
python tools/export_model.py -c configs/yolov3_mobilenet_v1_voc.yml \
--output_dir=./inference_model \
-o weights=output/yolov3_mobilenet_v1_voc \
TestReader.inputs_def.image_shape=[3,320,320]
转换:
paddle2onnx --fluid_model inference_model/yolov3_mobilenet_v1_fruit \
--onnx_model inference_model/yolo_fruit.onnx \
--fluid_model_name __model__ \
--fluid_params_name __params__
报错:
----------- Configuration Arguments -----------
check_task: image_classification
debug: False
fluid_model: inference_model/yolov3_mobilenet_v1_fruit
fluid_model_name: __model__
fluid_params_name: __params__
image_path:
name_prefix:
onnx_model: inference_model/yolo_fruit.onnx
return_variable: False
to_print_model: False
------------------------------------------------
load the model parameter done.
/home/codeadmin/.local/lib/python3.7/site-packages/fluid_onnx/detection_ops.py:845: UserWarning: The parameter normalized of multiclass_nms OP of Paddle is False, which has diff with ONNX. Please set normalized=True in multiclass_nms of Paddle
Please set normalized=True in multiclass_nms of Paddle')
The operator sets to run test case.
{'nearest_interp', 'transpose2', 'batch_norm', 'concat', 'multiclass_nms', 'yolo_box', 'depthwise_conv2d', 'leaky_relu', 'elementwise_add', 'relu', 'conv2d'}
Traceback (most recent call last):
File "/home/codeadmin/.local/bin/paddle2onnx", line 8, in <module>
sys.exit(main())
File "/home/codeadmin/.local/lib/python3.7/site-packages/fluid_onnx/fluid_to_onnx.py", line 230, in main
convert(args)
File "/home/codeadmin/.local/lib/python3.7/site-packages/fluid_onnx/fluid_to_onnx.py", line 194, in convert
checker.check_model(onnx_model)
File "/home/codeadmin/.local/lib/python3.7/site-packages/onnx/checker.py", line 86, in check_model
C.check_model(model.SerializeToString())
onnx.onnx_cpp2py_export.checker.ValidationError: Node () has input size 0 not in range [min=1, max=1].
==> Context: Bad node spec: output: "nearest_interp_0.tmp_0@out_size_f" op_type: "Cast" attribute { name: "to" i: 1 type: INT }