Giter Club home page Giter Club logo

paddleocr2pytorch's Introduction

简体中文 | English

简介

”白嫖“PaddleOCR

本项目旨在:

  • 学习PaddleOCR
  • 让PaddleOCR训练的模型在pytorch上使用
  • 为paddle转pytorch提供参考

注意

PytorchOCRPaddleOCRv2.0+动态图版本移植。

近期更新

  • 2024.02.20 PP-OCRv4,提供mobile和server两种模型
    • PP-OCRv4-mobile:速度可比情况下,中文场景效果相比于PP-OCRv3再提升4.5%,英文场景提升10%,80语种多语言模型平均识别准确率提升8%以上
    • PP-OCRv4-server:发布了目前精度最高的OCR模型,中英文场景上检测模型精度提升4.9%, 识别模型精度提升2%
  • 2023.04.16 公式识别CAN
  • 2023.04.07 文本超分Text Telescope
  • 2022.10.17 文本识别:ViTSTR
  • 2022.10.07 文本检测:DB++
  • 2022.07.24 文本检测算法(FCENET)
  • 2022.07.16 文本识别算法(SVTR)
  • 2022.06.19 文本识别算法(SAR)
  • 2022.05.29 PP-OCRv3,速度可比情况下,中文场景效果相比于PP-OCRv2再提升5%,英文场景提升11%,80语种多语言模型平均识别准确率提升5%以上
  • 2022.05.14 PP-OCRv3文本检测模型
  • 2022.04.17 1种文本识别算法(NRTR)
  • 2022.03.20 1种文本检测算法(PSENet)
  • 2021.09.11 PP-OCRv2,CPU推理速度相比于PP-OCR server提升220%;效果相比于PP-OCR mobile 提升7%
  • 2021.06.01 更新SRN
  • 2021.04.25 更新AAAI 2021论文端到端识别算法PGNet
  • 2021.04.24 更新RARE
  • 2021.04.12 更新STARNET
  • 2021.04.08 更新DB, SAST, EAST, ROSETTA, CRNN
  • 2021.04.03 更新多语言识别模型,目前支持语种超过27种,多语言模型下载,包括中文简体、中文繁体、英文、法文、德文、韩文、日文、意大利文、西班牙文、葡萄牙文、俄罗斯文、阿拉伯文等,后续计划可以参考多语言研发计划
  • 2021.01.10 白嫖中英文通用OCR模型

特性

高质量推理模型,准确的识别效果

  • 超轻量PP-OCR系列:检测+ 方向分类器+ 识别
  • 超轻量ptocr_mobile移动端系列
  • 通用ptocr_server系列
  • 支持中英文数字组合识别、竖排文本识别、长文本识别
  • 支持多语言识别:韩语、日语、德语、法语等

模型列表(更新中)

PyTorch模型下载链接:https://pan.baidu.com/s/1r1DELT8BlgxeOP2RqREJEg 提取码:6clx

PaddleOCR模型百度网盘链接:https://pan.baidu.com/s/1getAprT2l_JqwhjwML0g9g 提取码:lmv7

更多模型下载(包括多语言),可以参考PT-OCR v2.0 系列模型下载

文档教程

TODO

  • 前沿算法:文本检测 DRRG,文本识别 RFL
  • 文本识别:ABINet, VisionLAN, SPIN, RobustScanner
  • 表格识别:TableMaster
  • PP-Structurev2,系统功能性能全面升级,适配中文场景,新增支持版面复原,支持一行命令完成PDF转Word
  • 版面分析模型优化:模型存储减少95%,速度提升11倍,平均CPU耗时仅需41ms
  • 表格识别模型优化:设计3大优化策略,预测耗时不变情况下,模型精度提升6%
  • 关键信息抽取模型优化:设计视觉无关模型结构,语义实体识别精度提升2.8%,关系抽取精度提升9.1%
  • 文本识别算法(SEED)
  • 文档结构化算法关键信息提取算法(SDMGR)
  • 3种DocVQA算法(LayoutLM、LayoutLMv2,LayoutXLM)
  • 文档结构分析PP-Structure工具包,支持版面分析与表格识别(含Excel导出)

PP-OCRv2 Pipline

[1] PP-OCR是一个实用的超轻量OCR系统。主要由DB文本检测、检测框矫正和CRNN文本识别三部分组成。该系统从骨干网络选择和调整、预测头部的设计、数据增强、学习率变换策略、正则化参数选择、预训练模型使用以及模型自动裁剪量化8个方面,采用19个有效策略,对各个模块的模型进行效果调优和瘦身(如绿框所示),最终得到整体大小为3.5M的超轻量中英文OCR和2.8M的英文数字OCR。更多细节请参考PP-OCR技术方案 https://arxiv.org/abs/2009.09941

[2] PP-OCRv2在PP-OCR的基础上,进一步在5个方面重点优化,检测模型采用CML协同互学习知识蒸馏策略和CopyPaste数据增广策略;识别模型采用LCNet轻量级骨干网络、UDML 改进知识蒸馏策略和Enhanced CTC loss损失函数改进(如上图红框所示),进一步在推理速度和预测效果上取得明显提升。更多细节请参考PP-OCRv2技术报告

效果展示

  • 中文模型
  • 英文模型
  • 其他语言模型

参考

paddleocr2pytorch's People

Contributors

frotms avatar satchelwu avatar sophon-chenxiliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paddleocr2pytorch's Issues

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

想把 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目录下。我这是哪里不对?

文字检测报错

按照测试的方法来,报错
python3 ./tools/infer/predict_rec.py --image_dir ./doc/imgs_words --model_path your_rec_pth_path.pth

报错:系统错误找不到指定模块

使用英文模型, 识别结果为中文的情况

作者好, 我尝试用 ./tools/infer/predict_system.py 来串联识别英文, 检测模型用的是en_ptocr_v3_det_infer.pth, 识别模型分别试用了en_ptocr_v3_rec_infer.pthen_number_mobile_v2.0_rec_infer.pth, 但是返回的结果都是中文~

dt_boxes num : 2, elapse : 0.0470426082611084
rec_res num  : 2, elapse : 0.06331539154052734
Predict time of ../tess_train/data/1.jpg: 0.112s
房韵, 0.996
rec_res num  : 2, elapse : 0.06833672523498535
Predict time of ../tess_train/data/1.jpg: 0.127s
房韵, 0.755

求助~

Data loader

Can you share the dataloader (simple_dataset as well as lmdb_dataset) implemented in pytorch in data module and the loss function as well. I was able to reimplemented but can't reproduce the result

使用SRN识别模型出错

使用SRN模型识别时,在rec_postprocess.py文件报错:
2022_05_27_16_37_11
看起来是字典不对?我用的是ppocr_keys_v1.txt这个字典。
附rec参数:

params for text recognizer

parser.add_argument("--rec_algorithm", type=str, default='SRN')
parser.add_argument("--rec_model_path", type=str, default='./weights/rec_r50_vd_srn_infer.pth')
parser.add_argument("--rec_image_shape", type=str, default="1, 64, 256")
parser.add_argument("--rec_char_type", type=str, default='en')
parser.add_argument("--rec_batch_num", type=int, default=6)
parser.add_argument("--max_text_length", type=int, default=25)

parser.add_argument("--use_space_char", type=str2bool, default=True)
parser.add_argument("--drop_score", type=float, default=0.5)
parser.add_argument("--limited_max_width", type=int, default=1280)
parser.add_argument("--limited_min_width", type=int, default=16)

parser.add_argument(
    "--vis_font_path", type=str,
    default=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'doc/fonts/simfang.ttf'))
parser.add_argument(
    "--rec_char_dict_path",
    type=str,
    default=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
                         'pytorchocr/utils/ppocr_keys_v1.txt'))

params .yaml

parser.add_argument("--det_yaml_path", type=str, default=None)
parser.add_argument("--rec_yaml_path", type=str, default="./configs/rec/rec_r50_fpn_srn.yml")
parser.add_argument("--cls_yaml_path", type=str, default=None)
parser.add_argument("--e2e_yaml_path", type=str, default=None)

python ./tools/infer/predict_system.py

执行 :
python ./tools/infer/predict_system.py --image_dir ./doc/imgs --det_model_path .\models\det_r50_vd_east_v2.0_infer.pth --rec_model_path .\models\rec_r50_vd_srn_i
nfer.pth

报错:
{'model_name': 'large', 'in_channels': 128}
model is loaded: .\models\det_r50_vd_east_v2.0_infer.pth
{'fc_decay': 4e-05, 'in_channels': 96}
Traceback (most recent call last):
File "./tools/infer/predict_system.py", line 171, in
main(utility.parse_args())
File "./tools/infer/predict_system.py", line 128, in main
text_sys = TextSystem(args)
File "./tools/infer/predict_system.py", line 25, in init
self.text_recognizer = predict_rec.TextRecognizer(args, **kwargs)
File "D:\workspace\python\torch11\PaddleOCR2Pytorch-main\tools\infer\predict_rec.py", line 63, in init
self.load_state_dict(weights)
File "D:\workspace\python\torch11\PaddleOCR2Pytorch-main\pytorchocr\base_ocr_v20.py", line 70, in load_state_dict
self.net.load_state_dict(weights)
File "C:\Users\conf.conda\envs\pytorch-gpu-11\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for BaseModel:
Missing key(s) in state_dict: "backbone.conv1.conv.weight", "backbone.conv1.bn.weight", "backbone.conv1.bn.bias", "backbone.conv1.bn.running_mean", "backbone.conv1.bn.runnin
g_var", "backbone.blocks.0.expand_conv.conv.weight", "backbone.blocks.0.expand_conv.bn.weight", "backbone.blocks.0.expand_conv.bn.bias", "backbone.blocks.0.expand_conv.bn.running_me
an", "backbone.blocks.0.expand_conv.bn.running_var", "backbone.blocks.0.bottleneck_conv.conv.weight", "backbone.blocks.0.bottleneck_conv.bn.weight", "backbone.blocks.0.bottleneck_co
nv.bn.bias", "backbone.blocks.0.bottleneck_conv.bn.running_mean", "backbone.blocks.0.bottleneck_conv.bn.running_var", "backbone.blocks.0.mid_se.conv1.weight", "backbone.blocks.0.mid
se.conv1.bias", "backbone.blocks.0.mid_se.conv2.weight", "backbone.blocks.0.mid_se.conv2.bias", "backbone.blocks.0.linear_conv.conv.weight", "backbone.blocks.0.linear_conv.bn.weigh
t", "backbone.blocks.0.linear_conv.bn.bias", "backbone.blocks.0.linear_conv.bn.running_mean", "backbone.blocks.0.linear_conv.bn.running_var", "backbone.blocks.1.expand_conv.conv.wei
ght", "backbone.blocks.1.expand_conv.bn.weight", "backbone.blocks.1.expand_conv.bn.bias", "backbone.blocks.1.expand_conv.bn.running_mean", "backbone.blocks.1.expand_conv.bn.running

var", "backbone.blocks.1.bottleneck_conv.conv.weight", "backbone.blocks.1.bottleneck_conv.bn.weight", "backbone.blocks.1.bottleneck_conv.bn.bias", "backbone.blocks.1.bottleneck_conv
.bn.running_mean", "backbone.blocks.1.bottleneck_conv.bn.running_var", "backbone.blocks.1.linear_conv.conv.weight", "backbone.blocks.1.linear_conv.bn.weight", "backbone.blocks.1.lin
ear_conv.bn.bias", "backbone.blocks.1.linear_conv.bn.running_mean", "backbone.blocks.1.linear_conv.bn.running_var", "backbone.blocks.2.expand_conv.conv.weight", "backbone.blocks.2.e
xpand_conv.bn.weight", "backbone.blocks.2.expand_conv.bn.bias", "backbone.blocks.2.expand_conv.bn.running_mean", "backbone.blocks.2.expand_conv.bn.running_var", "backbone.blocks.2.b
ottleneck_conv.conv.weight", "backbone.blocks.2.bottleneck_conv.bn.weight", "backbone.blocks.2.bottleneck_conv.bn.bias", "backbone.blocks.2.bottleneck_conv.bn.running_mean", "backbo
ne.blocks.2.bottleneck_conv.bn.running_var", "backbone.blocks.2.linear_conv.conv.weight", "backbone.blocks.2.linear_conv.bn.weight", "backbone.blocks.2.linear_conv.bn.bias", "backbo
ne.blocks.2.linear_conv.bn.running_mean", "backbone.blocks.2.linear_conv.bn.running_var", "backbone.blocks.3.expand_conv.conv.weight", "backbone.blocks.3.expand_conv.bn.weight", "ba
ckbone.blocks.3.expand_conv.bn.bias", "backbone.blocks.3.expand_conv.bn.running_mean", "backbone.blocks.3.expand_conv.bn.running_var", "backbone.blocks.3.bottleneck_conv.conv.weight
", "backbone.blocks.3.bottleneck_conv.bn.weight", "backbone.blocks.3.bottleneck_conv.bn.bias", "backbone.blocks.3.bottleneck_conv.bn.running_mean", "backbone.blocks.3.bottleneck_con
v.bn.running_var", "backbone.blocks.3.mid_se.conv1.weight", "backbone.blocks.3.mid_se.conv1.bias", "backbone.blocks.3.mid_se.conv2.weight", "backbone.blocks.3.mid_se.conv2.bias", "b
ackbone.blocks.3.linear_conv.conv.weight", "backbone.blocks.3.linear_conv.bn.weight", "backbone.blocks.3.linear_conv.bn.bias", "backbone.blocks.3.linear_conv.bn.running_mean", "back
bone.blocks.3.linear_conv.bn.running_var", "backbone.blocks.4.expand_conv.conv.weight", "backbone.blocks.4.expand_conv.bn.weight", "backbone.blocks.4.expand_conv.bn.bias", "backbone
.blocks.4.expand_conv.bn.running_mean", "backbone.blocks.4.expand_conv.bn.running_var", "backbone.blocks.4.bottleneck_conv.conv.weight", "backbone.blocks.4.bottleneck_conv.bn.weight
", "backbone.blocks.4.bottleneck_conv.bn.bias", "backbone.blocks.4.bottleneck_conv.bn.running_mean", "backbone.blocks.4.bottleneck_conv.bn.running_var", "backbone.blocks.4.mid_se.co
nv1.weight", "backbone.blocks.4.mid_se.conv1.bias", "backbone.blocks.4.mid_se.conv2.weight", "backbone.blocks.4.mid_se.conv2.bias", "backbone.blocks.4.linear_conv.conv.weight", "bac
kbone.blocks.4.linear_conv.bn.weight", "backbone.blocks.4.linear_conv.bn.bias", "backbone.blocks.4.linear_conv.bn.running_mean", "backbone.blocks.4.linear_conv.bn.running_var", "bac
kbone.blocks.5.expand_conv.conv.weight", "backbone.blocks.5.expand_conv.bn.weight", "backbone.blocks.5.expand_conv.bn.bias", "backbone.blocks.5.expand_conv.bn.running_mean", "backbo
ne.blocks.5.expand_conv.bn.running_var", "backbone.blocks.5.bottleneck_conv.conv.weight", "backbone.blocks.5.bottleneck_conv.bn.weight", "backbone.blocks.5.bottleneck_conv.bn.bias",
"backbone.blocks.5.bottleneck_conv.bn.running_mean", "backbone.blocks.5.bottleneck_conv.bn.running_var", "backbone.blocks.5.mid_se.conv1.weight", "backbone.blocks.5.mid_se.conv1.bi
as", "backbone.blocks.5.mid_se.conv2.weight", "backbone.blocks.5.mid_se.conv2.bias", "backbone.blocks.5.linear_conv.conv.weight", "backbone.blocks.5.linear_conv.bn.weight", "backbon
e.blocks.5.linear_conv.bn.bias", "backbone.blocks.5.linear_conv.bn.running_mean", "backbone.blocks.5.linear_conv.bn.running_var", "backbone.blocks.6.expand_conv.conv.weight", "backb
one.blocks.6.expand_conv.bn.weight", "backbone.blocks.6.expand_conv.bn.bias", "backbone.blocks.6.expand_conv.bn.running_mean", "backbone.blocks.6.expand_conv.bn.running_var", "backb
one.blocks.6.bottleneck_conv.conv.weight", "backbone.blocks.6.bottleneck_conv.bn.weight", "backbone.blocks.6.bottleneck_conv.bn.bias", "backbone.blocks.6.bottleneck_conv.bn.running_
mean", "backbone.blocks.6.bottleneck_conv.bn.running_var", "backbone.blocks.6.mid_se.conv1.weight", "backbone.blocks.6.mid_se.conv1.bias", "backbone.blocks.6.mid_se.conv2.weight", "
backbone.blocks.6.mid_se.conv2.bias", "backbone.blocks.6.linear_conv.conv.weight", "backbone.blocks.6.linear_conv.bn.weight", "backbone.blocks.6.linear_conv.bn.bias", "backbone.bloc
ks.6.linear_conv.bn.running_mean", "backbone.blocks.6.linear_conv.bn.running_var", "backbone.blocks.7.expand_conv.conv.weight", "backbone.blocks.7.expand_conv.bn.weight", "backbone.
blocks.7.expand_conv.bn.bias", "backbone.blocks.7.expand_conv.bn.running_mean", "backbone.blocks.7.expand_conv.bn.running_var", "backbone.blocks.7.bottleneck_conv.conv.weight", "bac
kbone.blocks.7.bottleneck_conv.bn.weight", "backbone.blocks.7.bottleneck_conv.bn.bias", "backbone.blocks.7.bottleneck_conv.bn.running_mean", "backbone.blocks.7.bottleneck_conv.bn.ru
nning_var", "backbone.blocks.7.mid_se.conv1.weight", "backbone.blocks.7.mid_se.conv1.bias", "backbone.blocks.7.mid_se.conv2.weight", "backbone.blocks.7.mid_se.conv2.bias", "backbone
.blocks.7.linear_conv.conv.weight", "backbone.blocks.7.linear_conv.bn.weight", "backbone.blocks.7.linear_conv.bn.bias", "backbone.blocks.7.linear_conv.bn.running_mean", "backbone.bl
ocks.7.linear_conv.bn.running_var", "backbone.blocks.8.expand_conv.conv.weight", "backbone.blocks.8.expand_conv.bn.weight", "backbone.blocks.8.expand_conv.bn.bias", "backbone.blocks
.8.expand_conv.bn.running_mean", "backbone.blocks.8.expand_conv.bn.running_var", "backbone.blocks.8.bottleneck_conv.conv.weight", "backbone.blocks.8.bottleneck_conv.bn.weight", "bac
kbone.blocks.8.bottleneck_conv.bn.bias", "backbone.blocks.8.bottleneck_conv.bn.running_mean", "backbone.blocks.8.bottleneck_conv.bn.running_var", "backbone.blocks.8.mid_se.conv1.wei
ght", "backbone.blocks.8.mid_se.conv1.bias", "backbone.blocks.8.mid_se.conv2.weight", "backbone.blocks.8.mid_se.conv2.bias", "backbone.blocks.8.linear_conv.conv.weight", "backbone.b
locks.8.linear_conv.bn.weight", "backbone.blocks.8.linear_conv.bn.bias", "backbone.blocks.8.linear_conv.bn.running_mean", "backbone.blocks.8.linear_conv.bn.running_var", "backbone.b
locks.9.expand_conv.conv.weight", "backbone.blocks.9.expand_conv.bn.weight", "backbone.blocks.9.expand_conv.bn.bias", "backbone.blocks.9.expand_conv.bn.running_mean", "backbone.bloc
ks.9.expand_conv.bn.running_var", "backbone.blocks.9.bottleneck_conv.conv.weight", "backbone.blocks.9.bottleneck_conv.bn.weight", "backbone.blocks.9.bottleneck_conv.bn.bias", "backb
one.blocks.9.bottleneck_conv.bn.running_mean", "backbone.blocks.9.bottleneck_conv.bn.running_var", "backbone.blocks.9.mid_se.conv1.weight", "backbone.blocks.9.mid_se.conv1.bias", "b
ackbone.blocks.9.mid_se.conv2.weight", "backbone.blocks.9.mid_se.conv2.bias", "backbone.blocks.9.linear_conv.conv.weight", "backbone.blocks.9.linear_conv.bn.weight", "backbone.block
s.9.linear_conv.bn.bias", "backbone.blocks.9.linear_conv.bn.running_mean", "backbone.blocks.9.linear_conv.bn.running_var", "backbone.blocks.10.expand_conv.conv.weight", "backbone.bl
ocks.10.expand_conv.bn.weight", "backbone.blocks.10.expand_conv.bn.bias", "backbone.blocks.10.expand_conv.bn.running_mean", "backbone.blocks.10.expand_conv.bn.running_var", "backbon
e.blocks.10.bottleneck_conv.conv.weight", "backbone.blocks.10.bottleneck_conv.bn.weight", "backbone.blocks.10.bottleneck_conv.bn.bias", "backbone.blocks.10.bottleneck_conv.bn.runnin
g_mean", "backbone.blocks.10.bottleneck_conv.bn.running_var", "backbone.blocks.10.mid_se.conv1.weight", "backbone.blocks.10.mid_se.conv1.bias", "backbone.blocks.10.mid_se.conv2.weig
ht", "backbone.blocks.10.mid_se.conv2.bias", "backbone.blocks.10.linear_conv.conv.weight", "backbone.blocks.10.linear_conv.bn.weight", "backbone.blocks.10.linear_conv.bn.bias", "bac
kbone.blocks.10.linear_conv.bn.running_mean", "backbone.blocks.10.linear_conv.bn.running_var", "backbone.conv2.conv.weight", "backbone.conv2.bn.weight", "backbone.conv2.bn.bias", "b
ackbone.conv2.bn.running_mean", "backbone.conv2.bn.running_var", "neck.encoder.lstm.weight_ih_l0", "neck.encoder.lstm.weight_hh_l0", "neck.encoder.lstm.bias_ih_l0", "neck.encoder.ls
tm.bias_hh_l0", "neck.encoder.lstm.weight_ih_l0_reverse", "neck.encoder.lstm.weight_hh_l0_reverse", "neck.encoder.lstm.bias_ih_l0_reverse", "neck.encoder.lstm.bias_hh_l0_reverse", "
neck.encoder.lstm.weight_ih_l1", "neck.encoder.lstm.weight_hh_l1", "neck.encoder.lstm.bias_ih_l1", "neck.encoder.lstm.bias_hh_l1", "neck.encoder.lstm.weight_ih_l1_reverse", "neck.en
coder.lstm.weight_hh_l1_reverse", "neck.encoder.lstm.bias_ih_l1_reverse", "neck.encoder.lstm.bias_hh_l1_reverse", "head.fc.weight", "head.fc.bias".
Unexpected key(s) in state_dict: "backbone.conv.conv.weight", "backbone.conv.bn.weight", "backbone.conv.bn.bias", "backbone.conv.bn.running_mean", "backbone.conv.bn.running_
var", "backbone.conv.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_0_0.conv0.conv.weight", "backbone.block_list.bottleneckBlock_0_0.conv0.bn.weight", "backbone.block
list.bottleneckBlock_0_0.conv0.bn.bias", "backbone.block_list.bottleneckBlock_0_0.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_0_0.conv0.bn.running_var", "backbone.
block_list.bottleneckBlock_0_0.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_0_0.conv1.conv.weight", "backbone.block_list.bottleneckBlock_0_0.conv1.bn.weight",
"backbone.block_list.bottleneckBlock_0_0.conv1.bn.bias", "backbone.block_list.bottleneckBlock_0_0.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_0_0.conv1.bn.running

var", "backbone.block_list.bottleneckBlock_0_0.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_0_0.conv2.conv.weight", "backbone.block_list.bottleneckBlock_0_0.c
onv2.bn.weight", "backbone.block_list.bottleneckBlock_0_0.conv2.bn.bias", "backbone.block_list.bottleneckBlock_0_0.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_0_0.c
onv2.bn.running_var", "backbone.block_list.bottleneckBlock_0_0.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_0_0.short.conv.conv.weight", "backbone.block_list.
bottleneckBlock_0_0.short.conv.bn.weight", "backbone.block_list.bottleneckBlock_0_0.short.conv.bn.bias", "backbone.block_list.bottleneckBlock_0_0.short.conv.bn.running_mean", "backb
one.block_list.bottleneckBlock_0_0.short.conv.bn.running_var", "backbone.block_list.bottleneckBlock_0_0.short.conv.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_0_1.
conv0.conv.weight", "backbone.block_list.bottleneckBlock_0_1.conv0.bn.weight", "backbone.block_list.bottleneckBlock_0_1.conv0.bn.bias", "backbone.block_list.bottleneckBlock_0_1.conv
0.bn.running_mean", "backbone.block_list.bottleneckBlock_0_1.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_0_1.conv0.bn.num_batches_tracked", "backbone.block_list.bott
leneckBlock_0_1.conv1.conv.weight", "backbone.block_list.bottleneckBlock_0_1.conv1.bn.weight", "backbone.block_list.bottleneckBlock_0_1.conv1.bn.bias", "backbone.block_list.bottlene
ckBlock_0_1.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_0_1.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_0_1.conv1.bn.num_batches_tracked", "backbone
.block_list.bottleneckBlock_0_1.conv2.conv.weight", "backbone.block_list.bottleneckBlock_0_1.conv2.bn.weight", "backbone.block_list.bottleneckBlock_0_1.conv2.bn.bias", "backbone.blo
ck_list.bottleneckBlock_0_1.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_0_1.conv2.bn.running_var", "backbone.block_list.bottleneckBlock_0_1.conv2.bn.num_batches_tra
cked", "backbone.block_list.bottleneckBlock_0_2.conv0.conv.weight", "backbone.block_list.bottleneckBlock_0_2.conv0.bn.weight", "backbone.block_list.bottleneckBlock_0_2.conv0.bn.bias
", "backbone.block_list.bottleneckBlock_0_2.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_0_2.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_0_2.conv0.bn
.num_batches_tracked", "backbone.block_list.bottleneckBlock_0_2.conv1.conv.weight", "backbone.block_list.bottleneckBlock_0_2.conv1.bn.weight", "backbone.block_list.bottleneckBlock_0
2.conv1.bn.bias", "backbone.block_list.bottleneckBlock_0_2.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_0_2.conv1.bn.running_var", "backbone.block_list.bottleneckBl
ock_0_2.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_0_2.conv2.conv.weight", "backbone.block_list.bottleneckBlock_0_2.conv2.bn.weight", "backbone.block_list.b
ottleneckBlock_0_2.conv2.bn.bias", "backbone.block_list.bottleneckBlock_0_2.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_0_2.conv2.bn.running_var", "backbone.block_l
ist.bottleneckBlock_0_2.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_0.conv0.conv.weight", "backbone.block_list.bottleneckBlock_1_0.conv0.bn.weight", "backb
one.block_list.bottleneckBlock_1_0.conv0.bn.bias", "backbone.block_list.bottleneckBlock_1_0.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_1_0.conv0.bn.running_var", "
backbone.block_list.bottleneckBlock_1_0.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_0.conv1.conv.weight", "backbone.block_list.bottleneckBlock_1_0.conv1.bn
.weight", "backbone.block_list.bottleneckBlock_1_0.conv1.bn.bias", "backbone.block_list.bottleneckBlock_1_0.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_1_0.conv1.bn
.running_var", "backbone.block_list.bottleneckBlock_1_0.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_0.conv2.conv.weight", "backbone.block_list.bottleneckBl
ock_1_0.conv2.bn.weight", "backbone.block_list.bottleneckBlock_1_0.conv2.bn.bias", "backbone.block_list.bottleneckBlock_1_0.conv2.bn.running_mean", "backbone.block_list.bottleneckBl
ock_1_0.conv2.bn.running_var", "backbone.block_list.bottleneckBlock_1_0.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_0.short.conv.conv.weight", "backbone.bl
ock_list.bottleneckBlock_1_0.short.conv.bn.weight", "backbone.block_list.bottleneckBlock_1_0.short.conv.bn.bias", "backbone.block_list.bottleneckBlock_1_0.short.conv.bn.running_mean
", "backbone.block_list.bottleneckBlock_1_0.short.conv.bn.running_var", "backbone.block_list.bottleneckBlock_1_0.short.conv.bn.num_batches_tracked", "backbone.block_list.bottleneckB
lock_1_1.conv0.conv.weight", "backbone.block_list.bottleneckBlock_1_1.conv0.bn.weight", "backbone.block_list.bottleneckBlock_1_1.conv0.bn.bias", "backbone.block_list.bottleneckBlock
1_1.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_1_1.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_1_1.conv0.bn.num_batches_tracked", "backbone.block
list.bottleneckBlock_1_1.conv1.conv.weight", "backbone.block_list.bottleneckBlock_1_1.conv1.bn.weight", "backbone.block_list.bottleneckBlock_1_1.conv1.bn.bias", "backbone.block_list
.bottleneckBlock_1_1.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_1_1.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_1_1.conv1.bn.num_batches_tracked",
"backbone.block_list.bottleneckBlock_1_1.conv2.conv.weight", "backbone.block_list.bottleneckBlock_1_1.conv2.bn.weight", "backbone.block_list.bottleneckBlock_1_1.conv2.bn.bias", "bac
kbone.block_list.bottleneckBlock_1_1.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_1_1.conv2.bn.running_var", "backbone.block_list.bottleneckBlock_1_1.conv2.bn.num_ba
tches_tracked", "backbone.block_list.bottleneckBlock_1_2.conv0.conv.weight", "backbone.block_list.bottleneckBlock_1_2.conv0.bn.weight", "backbone.block_list.bottleneckBlock_1_2.conv
0.bn.bias", "backbone.block_list.bottleneckBlock_1_2.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_1_2.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_1_2
.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_2.conv1.conv.weight", "backbone.block_list.bottleneckBlock_1_2.conv1.bn.weight", "backbone.block_list.bottlene
ckBlock_1_2.conv1.bn.bias", "backbone.block_list.bottleneckBlock_1_2.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_1_2.conv1.bn.running_var", "backbone.block_list.bot
tleneckBlock_1_2.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_2.conv2.conv.weight", "backbone.block_list.bottleneckBlock_1_2.conv2.bn.weight", "backbone.blo
ck_list.bottleneckBlock_1_2.conv2.bn.bias", "backbone.block_list.bottleneckBlock_1_2.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_1_2.conv2.bn.running_var", "backbon
e.block_list.bottleneckBlock_1_2.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_3.conv0.conv.weight", "backbone.block_list.bottleneckBlock_1_3.conv0.bn.weight
", "backbone.block_list.bottleneckBlock_1_3.conv0.bn.bias", "backbone.block_list.bottleneckBlock_1_3.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_1_3.conv0.bn.runnin
g_var", "backbone.block_list.bottleneckBlock_1_3.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_3.conv1.conv.weight", "backbone.block_list.bottleneckBlock_1_3
.conv1.bn.weight", "backbone.block_list.bottleneckBlock_1_3.conv1.bn.bias", "backbone.block_list.bottleneckBlock_1_3.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_1_3
.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_1_3.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_1_3.conv2.conv.weight", "backbone.block_list.bot
tleneckBlock_1_3.conv2.bn.weight", "backbone.block_list.bottleneckBlock_1_3.conv2.bn.bias", "backbone.block_list.bottleneckBlock_1_3.conv2.bn.running_mean", "backbone.block_list.bot
tleneckBlock_1_3.conv2.bn.running_var", "backbone.block_list.bottleneckBlock_1_3.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_0.conv0.conv.weight", "backbon
e.block_list.bottleneckBlock_2_0.conv0.bn.weight", "backbone.block_list.bottleneckBlock_2_0.conv0.bn.bias", "backbone.block_list.bottleneckBlock_2_0.conv0.bn.running_mean", "backbon
e.block_list.bottleneckBlock_2_0.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_2_0.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_0.conv1.conv.w
eight", "backbone.block_list.bottleneckBlock_2_0.conv1.bn.weight", "backbone.block_list.bottleneckBlock_2_0.conv1.bn.bias", "backbone.block_list.bottleneckBlock_2_0.conv1.bn.running
mean", "backbone.block_list.bottleneckBlock_2_0.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_2_0.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock
2_0.conv2.conv.weight", "backbone.block_list.bottleneckBlock_2_0.conv2.bn.weight", "backbone.block_list.bottleneckBlock_2_0.conv2.bn.bias", "backbone.block_list.bottleneckBlock_2_0.
conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_2_0.conv2.bn.running_var", "backbone.block_list.bottleneckBlock_2_0.conv2.bn.num_batches_tracked", "backbone.block_list.
bottleneckBlock_2_0.short.conv.conv.weight", "backbone.block_list.bottleneckBlock_2_0.short.conv.bn.weight", "backbone.block_list.bottleneckBlock_2_0.short.conv.bn.bias", "backbone.
block_list.bottleneckBlock_2_0.short.conv.bn.running_mean", "backbone.block_list.bottleneckBlock_2_0.short.conv.bn.running_var", "backbone.block_list.bottleneckBlock_2_0.short.conv.
bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_1.conv0.conv.weight", "backbone.block_list.bottleneckBlock_2_1.conv0.bn.weight", "backbone.block_list.bottleneckBlock
2_1.conv0.bn.bias", "backbone.block_list.bottleneckBlock_2_1.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_2_1.conv0.bn.running_var", "backbone.block_list.bottleneck
Block_2_1.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_1.conv1.conv.weight", "backbone.block_list.bottleneckBlock_2_1.conv1.bn.weight", "backbone.block_list
.bottleneckBlock_2_1.conv1.bn.bias", "backbone.block_list.bottleneckBlock_2_1.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_2_1.conv1.bn.running_var", "backbone.block
list.bottleneckBlock_2_1.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_1.conv2.conv.weight", "backbone.block_list.bottleneckBlock_2_1.conv2.bn.weight", "bac
kbone.block_list.bottleneckBlock_2_1.conv2.bn.bias", "backbone.block_list.bottleneckBlock_2_1.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_2_1.conv2.bn.running_var",
"backbone.block_list.bottleneckBlock_2_1.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_2.conv0.conv.weight", "backbone.block_list.bottleneckBlock_2_2.conv0.
bn.weight", "backbone.block_list.bottleneckBlock_2_2.conv0.bn.bias", "backbone.block_list.bottleneckBlock_2_2.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_2_2.conv0.
bn.running_var", "backbone.block_list.bottleneckBlock_2_2.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_2.conv1.conv.weight", "backbone.block_list.bottleneck
Block_2_2.conv1.bn.weight", "backbone.block_list.bottleneckBlock_2_2.conv1.bn.bias", "backbone.block_list.bottleneckBlock_2_2.conv1.bn.running_mean", "backbone.block_list.bottleneck
Block_2_2.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_2_2.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_2.conv2.conv.weight", "backbone.block
list.bottleneckBlock_2_2.conv2.bn.weight", "backbone.block_list.bottleneckBlock_2_2.conv2.bn.bias", "backbone.block_list.bottleneckBlock_2_2.conv2.bn.running_mean", "backbone.block
list.bottleneckBlock_2_2.conv2.bn.running_var", "backbone.block_list.bottleneckBlock_2_2.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_3.conv0.conv.weight",
"backbone.block_list.bottleneckBlock_2_3.conv0.bn.weight", "backbone.block_list.bottleneckBlock_2_3.conv0.bn.bias", "backbone.block_list.bottleneckBlock_2_3.conv0.bn.running_mean",
"backbone.block_list.bottleneckBlock_2_3.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_2_3.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_3.con
v1.conv.weight", "backbone.block_list.bottleneckBlock_2_3.conv1.bn.weight", "backbone.block_list.bottleneckBlock_2_3.conv1.bn.bias", "backbone.block_list.bottleneckBlock_2_3.conv1.b
n.running_mean", "backbone.block_list.bottleneckBlock_2_3.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_2_3.conv1.bn.num_batches_tracked", "backbone.block_list.bottlen
eckBlock_2_3.conv2.conv.weight", "backbone.block_list.bottleneckBlock_2_3.conv2.bn.weight", "backbone.block_list.bottleneckBlock_2_3.conv2.bn.bias", "backbone.block_list.bottleneckB
lock_2_3.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_2_3.conv2.bn.running_var", "backbone.block_list.bottleneckBlock_2_3.conv2.bn.num_batches_tracked", "backbone.bl
ock_list.bottleneckBlock_2_4.conv0.conv.weight", "backbone.block_list.bottleneckBlock_2_4.conv0.bn.weight", "backbone.block_list.bottleneckBlock_2_4.conv0.bn.bias", "backbone.block

list.bottleneckBlock_2_4.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_2_4.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_2_4.conv0.bn.num_batches_tracke
d", "backbone.block_list.bottleneckBlock_2_4.conv1.conv.weight", "backbone.block_list.bottleneckBlock_2_4.conv1.bn.weight", "backbone.block_list.bottleneckBlock_2_4.conv1.bn.bias",
"backbone.block_list.bottleneckBlock_2_4.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_2_4.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_2_4.conv1.bn.nu
m_batches_tracked", "backbone.block_list.bottleneckBlock_2_4.conv2.conv.weight", "backbone.block_list.bottleneckBlock_2_4.conv2.bn.weight", "backbone.block_list.bottleneckBlock_2_4.
conv2.bn.bias", "backbone.block_list.bottleneckBlock_2_4.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_2_4.conv2.bn.running_var", "backbone.block_list.bottleneckBlock
2_4.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_5.conv0.conv.weight", "backbone.block_list.bottleneckBlock_2_5.conv0.bn.weight", "backbone.block_list.bott
leneckBlock_2_5.conv0.bn.bias", "backbone.block_list.bottleneckBlock_2_5.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_2_5.conv0.bn.running_var", "backbone.block_list
.bottleneckBlock_2_5.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_5.conv1.conv.weight", "backbone.block_list.bottleneckBlock_2_5.conv1.bn.weight", "backbone
.block_list.bottleneckBlock_2_5.conv1.bn.bias", "backbone.block_list.bottleneckBlock_2_5.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_2_5.conv1.bn.running_var", "bac
kbone.block_list.bottleneckBlock_2_5.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_2_5.conv2.conv.weight", "backbone.block_list.bottleneckBlock_2_5.conv2.bn.we
ight", "backbone.block_list.bottleneckBlock_2_5.conv2.bn.bias", "backbone.block_list.bottleneckBlock_2_5.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_2_5.conv2.bn.ru
nning_var", "backbone.block_list.bottleneckBlock_2_5.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_3_0.conv0.conv.weight", "backbone.block_list.bottleneckBlock
3_0.conv0.bn.weight", "backbone.block_list.bottleneckBlock_3_0.conv0.bn.bias", "backbone.block_list.bottleneckBlock_3_0.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock
3_0.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_3_0.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_3_0.conv1.conv.weight", "backbone.block_list
.bottleneckBlock_3_0.conv1.bn.weight", "backbone.block_list.bottleneckBlock_3_0.conv1.bn.bias", "backbone.block_list.bottleneckBlock_3_0.conv1.bn.running_mean", "backbone.block_list
.bottleneckBlock_3_0.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_3_0.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_3_0.conv2.conv.weight", "bac
kbone.block_list.bottleneckBlock_3_0.conv2.bn.weight", "backbone.block_list.bottleneckBlock_3_0.conv2.bn.bias", "backbone.block_list.bottleneckBlock_3_0.conv2.bn.running_mean", "bac
kbone.block_list.bottleneckBlock_3_0.conv2.bn.running_var", "backbone.block_list.bottleneckBlock_3_0.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_3_0.short.co
nv.conv.weight", "backbone.block_list.bottleneckBlock_3_0.short.conv.bn.weight", "backbone.block_list.bottleneckBlock_3_0.short.conv.bn.bias", "backbone.block_list.bottleneckBlock_3
0.short.conv.bn.running_mean", "backbone.block_list.bottleneckBlock_3_0.short.conv.bn.running_var", "backbone.block_list.bottleneckBlock_3_0.short.conv.bn.num_batches_tracked", "ba
ckbone.block_list.bottleneckBlock_3_1.conv0.conv.weight", "backbone.block_list.bottleneckBlock_3_1.conv0.bn.weight", "backbone.block_list.bottleneckBlock_3_1.conv0.bn.bias", "backbo
ne.block_list.bottleneckBlock_3_1.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_3_1.conv0.bn.running_var", "backbone.block_list.bottleneckBlock_3_1.conv0.bn.num_batch
es_tracked", "backbone.block_list.bottleneckBlock_3_1.conv1.conv.weight", "backbone.block_list.bottleneckBlock_3_1.conv1.bn.weight", "backbone.block_list.bottleneckBlock_3_1.conv1.b
n.bias", "backbone.block_list.bottleneckBlock_3_1.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_3_1.conv1.bn.running_var", "backbone.block_list.bottleneckBlock_3_1.co
nv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_3_1.conv2.conv.weight", "backbone.block_list.bottleneckBlock_3_1.conv2.bn.weight", "backbone.block_list.bottleneckB
lock_3_1.conv2.bn.bias", "backbone.block_list.bottleneckBlock_3_1.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_3_1.conv2.bn.running_var", "backbone.block_list.bottle
neckBlock_3_1.conv2.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_3_2.conv0.conv.weight", "backbone.block_list.bottleneckBlock_3_2.conv0.bn.weight", "backbone.block

list.bottleneckBlock_3_2.conv0.bn.bias", "backbone.block_list.bottleneckBlock_3_2.conv0.bn.running_mean", "backbone.block_list.bottleneckBlock_3_2.conv0.bn.running_var", "backbone.b
lock_list.bottleneckBlock_3_2.conv0.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_3_2.conv1.conv.weight", "backbone.block_list.bottleneckBlock_3_2.conv1.bn.weight",
"backbone.block_list.bottleneckBlock_3_2.conv1.bn.bias", "backbone.block_list.bottleneckBlock_3_2.conv1.bn.running_mean", "backbone.block_list.bottleneckBlock_3_2.conv1.bn.running_v
ar", "backbone.block_list.bottleneckBlock_3_2.conv1.bn.num_batches_tracked", "backbone.block_list.bottleneckBlock_3_2.conv2.conv.weight", "backbone.block_list.bottleneckBlock_3_2.co
nv2.bn.weight", "backbone.block_list.bottleneckBlock_3_2.conv2.bn.bias", "backbone.block_list.bottleneckBlock_3_2.conv2.bn.running_mean", "backbone.block_list.bottleneckBlock_3_2.co
nv2.bn.running_var", "backbone.block_list.bottleneckBlock_3_2.conv2.bn.num_batches_tracked", "backbone.base_block.F
-2_base_block_0.weight", "backbone.base_block.F
-2_base_block_0.b
ias", "backbone.base_block.F
-2_base_block_1.weight", "backbone.base_block.F
-2_base_block_1.bias", "backbone.base_block.F
-2_base_block_2.0.weight", "backbone.base_block.F
-2_base

block_2.0.bias", "backbone.base_block.F_-2_base_block_2.0.running_mean", "backbone.base_block.F_-2_base_block_2.0.running_var", "backbone.base_block.F_-2_base_block_2.0.num_batches_
tracked", "backbone.base_block.F_-3_base_block_0.weight", "backbone.base_block.F_-3_base_block_0.bias", "backbone.base_block.F_-3_base_block_1.weight", "backbone.base_block.F_-3_bas
e_block_1.bias", "backbone.base_block.F_-3_base_block_2.0.weight", "backbone.base_block.F_-3_base_block_2.0.bias", "backbone.base_block.F_-3_base_block_2.0.running_mean", "backbone.
base_block.F_-3_base_block_2.0.running_var", "backbone.base_block.F_-3_base_block_2.0.num_batches_tracked", "backbone.base_block.F_-3_base_block_3.weight", "backbone.base_block.F_-3
_base_block_3.bias", "head.pvam.wrap_encoder_for_feature.prepare_encoder.emb.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_0.preprocesser1.functors.layer
_norm_0.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_0.preprocesser1.functors.layer_norm_0.bias", "head.pvam.wrap_encoder_for_feature.encoder.encoder_la
yers.layer_0.self_attn.q_fc.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_0.self_attn.k_fc.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_l
ayers.layer_0.self_attn.v_fc.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_0.self_attn.proj_fc.weight", "head.pvam.wrap_encoder_for_feature.encoder.encod
er_layers.layer_0.preprocesser2.functors.layer_norm_0.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_0.preprocesser2.functors.layer_norm_0.bias", "head.pv
am.wrap_encoder_for_feature.encoder.encoder_layers.layer_0.ffn.fc1.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_0.ffn.fc1.bias", "head.pvam.wrap_encoder
_for_feature.encoder.encoder_layers.layer_0.ffn.fc2.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_0.ffn.fc2.bias", "head.pvam.wrap_encoder_for_feature.en
coder.encoder_layers.layer_1.preprocesser1.functors.layer_norm_0.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_1.preprocesser1.functors.layer_norm_0.bias
", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_1.self_attn.q_fc.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_1.self_attn.k_fc.weigh
t", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_1.self_attn.v_fc.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_1.self_attn.proj_fc.w
eight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_1.preprocesser2.functors.layer_norm_0.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.la
yer_1.preprocesser2.functors.layer_norm_0.bias", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_1.ffn.fc1.weight", "head.pvam.wrap_encoder_for_feature.encoder.enco
der_layers.layer_1.ffn.fc1.bias", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.layer_1.ffn.fc2.weight", "head.pvam.wrap_encoder_for_feature.encoder.encoder_layers.laye
r_1.ffn.fc2.bias", "head.pvam.wrap_encoder_for_feature.encoder.processer.functors.layer_norm_0.weight", "head.pvam.wrap_encoder_for_feature.encoder.processer.functors.layer_norm_0.b
ias", "head.pvam.fc0.weight", "head.pvam.fc0.bias", "head.pvam.emb.weight", "head.pvam.fc1.weight", "head.gsrm.fc0.weight", "head.gsrm.fc0.bias", "head.gsrm.wrap_encoder0.prepare_de
coder.emb0.weight", "head.gsrm.wrap_encoder0.prepare_decoder.emb1.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_0.preprocesser1.functors.layer_norm_0.weight", "head
.gsrm.wrap_encoder0.encoder.encoder_layers.layer_0.preprocesser1.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_0.self_attn.q_fc.weight", "head.g
srm.wrap_encoder0.encoder.encoder_layers.layer_0.self_attn.k_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_0.self_attn.v_fc.weight", "head.gsrm.wrap_encoder0.enc
oder.encoder_layers.layer_0.self_attn.proj_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_0.preprocesser2.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder0.
encoder.encoder_layers.layer_0.preprocesser2.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_0.ffn.fc1.weight", "head.gsrm.wrap_encoder0.encoder.e
ncoder_layers.layer_0.ffn.fc1.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_0.ffn.fc2.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_0.ffn.fc2.bias",
"head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.preprocesser1.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.preprocesser1.functors.l
ayer_norm_0.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.self_attn.q_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.self_attn.k_fc.weight", "h
ead.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.self_attn.v_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.self_attn.proj_fc.weight", "head.gsrm.wrap_enco
der0.encoder.encoder_layers.layer_1.preprocesser2.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.preprocesser2.functors.layer_norm_0.bias", "
head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.ffn.fc1.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.ffn.fc1.bias", "head.gsrm.wrap_encoder0.encoder.encod
er_layers.layer_1.ffn.fc2.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_1.ffn.fc2.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.preprocesser1.funct
ors.layer_norm_0.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.preprocesser1.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.
self_attn.q_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.self_attn.k_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.self_attn.v_fc.weight
", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.self_attn.proj_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.preprocesser2.functors.layer_norm_0.wei
ght", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.preprocesser2.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.ffn.fc1.weight", "he
ad.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.ffn.fc1.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_2.ffn.fc2.weight", "head.gsrm.wrap_encoder0.encoder.encoder
layers.layer_2.ffn.fc2.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.preprocesser1.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.l
ayer_3.preprocesser1.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.self_attn.q_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.lay
er_3.self_attn.k_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.self_attn.v_fc.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.self_attn.proj_f
c.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.preprocesser2.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.preprocesser2
.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.ffn.fc1.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.ffn.fc1.bias", "head.g
srm.wrap_encoder0.encoder.encoder_layers.layer_3.ffn.fc2.weight", "head.gsrm.wrap_encoder0.encoder.encoder_layers.layer_3.ffn.fc2.bias", "head.gsrm.wrap_encoder0.encoder.processer.f
unctors.layer_norm_0.weight", "head.gsrm.wrap_encoder0.encoder.processer.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder1.prepare_decoder.emb0.weight", "head.gsrm.wrap_encoder1
.prepare_decoder.emb1.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.preprocesser1.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.l
ayer_0.preprocesser1.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.self_attn.q_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.lay
er_0.self_attn.k_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.self_attn.v_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.self_attn.proj_f
c.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.preprocesser2.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.preprocesser2
.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.ffn.fc1.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.ffn.fc1.bias", "head.g
srm.wrap_encoder1.encoder.encoder_layers.layer_0.ffn.fc2.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_0.ffn.fc2.bias", "head.gsrm.wrap_encoder1.encoder.encoder_lay
ers.layer_1.preprocesser1.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_1.preprocesser1.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder1.
encoder.encoder_layers.layer_1.self_attn.q_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_1.self_attn.k_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layer
s.layer_1.self_attn.v_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_1.self_attn.proj_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_1.preproce
sser2.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_1.preprocesser2.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder1.encoder.encoder_laye
rs.layer_1.ffn.fc1.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_1.ffn.fc1.bias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_1.ffn.fc2.weight", "head.gsr
m.wrap_encoder1.encoder.encoder_layers.layer_1.ffn.fc2.bias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_2.preprocesser1.functors.layer_norm_0.weight", "head.gsrm.wrap_en
coder1.encoder.encoder_layers.layer_2.preprocesser1.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_2.self_attn.q_fc.weight", "head.gsrm.wrap_enco
der1.encoder.encoder_layers.layer_2.self_attn.k_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_2.self_attn.v_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder

layers.layer_2.self_attn.proj_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_2.preprocesser2.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder1.encoder.encod
er_layers.layer_2.preprocesser2.functors.layer_norm_0.bias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_2.ffn.fc1.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers
.layer_2.ffn.fc1.bias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_2.ffn.fc2.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_2.ffn.fc2.bias", "head.gsrm.wr
ap_encoder1.encoder.encoder_layers.layer_3.preprocesser1.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_3.preprocesser1.functors.layer_norm_0.b
ias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_3.self_attn.q_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_3.self_attn.k_fc.weight", "head.gsrm.wrap
_encoder1.encoder.encoder_layers.layer_3.self_attn.v_fc.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_3.self_attn.proj_fc.weight", "head.gsrm.wrap_encoder1.encoder.
encoder_layers.layer_3.preprocesser2.functors.layer_norm_0.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_3.preprocesser2.functors.layer_norm_0.bias", "head.gsrm.wra
p_encoder1.encoder.encoder_layers.layer_3.ffn.fc1.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_3.ffn.fc1.bias", "head.gsrm.wrap_encoder1.encoder.encoder_layers.lay
er_3.ffn.fc2.weight", "head.gsrm.wrap_encoder1.encoder.encoder_layers.layer_3.ffn.fc2.bias", "head.gsrm.wrap_encoder1.encoder.processer.functors.layer_norm_0.weight", "head.gsrm.wra
p_encoder1.encoder.processer.functors.layer_norm_0.bias", "head.vsfd.fc0.weight", "head.vsfd.fc0.bias", "head.vsfd.fc1.weight", "head.vsfd.fc1.bias".

paddleocr trained model to pytorch pth.

Hello, thank you for your work.
I trained SRN mudule in PaddleOCR on my dataset. i convert the trained model into inference and onnxt format. How can i convert trained model to pytorch pth file.
Thank you

请问为什么同样的模型PTOCR的效果会好于PPOCR呢?

Pytorch
python3 ./tools/infer/predict_system.py --image_dir ./test.jpeg --det_model_path ch_ptocr_v2_det_infer.pth --rec_model_path ch_ptocr_v2_rec_infer.pth --use_angle_cls true --cls_model_path ch_ptocr_mobile_v2.0_cls_infer.pth
image

Paddle
python3 tools/infer/predict_system.py --image_dir="./test.jpeg" --det_model_dir="./model/ch_PP-OCRv2_det_infer" --cls_model_dir="./model/ch_ppocr_mobile_v2.0_cls_infer" --rec_model_dir="./model/ch_PP-OCRv2_rec_infer" --use_angle_cls=true
image

除了输入和参数路径,其他均是默认。对比过代码默认配置两边基本是相同的。从结果看Pytorch要好一些,感觉很奇怪,麻烦懂的大大解答一下

Large difference between reported PaddleOCR performance and converted PyTorch model performance

Hi, thanks for releasing this nice converter, it's been very useful! I'm trying to benchmark the performance of PaddleOCR model and the corresponding converted PyTorch model on ICDAR2015 dataset and found there is a big gap between them that I couldn't explain, can you help me?

The model I'm using is det_r50_vd_db_v2.0_train and the corresponding PyTorch model is det_r50_vd_db_v2.0_infer.pth.

The reported performance for DB ResNet50_vd is precision: 86.41%, recall: 78.72%, hmean 82.38%.

However, the best performance I can get from the converted model so far is precision: 66.51%, recall: 69.14%, hmean: 67.80%.
The metric is calculated using the PaddleOCR's DetMetric class and I've matched exactly the same preprocessing and post-processing pipelines. I also excluded those bounding boxes which have ### as labels as done in the PaddleOCR data preparation.

I've also searched issues in PaddleOCR and see if others experienced performance degradation and adjust some inference parameters such as using image_shape as the same as in the training configuration file.

Do you have an idea what's going on in my case? Am I missing something? I would love to have your advice.

Yuhuang.

tools/infer predict_rec.py

字符识别infer时,出现错误 ,det 和 cls是正常的
RuntimeError: Error(s) in loading state_dict for BaseModel:
Missing key(s) in state_dict: "backbone.blocks.0.mid_se.conv1.weight", "backbone.blocks.0.mid_se.conv1.bias", "backbone.blocks.0.mid_se.conv2.weight", "backbone.blocks.0.mid_se.conv2.bias", "backbone.blocks.6.mid_se.conv1.weigh

模型转换后用pytorch推理精度丢失

背景:

自己训练了个ppocrv3 rec模型,使用ch_PP-OCRv3_rec.yml 配置文件,训练完成后使用paddleOCR推理精度很高。

问题:
  1. 模型在转换过程中报错:KeyError: Student.backbone.conv1._conv.weight

image

2. 将源码该处修改后,转换最后报错`RuntimeError: The size of tensor a (34) must match the size of tensor b (33) at non-singleton dimension 0`,

image

将该处改为33后成功转换模型。<\br> 2. 模型在推理过程中精度较低,大部分推理错误,有少部分正确。 请问一下,这个和调整这些报错的参数有关系么?谢谢,该如何解决转换后精度低的问题

KeyError: 'backbone.conv.conv.weight'

python ./converter/ch_ppocr_mobile_v2.0_det_converter.py --src_model_path ./ch_ppocr_mobile_v2.0_det_infer/
{'k': 50, 'in_channels': 96}
paddle weights loading...
Traceback (most recent call last):
  File "./converter/ch_ppocr_mobile_v2.0_det_converter.py", line 61, in <module>
    converter = MobileV20DetConverter(cfg, paddle_pretrained_model_path)
  File "./converter/ch_ppocr_mobile_v2.0_det_converter.py", line 13, in __init__
    self.load_paddle_weights(paddle_pretrained_model_path)
  File "./converter/ch_ppocr_mobile_v2.0_det_converter.py", line 43, in load_paddle_weights
    self.net.state_dict()[k].copy_(torch.Tensor(para_state_dict[ppname]))
KeyError: 'backbone.conv.conv.weight'

使用预训练模型出现 KeyError: 'neck.in2_conv.weight'

使用的模型结构是 ./configs/det/det_r50_vd_db.yml ,使用的paddle参数文件下载自 https://paddleocr.bj.bcebos.com/pretrained/ResNet50_vd_ssld_pretrained.pdparams
但是在尝试模型转换时出现了如下报错
Traceback (most recent call last):
File "../converter/det_converter.py", line 94, in
converter = DetV20DetConverter(cfg, paddle_pretrained_model_path, **kwargs)
File "../converter/det_converter.py", line 12, in init
self.load_paddle_weights(paddle_pretrained_model_path)
File "../converter/det_converter.py", line 56, in load_paddle_weights
self.net.state_dict()[k].copy_(torch.Tensor(para_state_dict[ppname]))
KeyError: 'neck.in2_conv.weight'
原本猜测是模型不对,想要从给的百度网盘中找合适的模型参数文件,但是本项目中提到的网盘链接(https://pan.baidu.com/s/1getAprT2l_JqwhjwML0g9g 提取码:lmv7)已经失效。

det_converter.py

请问下我在PaddleOCR那边训练好了一个检测模型后

python3 tools/train.py -c configs/det/det_mv3_db.yml  \
         -o Global.pretrained_model=./pretrain_models/MobileNetV3_large_x0_5_pretrained

然后利用det_converter.py转换为自己的模型后,去预测的时候,就预测不出来了,可能是什么原因呢?

1、训练好的模型,利用PaddleOCR自带的预测命令,都可以预测对。
2、转换后的参数,可以正确的载入检测模型,但是文字一张都预测不出来。

转换pt模型报错

python ./converter/ch_ppocr_v2_rec_converter.py --src_model_path ./ch_PP-OCRv2_rec_train
文件路径:ch_PP-OCRv2_rec_train/best_accuracy/.pdopt、.pdparams、**.states
完整报错如下:
W1223 17:12:03.727869 23403 device_context.cc:404] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.0, Runtime API Version: 10.2
W1223 17:12:03.732515 23403 device_context.cc:422] device: 0, cuDNN Version: 8.0.
Traceback (most recent call last):
File "./converter/ch_ppocr_v2_rec_converter.py", line 80, in
converter = PPOCRv2RecConverter(cfg, paddle_pretrained_model_path)
File "./converter/ch_ppocr_v2_rec_converter.py", line 12, in init
para_state_dict, opti_state_dict = self.read_paddle_weights(paddle_pretrained_model_path)
File "/data/cxchen/PaddleOCR2Pytorch/pytorchocr/base_ocr_v20.py", line 94, in read_paddle_weights
para_state_dict, opti_state_dict = fluid.load_dygraph(weights_path)
File "/data/cxchen/venv/lib/python3.6/site-packages/paddle/fluid/dygraph/checkpoint.py", line 290, in load_dygraph
attrs={'file_path': os.path.join(model_path, name)})
File "/data/cxchen/venv/lib/python3.6/site-packages/paddle/fluid/dygraph/tracer.py", line 45, in trace_op
not stop_gradient)
ValueError: (InvalidArgument) Deserialize to tensor failed, maybe the loaded file is not a paddle model(expected file format: 0, but 1904018048 found).
[Hint: Expected version == 0U, but received version:1904018048 != 0U:0.] (at /paddle/paddle/fluid/framework/lod_tensor.cc:329)
[operator < load > error]

attention head weight shapes in paddle and pytorch model are different

I was able to convert the PP-structure paddle train model (best_accuracy.pdparams, best_accuracy.pdopt, best_accuracy.stated) to pytorch model (model.pth). However I realized that the model output is not the same as the paddle model. I did some investigation and I seems the paddle and the backbone weights are the same however the shape of the attention head in the pytorch model is different than the paddle model. This is a bug in the code. Would you be able to fix it?

Thanks

训练

大佬有想写训练部分的代码吗

How to convert pp-structure train model to onnx

I was able to convert the PP-structure paddle train model (best_accuracy.pdparams, best_accuracy.pdopt, best_accuracy.stated) to pytorch model (model.pth). How can I convert the model.pth to onnx model considering that model.pth is training model not inference model?
Should I convert the mode.pth( train) to inference model and then to onnx, or sth?

Thanks

ppv3_rec模型转换不成功

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'

端到端推理效果差

python tools/infer/predict_e2e.py --e2e_model_path ./en_server_pgnetA_infer.pth --image_dir D:\workspace\python\demo-test\test\OCR\img\20220413114341.jpg --e2e_a
lgorithm PGNet --e2e_pgnet_polygon True --e2e_char_dict_path .\pytorchocr\utils\dict\chinese_cht_dict.txt --vis_font_path doc\fonts\chinese_cht.ttf --e2e_yaml_path ./configs/e2e/e2
e_r50_vd_pg.yml

执行上面的命令
效果很差

KeyError: 'backbone.conv1_1._conv.weight'

raceback (most recent call last):
  File "./converter/det_converter.py", line 95, in <module>
    converter = DetV20DetConverter(cfg, paddle_pretrained_model_path, **kwargs)
  File "./converter/det_converter.py", line 12, in __init__
    self.load_paddle_weights(paddle_pretrained_model_path)
  File "./converter/det_converter.py", line 57, in load_paddle_weights
    self.net.state_dict()[k].copy_(torch.Tensor(para_state_dict[ppname]))
KeyError: 'backbone.conv1_1._conv.weight'

请问作者已经转化好的ptocr模型是基于pytorch哪个版本的呢?另:我保存成pt文件时会出错是什么原因您知道吗?

我想转化成Android可以使用的pt或ptl文件,使用官方提供的转化手段如下:
在predict_det.pt加载好检测的v3模型后添加代码如下:
example = torch.rand(1, 3, 640, 640)
traced_script_module = torch.jit.trace(self.net, example)
traced_script_module_optimized = optimize_for_mobile(traced_script_module)
traced_script_module_optimized._save_for_lite_interpreter("ptocr_v3_det.ptl")
出现如下错误:
image
Encountering a dict at the output of the tracer might cause the trace to be incorrect, this is only valid if the container structure does not change based on the module's inputs. Consider using a constant container instead (e.g. for list, use a tuple instead. for dict, use a NamedTuple instead). If you absolutely need this and know the side effects, pass strict=False to trace() to allow this behavior.
请问您有什么思路或者解决办法吗?或者后续会提供保存好的pt模型吗?
非常感谢!!!

【bug提交】tps.py

tps.py 中 GridGenerator类中的build_C_paddle和build_P_paddle两个函数生成的张量未添加GPU支持。在模型使用GPU运行时,会导致182与183行出现RuntimeError: Expected object of backend CUDA but got backend CPU for argument #2 'mat2'

ppocr-v3中文识别模型预测结果与paddle的不一致

请问下对pytorch版本有要求吗?我使用ch_ptocr_v3_rec_infer.pth的识别结果:

python ./tools/infer/predict_rec.py --rec_algorithm SVTR --rec_model_path ./ch_ptocr_v3_rec_infer.pth --rec_image_shape 3,48,320 --image_dir test.jpg

('注室你的以发一夜七发使用4突击步检命中头部海淡了', 0.74806666)

以下是paddleocr的识别结果:

paddleocr --image_dir  test.jpg --det false

('主室你的队友一液七次i使用AKM突击步枪命中头部淘汰了', 0.9387470483779907)

test

KeyError: 'Student.backbone.conv1._conv.weight

运行ch_ppocr_v2_rec_converter.py 出现

Traceback (most recent call last):
  File "/home/user/paddle/PaddleOCR2Pytorch/converter/ch_ppocr_v2_rec_converter.py", line 56, 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 "/home/user/paddle/PaddleOCR2Pytorch/converter/ch_ppocr_v2_rec_converter.py", line 80, in <module>
    converter = PPOCRv2RecConverter(cfg, paddle_pretrained_model_path)
  File "/home/user/paddle/PaddleOCR2Pytorch/converter/ch_ppocr_v2_rec_converter.py", line 19, in __init__
    self.load_paddle_weights([para_state_dict, opti_state_dict])
  File "/home/user/paddle/PaddleOCR2Pytorch/converter/ch_ppocr_v2_rec_converter.py", line 60, in load_paddle_weights
    print('paddle: {}, {}'.format(ppname, para_state_dict[ppname].shape))
KeyError: 'Student.backbone.conv1._conv.weight'

paddle 模型:ch_ppocr_server_v2.0_rec_pre

关于服务部署

你好, 感谢您分享的pytorch版ppocr模型.
想说能否提供torchserve的部署方案和文档呢?

GRUCell模块转写bias问题

        self.rnn = nn.GRUCell(input_size=input_size + num_embeddings, hidden_size=hidden_size)
  • 经过查各自API,发现Paddle中的GRUCellbias默认为None,作者转写对应GRUCell设置为bias=True
  • 不知是您笔误,还是有其他用法

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.