Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matting项目下,paddle模型转onnx模型后,推理结果有偏差,以及不指定inputshape,模型转换会报错问题 #3688

Open
1 task done
wangkd0 opened this issue Apr 3, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@wangkd0
Copy link

wangkd0 commented Apr 3, 2024

问题确认 Search before asking

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

请提出你的问题 Please ask your question

我尝试使用项目中的例子执行:
python tools/predict.py --config configs/ppmattingv2/ppmattingv2-stdc1-human_512.yml --model_path pretrained_models/ppmattingv2-stdc1-human_512.pdparams --image_path demo/1.jpg --save_dir ./output/results --fg_estimate True
得到的图像alpha值和前景图准确度很高,但当我使用下列两行命令转出onnx模型后,再利用djl框架进行推理时,和之前得到的结果是不同的,需要先对图片进行预处理吗
(1)python tools/export.py --config configs/ppmattingv2/ppmattingv2-stdc1-human_512.yml --model_path pretrained_models/ppmattingv2-stdc1-human_512.pdparams --save_dir output/inference_model --input_shape 1 3 1024 1024
(2)paddle2onnx --model_dir inference_model --model_filename model.pdmodel --params_filename model.pdiparams --opset_version 11 --save_file output1.onnx

想请教一下:
执行导出命令时,能否不指定--input_shape 1 3 1024 1024,怎么能动态根据输入图片的大小进行处理,因为Matting示例下是根据输入照片自动处理的,但是上面导出转化命令行,不指定该值,执行paddle2onnx转换时会报错

@wangkd0 wangkd0 added the question Further information is requested label Apr 3, 2024
@shiyutang
Copy link
Collaborator

你好,可以看到这里是导出后并进行推理时出现精度异常,由于动态图模型精度正确,说明是paddle2onnx或者推理框架出现错误,请尝试切换不同的推理后端获得正确精度。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants