PaddleSeg
PaddleSeg copied to clipboard
导出onnx模型出错
问题确认 Search before asking
- [X] 我已经查询历史issue(包括open与closed),没有发现相似的bug。I have searched the open and closed issues and found no similar bug report.
Bug描述 Describe the Bug
(1)pointrend网络训练完成之后,导出模型没有问题. 运行配置及结果如下: (new_paddle) F:\CZM\CZM_paddleseg\PaddleSeg-release-2.9>python tools/export.py --config configs/pointrend/my_pointrend_resnet50_os8_voc12aug_512x512_40k.yml --model_path F:/CZM/CZM_paddleseg/PaddleSeg-release-2.9/output/pointrend2/iter_2000/model.pdparams --save_dir output/pointrend2/infer_model --input_shape 1 3 512 512
------------Environment Information------------- platform: Windows-10-10.0.19042-SP0 Python: 3.8.19 (default, Mar 20 2024, 19:55:45) [MSC v.1916 64 bit (AMD64)] Paddle compiled with cuda: True NVCC: Build cuda_12.1.r12.1/compiler.32415258_0 cudnn: 8.4 GPUs used: 1 CUDA_VISIBLE_DEVICES: None GPU: ['GPU 0: Quadro RTX'] PaddleSeg: 2.9.0 PaddlePaddle: 2.6.1 OpenCV: 4.5.5
2024-04-23 16:07:48 [INFO] ---------------Config Information--------------- batch_size: 8 iters: 160000 train_dataset: dataset_root: H:/qianbian mode: train num_classes: 2 train_path: H:/qianbian/train.txt transforms:
- target_size:
- 512
- 512 type: Resize
- type: RandomHorizontalFlip
- brightness_range: 0.4 contrast_range: 0.4 saturation_range: 0.4 type: RandomDistort
- type: Normalize type: Dataset val_dataset: dataset_root: H:/qianbian/images/validation_1024_1024 mode: val num_classes: 2 transforms:
- target_size:
- 512
- 512 type: Resize
- type: Normalize type: Dataset val_path: H:/qianbian/images/validation_1024_1024/val.txt optimizer: momentum: 0.9 type: SGD weight_decay: 0.0005 lr_scheduler: end_lr: 0 learning_rate: 0.01 power: 0.9 type: PolynomialDecay loss: coef:
- 1
- 1 types:
- type: CrossEntropyLoss
- type: PointCrossEntropyLoss model: backbone: output_stride: 8 pretrained: https://bj.bcebos.com/paddleseg/dygraph/resnet50_vd_ssld_v2.tar.gz type: ResNet50_vd backbone_indices:
- 0
- 1
- 2
- 3 num_classes: 2 type: PointRend
2024-04-23 16:07:48 [INFO] Use the following config to build model model: backbone: output_stride: 8 pretrained: https://bj.bcebos.com/paddleseg/dygraph/resnet50_vd_ssld_v2.tar.gz type: ResNet50_vd backbone_indices:
- 0
- 1
- 2
- 3 num_classes: 2 type: PointRend W0423 16:07:48.659368 27664 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 12.3, Runtime API Version: 11.7 W0423 16:07:48.659368 27664 gpu_resources.cc:164] device: 0, cuDNN Version: 8.4. 2024-04-23 16:07:49 [INFO] Loading pretrained model from https://bj.bcebos.com/paddleseg/dygraph/resnet50_vd_ssld_v2.tar.gz 2024-04-23 16:07:50 [INFO] There are 275/275 variables loaded into ResNet_vd. 2024-04-23 16:07:50 [INFO] Loaded trained params successfully. C:\Users\LBS\anaconda3\envs\new_paddle\lib\site-packages\paddle\jit\dy2static\program_translator.py:712: UserWarning: full_graph=False don't support input_spec arguments. It will not produce any effect. You can set full_graph=True, then you can assign input spec.
warnings.warn( C:\Users\LBS\anaconda3\envs\new_paddle\lib\site-packages\paddle\base\framework.py:3044: UserWarning: The Attr(force_cpu) of Op(fill_constant) will be deprecated in the future, please use 'device_guard' instead. 'device_guard' has higher priority when they are used at the same time. warnings.warn( C:\Users\LBS\anaconda3\envs\new_paddle\lib\site-packages\paddle\base\framework.py:3044: UserWarning: The Attr(force_cpu) of Op(fill_constant) will be deprecated in the future, please use 'device_guard' instead. 'device_guard' has higher priority when they are used at the same time. warnings.warn( I0423 16:07:58.537074 27664 program_interpreter.cc:212] New Executor is Running. 2024-04-23 16:08:00 [INFO] ---------------Deploy Information--------------- Deploy: input_shape:
- 1
- 3
- 512
- 512 model: model.pdmodel output_dtype: int32 output_op: argmax params: model.pdiparams transforms:
- target_size:
- 512
- 512 type: Resize
- type: Normalize
2024-04-23 16:08:00 [INFO] The inference model is saved in output/pointrend2/infer_model (2)导出onnx模型出错。 (new_paddle) F:\CZM\CZM_paddleseg\PaddleSeg-release-2.9>paddle2onnx --model_dir F:\CZM\CZM_paddleseg\PaddleSeg-release-2.9\output\pointren2\infer_model --model_filename model.pdmodel --params_filename model.pdiparams --opset_version 11 --save_file model_pointrend_10000.onnx [Paddle2ONNX] Start to parse PaddlePaddle model... [Paddle2ONNX] Model file path: F:\CZM\CZM_paddleseg\PaddleSeg-release-2.9\output\pointren2\infer_model\model.pdmodel [Paddle2ONNX] Paramters file path: F:\CZM\CZM_paddleseg\PaddleSeg-release-2.9\output\pointren2\infer_model\model.pdiparams [Paddle2ONNX] Start to parsing Paddle model... [Paddle2ONNX] Failed to read model file: F:\CZM\CZM_paddleseg\PaddleSeg-release-2.9\output\pointren2\infer_model\model.pdmodel, please make sure your model file or file path is valid. [Paddle2ONNX] Failed to load program of PaddlePaddle model. [Paddle2ONNX] Paddle model parsing failed. [Paddle2ONNX] Paddle model convert failed. 2024-04-23 16:08:20 [INFO] ===============Make PaddlePaddle Better!================ 2024-04-23 16:08:20 [INFO] A little survey: https://iwenjuan.baidu.com/?code=r8hu2s
显示无效的模型文件 请问是否有解决方案!
复现环境 Environment
PaddleSeg-release-2.9 paddle2onnx 1.0.6 paddlepaddle-gpu 2.6.1.post117
Bug描述确认 Bug description confirmation
- [X] 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.
是否愿意提交PR? Are you willing to submit a PR?
- [X] 我愿意提交PR!I'd like to help by submitting a PR!