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

Multilingual Detection Model convert Fail #57

Open
gamegrd opened this issue Sep 15, 2022 · 1 comment
Open

Multilingual Detection Model convert Fail #57

gamegrd opened this issue Sep 15, 2022 · 1 comment

Comments

@gamegrd
Copy link

gamegrd commented Sep 15, 2022

Hi Everyone
I got an error when convert the Multilingual Detection Model

BASE INFO

model: ml_PP-OCRv3_det
config: ch_PP-OCRv3_det_cml.yml

command

python3 ./converter/ch_ppocr_v3_det_converter.py --src_model_path ./downloads/Multilingual_PP-OCRv3_det_distill_train

ERROR

paddle weights loading...
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
paddle: Student2.backbone.conv.conv.weight ---- (8, 3, 3, 3)
paddle: Student.backbone.conv.conv.weight ---- (8, 3, 3, 3)
paddle: Student2.backbone.conv.bn.weight ---- (8,)
paddle: Student.backbone.conv.bn.weight ---- (8,)
paddle: Student2.backbone.conv.bn.bias ---- (8,)
paddle: Student.backbone.conv.bn.bias ---- (8,)
paddle: Student2.backbone.conv.bn._mean ---- (8,)
... 
...
...
pytorch: head.thresh.conv_bn2.bias ---- torch.Size([24])
pytorch: head.thresh.conv_bn2.running_mean ---- torch.Size([24])
pytorch: head.thresh.conv_bn2.running_var ---- torch.Size([24])
pytorch: head.thresh.conv_bn2.num_batches_tracked ---- torch.Size([])
pytorch: head.thresh.conv3.weight ---- torch.Size([24, 1, 2, 2])
pytorch: head.thresh.conv3.bias ---- torch.Size([1])
pytorch: backbone.stages.1.0.mid_se.conv1.weight, torch.Size([10, 40, 1, 1])
Traceback (most recent call last):
  File "./converter/ch_ppocr_v3_det_converter.py", line 51, in load_paddle_weights
    self.net.state_dict()[k].copy_(torch.Tensor(para_state_dict[ppname]))
KeyError: 'Student2.backbone.stage1.0.mid_se.conv1.weight'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./converter/ch_ppocr_v3_det_converter.py", line 73, in <module>
    converter = PPOCRv3DetConverter(cfg, paddle_pretrained_model_path)
  File "./converter/ch_ppocr_v3_det_converter.py", line 13, in __init__
    self.load_paddle_weights(paddle_pretrained_model_path)
  File "./converter/ch_ppocr_v3_det_converter.py", line 54, in load_paddle_weights
    print('paddle: {}, {}'.format(ppname, para_state_dict[ppname].shape))
KeyError: 'Student2.backbone.stage1.0.mid_se.conv1.weight'

Thank you guys.

@frotms
Copy link
Owner

frotms commented Sep 29, 2022

Model is saved: multilingual_ptocr_v3_det_infer.pth without error when I use python3 ./converter/ch_ppocr_v3_det_converter.py --src_model_path ./downloads/Multilingual_PP-OCRv3_det_distill_train

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

2 participants