Open birchmi opened 2 years ago
@mijunhua 请发一下完整的命令或代码
python ./tools/infer/predict_rec.py --image_dir ./doc/imgs/plate_1.jpg --rec_model_path ./pt_models/rec_models/rec_mv3_tps_bilstm_att_v2.0_infer.pth
{'fc_decay': 4e-05, 'in_channels': 96}
Traceback (most recent call last):
File "./tools/infer/predict_rec.py", line 294, in
@mijunhua 使用RARE模型的话,试试下面的命令
python ./tools/infer/predict_rec.py --rec_model_path ./pt_models/rec_models/rec_mv3_tps_bilstm_att_v2.0_infer.pth --image_dir ./doc/imgs/plate_1.jpg --rec_image_shape 3,32,100 --rec_char_type en --rec_algorithm RARE --rec_yaml_path ./configs/rec/rec_mv3_tps_bilstm_att.yml
@frotms I am having a similar error when I run
python ./tools/infer/predict_rec.py --rec_model_path /Users/sky/Documents/work_dataset_realestate/work_paddle_OCR/PyTorch_models/from_paul/ch_ptocr_v3_rec_infer.pth --image_dir /Users/sky/Documents/work_dataset_realestate/work_paddle_OCR/test_images/word_4.jpg --rec_image_shape 3,46,225 --rec_yaml_path /Users/sky/Documents/work_dataset_realestate/work_paddle_OCR/PaddleOCR2Pytorch/configs/rec/PP-OCRv3/ch_PP-OCRv3_rec.yml
The error I got is:
Traceback (most recent call last):
File "/Users/sky/Documents/work_dataset_realestate/work_paddle_OCR/PaddleOCR2Pytorch/./tools/infer/predict_rec.py", line 464, in
If I manually change the out_channels to " out_channels = list(weights.values())[-2].numpy().shape[0]". I get another error that reads:
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: "neck.encoder.conv1.conv.weight", "neck.encoder.conv1.norm.weight", "neck.encoder.conv1.norm.bias", "neck.encoder.conv1.norm.running_mean", "neck.encoder.conv1.norm.running_var", "neck.encoder.conv2.conv.weight", "neck.encoder.conv2.norm.weight", "neck.encoder.conv2.norm.bias", "neck.encoder.conv2.norm.running_mean", "neck.encoder.conv2.norm.running_var", "neck.encoder.svtr_block.0.norm1.weight", "neck.encoder.svtr_block.0.norm1.bias", "neck.encoder.svtr_block.0.mixer.qkv.weight", "neck.encoder.svtr_block.0.mixer.qkv.bias", "neck.encoder.svtr_block.0.mixer.proj.weight", "neck.encoder.svtr_block.0.mixer.proj.bias", "neck.encoder.svtr_block.0.norm2.weight", "neck.encoder.svtr_block.0.norm2.bias", "neck.encoder.svtr_block.0.mlp.fc1.weight", "neck.encoder.svtr_block.0.mlp.fc1.bias", "neck.encoder.svtr_block.0.mlp.fc2.weight", "neck.encoder.svtr_block.0.mlp.fc2.bias", "neck.encoder.svtr_block.1.norm1.weight", "neck.encoder.svtr_block.1.norm1.bias", "neck.encoder.svtr_block.1.mixer.qkv.weight", "neck.encoder.svtr_block.1.mixer.qkv.bias", "neck.encoder.svtr_block.1.mixer.proj.weight", "neck.encoder.svtr_block.1.mixer.proj.bias", "neck.encoder.svtr_block.1.norm2.weight", "neck.encoder.svtr_block.1.norm2.bias", "neck.encoder.svtr_block.1.mlp.fc1.weight", "neck.encoder.svtr_block.1.mlp.fc1.bias", "neck.encoder.svtr_block.1.mlp.fc2.weight", "neck.encoder.svtr_block.1.mlp.fc2.bias", "neck.encoder.norm.weight", "neck.encoder.norm.bias", "neck.encoder.conv3.conv.weight", "neck.encoder.conv3.norm.weight", "neck.encoder.conv3.norm.bias", "neck.encoder.conv3.norm.running_mean", "neck.encoder.conv3.norm.running_var", "neck.encoder.conv4.conv.weight", "neck.encoder.conv4.norm.weight", "neck.encoder.conv4.norm.bias", "neck.encoder.conv4.norm.running_mean", "neck.encoder.conv4.norm.running_var", "neck.encoder.conv1x1.conv.weight", "neck.encoder.conv1x1.norm.weight", "neck.encoder.conv1x1.norm.bias", "neck.encoder.conv1x1.norm.running_mean", "neck.encoder.conv1x1.norm.running_var". Unexpected key(s) in state_dict: "neck.conv1.conv.weight", "neck.conv1.bn.weight", "neck.conv1.bn.bias", "neck.conv1.bn.running_mean", "neck.conv1.bn.running_var", "neck.conv1.bn.num_batches_tracked", "neck.conv2.conv.weight", "neck.conv2.bn.weight", "neck.conv2.bn.bias", "neck.conv2.bn.running_mean", "neck.conv2.bn.running_var", "neck.conv2.bn.num_batches_tracked", "neck.svtr_block.0.norm1.weight", "neck.svtr_block.0.norm1.bias", "neck.svtr_block.0.mixer.qkv.weight", "neck.svtr_block.0.mixer.qkv.bias", "neck.svtr_block.0.mixer.proj.weight", "neck.svtr_block.0.mixer.proj.bias", "neck.svtr_block.0.norm2.weight", "neck.svtr_block.0.norm2.bias", "neck.svtr_block.0.mlp.fc1.weight", "neck.svtr_block.0.mlp.fc1.bias", "neck.svtr_block.0.mlp.fc2.weight", "neck.svtr_block.0.mlp.fc2.bias", "neck.svtr_block.1.norm1.weight", "neck.svtr_block.1.norm1.bias", "neck.svtr_block.1.mixer.qkv.weight", "neck.svtr_block.1.mixer.qkv.bias", "neck.svtr_block.1.mixer.proj.weight", "neck.svtr_block.1.mixer.proj.bias", "neck.svtr_block.1.norm2.weight", "neck.svtr_block.1.norm2.bias", "neck.svtr_block.1.mlp.fc1.weight", "neck.svtr_block.1.mlp.fc1.bias", "neck.svtr_block.1.mlp.fc2.weight", "neck.svtr_block.1.mlp.fc2.bias", "neck.norm.weight", "neck.norm.bias", "neck.conv3.conv.weight", "neck.conv3.bn.weight", "neck.conv3.bn.bias", "neck.conv3.bn.running_mean", "neck.conv3.bn.running_var", "neck.conv3.bn.num_batches_tracked", "neck.conv4.conv.weight", "neck.conv4.bn.weight", "neck.conv4.bn.bias", "neck.conv4.bn.running_mean", "neck.conv4.bn.running_var", "neck.conv4.bn.num_batches_tracked", "neck.conv1x1.conv.weight", "neck.conv1x1.bn.weight", "neck.conv1x1.bn.bias", "neck.conv1x1.bn.running_mean", "neck.conv1x1.bn.running_var", "neck.conv1x1.bn.num_batches_tracked". size mismatch for head.fc.weight: copying a param with shape torch.Size([6625, 64]) from checkpoint, the shape in current model is torch.Size([512, 64]). size mismatch for head.fc.bias: copying a param with shape torch.Size([6625]) from checkpoint, the shape in current model is torch.Size([512]).
Can you help?
字符识别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