frotms / PaddleOCR2Pytorch

PaddleOCR inference in PyTorch. Converted from [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)
Apache License 2.0
809 stars 159 forks source link

转换模型问题: list index out of range #46

Closed LightSun closed 2 years ago

LightSun commented 2 years ago

想把 paddle 的rec模型转化为pytorch. 遇到点问题

python3 ch_ppocr_v3_rec_converter.py --src_model_path ...../libs/paddle/paddle_ocr_module/ch_PP-OCRv3_rec_infer

Traceback (most recent call last):
  File "ch_ppocr_v3_rec_converter.py", line 93, in <module>
    converter = PPOCRv3RecConverter(cfg, paddle_pretrained_model_path)
  File "ch_ppocr_v3_rec_converter.py", line 14, in __init__
    out_channels = list(para_state_dict.values())[-1].shape[0]
IndexError: list index out of range

看起来像是模型不对,解压后模型文件inference.info, inference.pdiparams, inference.pdmodel 都放在 ch_PP-OCRv3_rec_infer目录下。我这是哪里不对?

frotms commented 2 years ago

要使用trained model

LightSun commented 2 years ago

@frotms 好的。我试下