PaddleOCR2Pytorch icon indicating copy to clipboard operation
PaddleOCR2Pytorch copied to clipboard

Error converting model form paddleOCR

Open xellDart opened this issue 3 years ago • 1 comments

HI, thanks for your work!!

I have probela, I try to convert this model:

https://github.com/PaddlePaddle/PaddleOCR/#%EF%B8%8F-pp-ocr-series-model-listupdate-on-september-8th

Chinese and English ultra-lightweight PP-OCRv3 model(16.2M) and English ultra-lightweight PP-OCRv3 model(13.4M

Using: python3 converter/ch_ppocr_v3_rec_converter.py --src_model_path models/ch_PP-OCRv3_rec_slim_train

But I get

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 93, in <module>
    converter = PPOCRv3RecConverter(cfg, paddle_pretrained_model_path)
  File "converter/ch_ppocr_v3_rec_converter.py", line 20, 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'

How I can fix this?

Thanks

xellDart avatar Sep 11 '22 07:09 xellDart

@xellDart I cannot find where models/ch_PP-OCRv3_rec_slim_train is in https://github.com/PaddlePaddle/PaddleOCR/#%EF%B8%8F-pp-ocr-series-model-listupdate-on-september-8th

frotms avatar Sep 29 '22 16:09 frotms