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

ppv3_rec模型转换不成功 #50

Open
AstonyJ opened this issue Jul 14, 2022 · 11 comments
Open

ppv3_rec模型转换不成功 #50

AstonyJ opened this issue Jul 14, 2022 · 11 comments

Comments

@AstonyJ
Copy link

AstonyJ commented Jul 14, 2022

1、转换的pp模型链接:
https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_train.tar
2、运行脚本:
python ./converter/ch_ppocr_v3_rec_converter.py
3、报错:

Traceback (most recent call last):
File "./converter/ch_ppocr_v3_rec_converter.py", line 60, in load_paddle_weights
self.net.state_dict()[k].copy_(torch.Tensor(para_state_dict[ppname]))
KeyError: 'Student.backbone.conv1._conv.weight'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./converter/ch_ppocr_v3_rec_converter.py", line 94, in
converter = PPOCRv3RecConverter(cfg, paddle_pretrained_model_path)
File "./converter/ch_ppocr_v3_rec_converter.py", line 22, in init
self.load_paddle_weights([para_state_dict, opti_state_dict])
File "./converter/ch_ppocr_v3_rec_converter.py", line 64, in load_paddle_weights
print('paddle: {}, {}'.format(ppname, para_state_dict[ppname].shape))
KeyError: 'Student.backbone.conv1._conv.weight'

@frotms
Copy link
Owner

frotms commented Jul 14, 2022

python ./converter/ch_ppocr_v3_rec_converter.py --src_model_path paddle_ch_PP-OCRv3_rec_train_dir

@AstonyJ
Copy link
Author

AstonyJ commented Jul 14, 2022

python ./converter/ch_ppocr_v3_rec_converter.py --src_model_path paddle_ch_PP-OCRv3_rec_train_dir

我写到py文件里了:
image

@frotms
Copy link
Owner

frotms commented Jul 14, 2022

python ./converter/multilingual_ppocr_v3_rec_converter.py --src_model_path paddle_multilingual_PP-OCRv3_rec_train_dir

@AstonyJ
Copy link
Author

AstonyJ commented Jul 14, 2022

转换成功了 感谢

@AstonyJ
Copy link
Author

AstonyJ commented Jul 14, 2022

https://github.com/PaddlePaddle/PaddleOCR/blob/release%2F2.5/doc/doc_ch/algorithm_rec_svtr.md
请问该网页下的模型可以转换吗?
image

@frotms
Copy link
Owner

frotms commented Jul 14, 2022

暂时还没整理好,这周末看下

@AstonyJ
Copy link
Author

AstonyJ commented Jul 14, 2022

暂时还没整理好,这周末看下
嗯嗯 感谢呀 我也学习一下 看看能不能转成功

@frotms
Copy link
Owner

frotms commented Jul 16, 2022

@AstonyJ svtr已更新。但请注意paddle的nn.Dropout(p=last_drop, mode="downscale_in_infer")的"downscale_in_infer"参数

@AstonyJ
Copy link
Author

AstonyJ commented Jul 22, 2022

收到 已成功转换 感谢!

@BLMFY
Copy link

BLMFY commented Sep 30, 2022

所以楼主这个问题是怎么解决的呢,为什么会出现这个keyerror呢?

@yangy996
Copy link

转换成功了 感谢

楼主这个问题是怎么解决的呢,我现在转换也报这个错

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

No branches or pull requests

4 participants