BADBADBADBOY / pytorchOCR

基于pytorch的ocr算法库,包括 psenet, pan, dbnet, sast , crnn
676 stars 133 forks source link

onnx模型 #47

Closed VixeruntR closed 3 years ago

VixeruntR commented 3 years ago

python ./script/pytorch_to_onnx.py --config ./config/det_DB_mobilev3.yaml --model_path ./checkpoint/ag_DB_bb_mobilenet_v3_small_he_DB_Head_bs_16_ep_400/DB_71.pth.tar --img_path /home/demo.jpg --save_path ./onnx/DB_mobilev3.onnx --batch_size 1 --max_size 1536 --algorithm DB --add_padding

python3 ./tools/det_infer.py --config ./config/det_DB_mobilev3.yaml --model_path ./checkpoint/ag_DB_bb_mobilenet_v3_small_he_DB_Head_bs_16_ep_400/DB_71.pth.tar --img_path /home/demo.jpg --result_save_path ./result --onnx_path ./onnx/DBnet.onnx --batch_size 2 --max_size 1536 --add_padding

作者你好,我按照上面的命令转出了onnx模型并使用onnx模型预测,报了如下错误: return self._sess.run(output_names, input_feed, run_options) onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: input for the following indices index: 2 Got: 1536 Expected: 736 Please fix either the inputs or the model.

请问这个是哪里出了问题呢?

fxwfzsxyq commented 3 years ago

似乎是维度不匹配,不加--add_padding 试试

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年8月6日(星期五) 中午11:11 收件人: @.>; 抄送: @.***>; 主题: [BADBADBADBOY/pytorchOCR] onnx模型 (#47)

python ./script/pytorch_to_onnx.py --config ./config/det_DB_mobilev3.yaml --model_path ./checkpoint/ag_DB_bb_mobilenet_v3_small_he_DB_Head_bs_16_ep_400/DB_71.pth.tar --img_path /home/demo.jpg --save_path ./onnx/DB_mobilev3.onnx --batch_size 1 --max_size 1536 --algorithm DB --add_padding

python3 ./tools/det_infer.py --config ./config/det_DB_mobilev3.yaml --model_path ./checkpoint/ag_DB_bb_mobilenet_v3_small_he_DB_Head_bs_16_ep_400/DB_71.pth.tar --img_path /home/demo.jpg --result_save_path ./result --onnx_path ./onnx/DBnet.onnx --batch_size 2 --max_size 1536 --add_padding

作者你好,我按照上面的命令转出了onnx模型并使用onnx模型预测,报了如下错误: return self._sess.run(output_names, input_feed, run_options) onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: input for the following indices index: 2 Got: 1536 Expected: 736 Please fix either the inputs or the model.

请问这个是哪里出了问题呢?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

nissansz commented 11 months ago

有onnx模型分享下载地址吗?怎么使用onnx模型?