PaddleOCR2Pytorch
PaddleOCR2Pytorch copied to clipboard
Multilingual Detection Model convert Fail
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.
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