GithubHelp home page GithubHelp logo

frotms / paddleocr2pytorch Goto Github PK

View Code? Open in Web Editor NEW
763.0 763.0 151.0 69.79 MB

PaddleOCR inference in PyTorch. Converted from [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)

License: Apache License 2.0

Python 99.83% Cython 0.17%
crnn db multilingual-models ocr paddleocr paddlepaddle pytorch pytorchocr

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

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

文字检测报错

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

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

使用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)

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'

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

作者好, 我尝试用 ./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

求助~

使用预训练模型出现 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)已经失效。

模型转换后用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. 模型在推理过程中精度较低,大部分推理错误,有少部分正确。 请问一下,这个和调整这些报错的参数有关系么?谢谢,该如何解决转换后精度低的问题

请问为什么同样的模型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要好一些,感觉很奇怪,麻烦懂的大大解答一下

训练

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

转换模型问题: 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目录下。我这是哪里不对?

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

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

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'

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

【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'

端到端推理效果差

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

执行上面的命令
效果很差

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".

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

关于服务部署

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

请问作者已经转化好的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模型吗?
非常感谢!!!

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.

GRUCell模块转写bias问题

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

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'

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

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

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.