Closed lpj0822 closed 3 years ago
OCR数据格式:json
带有训练的dbnet+crnn ocr代码: https://github.com/WenmuZhou/PytorchOCR
ocr在json文件中的格式:
{
"annotation": "Annotations",
"database": "lpj_dataset",
"filename": "000008.png",
"folder": "JPEGImages",
"objectCount": 2,
"objects": {
"ocrObject": [
{
"class": "others", /* ‘machine printed’ or ‘handwritten’ or ‘others’ */
"polygon": [
1221,
644,
1234,
636,
1248,
633,
1270,
634,
1274,
645,
1284,
657,
1267,
664,
1240,
663,
1221,
664,
1217,
657
],
"pointCount": 10,
"transcription": "my name",
"language": "english",
"illegibility": 0
}
]
},
"owner": "lpj",
"path": "/home/lpj/Desktop/test_img/JPEGImages/000008.png",
"size": {
"depth": 3,
"height": 1080,
"width": 1920
}
}
ocr数据已上传,路径在数据集/公开数据/文字识别数据
数据格式已经确定
dbnet与CRNN inference编写完成
dbnet权重模型转换
resnet18不同: resnet 比对感觉head_type = 2,初始通道是32,
id | pytorchocr层名 | pytorchocr层大小 | 我们的层名 | 我们的层大小 0 backbone.conv1.0.conv.weight torch.Size([32, 3, 3, 3]) baseNet_0.convBNActivationBlock_0.block.convolutional.weight torch.Size([32, 3, 3, 3]) 1 backbone.conv1.0.bn.weight torch.Size([32]) baseNet_0.convBNActivationBlock_0.block.bn2d.weight torch.Size([32]) 2 backbone.conv1.0.bn.bias torch.Size([32]) baseNet_0.convBNActivationBlock_0.block.bn2d.bias torch.Size([32]) 3 backbone.conv1.0.bn.running_mean torch.Size([32]) baseNet_0.convBNActivationBlock_0.block.bn2d.running_mean torch.Size([32]) 4 backbone.conv1.0.bn.running_var torch.Size([32]) baseNet_0.convBNActivationBlock_0.block.bn2d.running_var torch.Size([32]) 5 backbone.conv1.1.conv.weight torch.Size([32, 32, 3, 3]) baseNet_0.convBNActivationBlock_1.block.convolutional.weight torch.Size([32, 32, 3, 3]) 6 backbone.conv1.1.bn.weight torch.Size([32]) baseNet_0.convBNActivationBlock_1.block.bn2d.weight torch.Size([32]) 7 backbone.conv1.1.bn.bias torch.Size([32]) baseNet_0.convBNActivationBlock_1.block.bn2d.bias torch.Size([32]) 8 backbone.conv1.1.bn.running_mean torch.Size([32]) baseNet_0.convBNActivationBlock_1.block.bn2d.running_mean torch.Size([32]) 9 backbone.conv1.1.bn.running_var torch.Size([32]) baseNet_0.convBNActivationBlock_1.block.bn2d.running_var torch.Size([32]) 10 backbone.conv1.2.conv.weight torch.Size([64, 32, 3, 3]) baseNet_0.convBNActivationBlock_2.block.convolutional.weight torch.Size([32, 32, 3, 3]) 11 backbone.conv1.2.bn.weight torch.Size([64]) baseNet_0.convBNActivationBlock_2.block.bn2d.weight torch.Size([32]) 12 backbone.conv1.2.bn.bias torch.Size([64]) baseNet_0.convBNActivationBlock_2.block.bn2d.bias torch.Size([32]) 13 backbone.conv1.2.bn.running_mean torch.Size([64]) baseNet_0.convBNActivationBlock_2.block.bn2d.running_mean torch.Size([32]) 14 backbone.conv1.2.bn.running_var torch.Size([64]) baseNet_0.convBNActivationBlock_2.block.bn2d.running_var torch.Size([32]) 15 backbone.stages.0.0.conv0.conv.weight torch.Size([64, 64, 3, 3]) baseNet_0.down_residualBlock_3.residual.0.block.convolutional.weight torch.Size([64, 32, 3, 3]) 16 backbone.stages.0.0.conv0.bn.weight torch.Size([64]) baseNet_0.down_residualBlock_3.residual.0.block.bn2d.weight torch.Size([64]) 17 backbone.stages.0.0.conv0.bn.bias torch.Size([64]) baseNet_0.down_residualBlock_3.residual.0.block.bn2d.bias torch.Size([64]) 18 backbone.stages.0.0.conv0.bn.running_mean torch.Size([64]) baseNet_0.down_residualBlock_3.residual.0.block.bn2d.running_mean torch.Size([64]) 19 backbone.stages.0.0.conv0.bn.running_var torch.Size([64]) baseNet_0.down_residualBlock_3.residual.0.block.bn2d.running_var torch.Size([64]) 20 backbone.stages.0.0.conv1.conv.weight torch.Size([64, 64, 3, 3]) baseNet_0.down_residualBlock_3.residual.1.block.convolutional.weight torch.Size([64, 64, 3, 3]) 21 backbone.stages.0.0.conv1.bn.weight torch.Size([64]) baseNet_0.down_residualBlock_3.residual.1.block.bn2d.weight torch.Size([64]) 22 backbone.stages.0.0.conv1.bn.bias torch.Size([64]) baseNet_0.down_residualBlock_3.residual.1.block.bn2d.bias torch.Size([64]) 23 backbone.stages.0.0.conv1.bn.running_mean torch.Size([64]) baseNet_0.down_residualBlock_3.residual.1.block.bn2d.running_mean torch.Size([64]) 24 backbone.stages.0.0.conv1.bn.running_var torch.Size([64]) baseNet_0.down_residualBlock_3.residual.1.block.bn2d.running_var torch.Size([64]) 25 backbone.stages.0.0.shortcut.conv.conv.weight torch.Size([64, 64, 1, 1]) baseNet_0.down_residualBlock_3.shortcut.block.convolutional.weight torch.Size([64, 32, 1, 1]) 26 backbone.stages.0.0.shortcut.conv.bn.weight torch.Size([64]) baseNet_0.down_residualBlock_3.shortcut.block.bn2d.weight torch.Size([64]) 27 backbone.stages.0.0.shortcut.conv.bn.bias torch.Size([64]) baseNet_0.down_residualBlock_3.shortcut.block.bn2d.bias torch.Size([64]) 28 backbone.stages.0.0.shortcut.conv.bn.running_mean torch.Size([64]) baseNet_0.down_residualBlock_3.shortcut.block.bn2d.running_mean torch.Size([64]) 29 backbone.stages.0.0.shortcut.conv.bn.running_var torch.Size([64]) baseNet_0.down_residualBlock_3.shortcut.block.bn2d.running_var torch.Size([64]) 30 backbone.stages.0.1.conv0.conv.weight torch.Size([64, 64, 3, 3]) baseNet_0.residualBlock_4.residual.0.block.convolutional.weight torch.Size([64, 64, 3, 3]) 31 backbone.stages.0.1.conv0.bn.weight torch.Size([64]) baseNet_0.residualBlock_4.residual.0.block.bn2d.weight torch.Size([64]) 32 backbone.stages.0.1.conv0.bn.bias torch.Size([64]) baseNet_0.residualBlock_4.residual.0.block.bn2d.bias torch.Size([64]) 33 backbone.stages.0.1.conv0.bn.running_mean torch.Size([64]) baseNet_0.residualBlock_4.residual.0.block.bn2d.running_mean torch.Size([64]) 34 backbone.stages.0.1.conv0.bn.running_var torch.Size([64]) baseNet_0.residualBlock_4.residual.0.block.bn2d.running_var torch.Size([64]) 35 backbone.stages.0.1.conv1.conv.weight torch.Size([64, 64, 3, 3]) baseNet_0.residualBlock_4.residual.1.block.convolutional.weight torch.Size([64, 64, 3, 3]) 36 backbone.stages.0.1.conv1.bn.weight torch.Size([64]) baseNet_0.residualBlock_4.residual.1.block.bn2d.weight torch.Size([64]) 37 backbone.stages.0.1.conv1.bn.bias torch.Size([64]) baseNet_0.residualBlock_4.residual.1.block.bn2d.bias torch.Size([64]) 38 backbone.stages.0.1.conv1.bn.running_mean torch.Size([64]) baseNet_0.residualBlock_4.residual.1.block.bn2d.running_mean torch.Size([64]) 39 backbone.stages.0.1.conv1.bn.running_var torch.Size([64]) baseNet_0.residualBlock_4.residual.1.block.bn2d.running_var torch.Size([64]) 40 backbone.stages.1.0.conv0.conv.weight torch.Size([128, 64, 3, 3]) baseNet_0.down_residualBlock_5.residual.0.block.convolutional.weight torch.Size([128, 64, 3, 3]) 41 backbone.stages.1.0.conv0.bn.weight torch.Size([128]) baseNet_0.down_residualBlock_5.residual.0.block.bn2d.weight torch.Size([128]) 42 backbone.stages.1.0.conv0.bn.bias torch.Size([128]) baseNet_0.down_residualBlock_5.residual.0.block.bn2d.bias torch.Size([128]) 43 backbone.stages.1.0.conv0.bn.running_mean torch.Size([128]) baseNet_0.down_residualBlock_5.residual.0.block.bn2d.running_mean torch.Size([128]) 44 backbone.stages.1.0.conv0.bn.running_var torch.Size([128]) baseNet_0.down_residualBlock_5.residual.0.block.bn2d.running_var torch.Size([128]) 45 backbone.stages.1.0.conv1.conv.weight torch.Size([128, 128, 3, 3]) baseNet_0.down_residualBlock_5.residual.1.block.convolutional.weight torch.Size([128, 128, 3, 3]) 46 backbone.stages.1.0.conv1.bn.weight torch.Size([128]) baseNet_0.down_residualBlock_5.residual.1.block.bn2d.weight torch.Size([128]) 47 backbone.stages.1.0.conv1.bn.bias torch.Size([128]) baseNet_0.down_residualBlock_5.residual.1.block.bn2d.bias torch.Size([128]) 48 backbone.stages.1.0.conv1.bn.running_mean torch.Size([128]) baseNet_0.down_residualBlock_5.residual.1.block.bn2d.running_mean torch.Size([128]) 49 backbone.stages.1.0.conv1.bn.running_var torch.Size([128]) baseNet_0.down_residualBlock_5.residual.1.block.bn2d.running_var torch.Size([128]) 50 backbone.stages.1.0.shortcut.conv.conv.weight torch.Size([128, 64, 1, 1]) baseNet_0.down_residualBlock_5.shortcut.block.convolutional.weight torch.Size([128, 64, 1, 1]) 51 backbone.stages.1.0.shortcut.conv.bn.weight torch.Size([128]) baseNet_0.down_residualBlock_5.shortcut.block.bn2d.weight torch.Size([128]) 52 backbone.stages.1.0.shortcut.conv.bn.bias torch.Size([128]) baseNet_0.down_residualBlock_5.shortcut.block.bn2d.bias torch.Size([128]) 53 backbone.stages.1.0.shortcut.conv.bn.running_mean torch.Size([128]) baseNet_0.down_residualBlock_5.shortcut.block.bn2d.running_mean torch.Size([128]) 54 backbone.stages.1.0.shortcut.conv.bn.running_var torch.Size([128]) baseNet_0.down_residualBlock_5.shortcut.block.bn2d.running_var torch.Size([128]) 55 backbone.stages.1.1.conv0.conv.weight torch.Size([128, 128, 3, 3]) baseNet_0.residualBlock_6.residual.0.block.convolutional.weight torch.Size([128, 128, 3, 3]) 56 backbone.stages.1.1.conv0.bn.weight torch.Size([128]) baseNet_0.residualBlock_6.residual.0.block.bn2d.weight torch.Size([128]) 57 backbone.stages.1.1.conv0.bn.bias torch.Size([128]) baseNet_0.residualBlock_6.residual.0.block.bn2d.bias torch.Size([128]) 58 backbone.stages.1.1.conv0.bn.running_mean torch.Size([128]) baseNet_0.residualBlock_6.residual.0.block.bn2d.running_mean torch.Size([128]) 59 backbone.stages.1.1.conv0.bn.running_var torch.Size([128]) baseNet_0.residualBlock_6.residual.0.block.bn2d.running_var torch.Size([128]) 60 backbone.stages.1.1.conv1.conv.weight torch.Size([128, 128, 3, 3]) baseNet_0.residualBlock_6.residual.1.block.convolutional.weight torch.Size([128, 128, 3, 3]) 61 backbone.stages.1.1.conv1.bn.weight torch.Size([128]) baseNet_0.residualBlock_6.residual.1.block.bn2d.weight torch.Size([128]) 62 backbone.stages.1.1.conv1.bn.bias torch.Size([128]) baseNet_0.residualBlock_6.residual.1.block.bn2d.bias torch.Size([128]) 63 backbone.stages.1.1.conv1.bn.running_mean torch.Size([128]) baseNet_0.residualBlock_6.residual.1.block.bn2d.running_mean torch.Size([128]) 64 backbone.stages.1.1.conv1.bn.running_var torch.Size([128]) baseNet_0.residualBlock_6.residual.1.block.bn2d.running_var torch.Size([128]) 65 backbone.stages.2.0.conv0.conv.weight torch.Size([256, 128, 3, 3]) baseNet_0.down_residualBlock_7.residual.0.block.convolutional.weight torch.Size([256, 128, 3, 3]) 66 backbone.stages.2.0.conv0.bn.weight torch.Size([256]) baseNet_0.down_residualBlock_7.residual.0.block.bn2d.weight torch.Size([256]) 67 backbone.stages.2.0.conv0.bn.bias torch.Size([256]) baseNet_0.down_residualBlock_7.residual.0.block.bn2d.bias torch.Size([256]) 68 backbone.stages.2.0.conv0.bn.running_mean torch.Size([256]) baseNet_0.down_residualBlock_7.residual.0.block.bn2d.running_mean torch.Size([256]) 69 backbone.stages.2.0.conv0.bn.running_var torch.Size([256]) baseNet_0.down_residualBlock_7.residual.0.block.bn2d.running_var torch.Size([256]) 70 backbone.stages.2.0.conv1.conv.weight torch.Size([256, 256, 3, 3]) baseNet_0.down_residualBlock_7.residual.1.block.convolutional.weight torch.Size([256, 256, 3, 3]) 71 backbone.stages.2.0.conv1.bn.weight torch.Size([256]) baseNet_0.down_residualBlock_7.residual.1.block.bn2d.weight torch.Size([256]) 72 backbone.stages.2.0.conv1.bn.bias torch.Size([256]) baseNet_0.down_residualBlock_7.residual.1.block.bn2d.bias torch.Size([256]) 73 backbone.stages.2.0.conv1.bn.running_mean torch.Size([256]) baseNet_0.down_residualBlock_7.residual.1.block.bn2d.running_mean torch.Size([256]) 74 backbone.stages.2.0.conv1.bn.running_var torch.Size([256]) baseNet_0.down_residualBlock_7.residual.1.block.bn2d.running_var torch.Size([256]) 75 backbone.stages.2.0.shortcut.conv.conv.weight torch.Size([256, 128, 1, 1]) baseNet_0.down_residualBlock_7.shortcut.block.convolutional.weight torch.Size([256, 128, 1, 1]) 76 backbone.stages.2.0.shortcut.conv.bn.weight torch.Size([256]) baseNet_0.down_residualBlock_7.shortcut.block.bn2d.weight torch.Size([256]) 77 backbone.stages.2.0.shortcut.conv.bn.bias torch.Size([256]) baseNet_0.down_residualBlock_7.shortcut.block.bn2d.bias torch.Size([256]) 78 backbone.stages.2.0.shortcut.conv.bn.running_mean torch.Size([256]) baseNet_0.down_residualBlock_7.shortcut.block.bn2d.running_mean torch.Size([256]) 79 backbone.stages.2.0.shortcut.conv.bn.running_var torch.Size([256]) baseNet_0.down_residualBlock_7.shortcut.block.bn2d.running_var torch.Size([256]) 80 backbone.stages.2.1.conv0.conv.weight torch.Size([256, 256, 3, 3]) baseNet_0.residualBlock_8.residual.0.block.convolutional.weight torch.Size([256, 256, 3, 3]) 81 backbone.stages.2.1.conv0.bn.weight torch.Size([256]) baseNet_0.residualBlock_8.residual.0.block.bn2d.weight torch.Size([256]) 82 backbone.stages.2.1.conv0.bn.bias torch.Size([256]) baseNet_0.residualBlock_8.residual.0.block.bn2d.bias torch.Size([256]) 83 backbone.stages.2.1.conv0.bn.running_mean torch.Size([256]) baseNet_0.residualBlock_8.residual.0.block.bn2d.running_mean torch.Size([256]) 84 backbone.stages.2.1.conv0.bn.running_var torch.Size([256]) baseNet_0.residualBlock_8.residual.0.block.bn2d.running_var torch.Size([256]) 85 backbone.stages.2.1.conv1.conv.weight torch.Size([256, 256, 3, 3]) baseNet_0.residualBlock_8.residual.1.block.convolutional.weight torch.Size([256, 256, 3, 3]) 86 backbone.stages.2.1.conv1.bn.weight torch.Size([256]) baseNet_0.residualBlock_8.residual.1.block.bn2d.weight torch.Size([256]) 87 backbone.stages.2.1.conv1.bn.bias torch.Size([256]) baseNet_0.residualBlock_8.residual.1.block.bn2d.bias torch.Size([256]) 88 backbone.stages.2.1.conv1.bn.running_mean torch.Size([256]) baseNet_0.residualBlock_8.residual.1.block.bn2d.running_mean torch.Size([256]) 89 backbone.stages.2.1.conv1.bn.running_var torch.Size([256]) baseNet_0.residualBlock_8.residual.1.block.bn2d.running_var torch.Size([256]) 90 backbone.stages.3.0.conv0.conv.weight torch.Size([512, 256, 3, 3]) baseNet_0.down_residualBlock_9.residual.0.block.convolutional.weight torch.Size([512, 256, 3, 3]) 91 backbone.stages.3.0.conv0.bn.weight torch.Size([512]) baseNet_0.down_residualBlock_9.residual.0.block.bn2d.weight torch.Size([512]) 92 backbone.stages.3.0.conv0.bn.bias torch.Size([512]) baseNet_0.down_residualBlock_9.residual.0.block.bn2d.bias torch.Size([512]) 93 backbone.stages.3.0.conv0.bn.running_mean torch.Size([512]) baseNet_0.down_residualBlock_9.residual.0.block.bn2d.running_mean torch.Size([512]) 94 backbone.stages.3.0.conv0.bn.running_var torch.Size([512]) baseNet_0.down_residualBlock_9.residual.0.block.bn2d.running_var torch.Size([512]) 95 backbone.stages.3.0.conv1.conv.weight torch.Size([512, 512, 3, 3]) baseNet_0.down_residualBlock_9.residual.1.block.convolutional.weight torch.Size([512, 512, 3, 3]) 96 backbone.stages.3.0.conv1.bn.weight torch.Size([512]) baseNet_0.down_residualBlock_9.residual.1.block.bn2d.weight torch.Size([512]) 97 backbone.stages.3.0.conv1.bn.bias torch.Size([512]) baseNet_0.down_residualBlock_9.residual.1.block.bn2d.bias torch.Size([512]) 98 backbone.stages.3.0.conv1.bn.running_mean torch.Size([512]) baseNet_0.down_residualBlock_9.residual.1.block.bn2d.running_mean torch.Size([512]) 99 backbone.stages.3.0.conv1.bn.running_var torch.Size([512]) baseNet_0.down_residualBlock_9.residual.1.block.bn2d.running_var torch.Size([512]) 100 backbone.stages.3.0.shortcut.conv.conv.weight torch.Size([512, 256, 1, 1]) baseNet_0.down_residualBlock_9.shortcut.block.convolutional.weight torch.Size([512, 256, 1, 1]) 101 backbone.stages.3.0.shortcut.conv.bn.weight torch.Size([512]) baseNet_0.down_residualBlock_9.shortcut.block.bn2d.weight torch.Size([512]) 102 backbone.stages.3.0.shortcut.conv.bn.bias torch.Size([512]) baseNet_0.down_residualBlock_9.shortcut.block.bn2d.bias torch.Size([512]) 103 backbone.stages.3.0.shortcut.conv.bn.running_mean torch.Size([512]) baseNet_0.down_residualBlock_9.shortcut.block.bn2d.running_mean torch.Size([512]) 104 backbone.stages.3.0.shortcut.conv.bn.running_var torch.Size([512]) baseNet_0.down_residualBlock_9.shortcut.block.bn2d.running_var torch.Size([512]) 105 backbone.stages.3.1.conv0.conv.weight torch.Size([512, 512, 3, 3]) baseNet_0.residualBlock_10.residual.0.block.convolutional.weight torch.Size([512, 512, 3, 3]) 106 backbone.stages.3.1.conv0.bn.weight torch.Size([512]) baseNet_0.residualBlock_10.residual.0.block.bn2d.weight torch.Size([512]) 107 backbone.stages.3.1.conv0.bn.bias torch.Size([512]) baseNet_0.residualBlock_10.residual.0.block.bn2d.bias torch.Size([512]) 108 backbone.stages.3.1.conv0.bn.running_mean torch.Size([512]) baseNet_0.residualBlock_10.residual.0.block.bn2d.running_mean torch.Size([512]) 109 backbone.stages.3.1.conv0.bn.running_var torch.Size([512]) baseNet_0.residualBlock_10.residual.0.block.bn2d.running_var torch.Size([512]) 110 backbone.stages.3.1.conv1.conv.weight torch.Size([512, 512, 3, 3]) baseNet_0.residualBlock_10.residual.1.block.convolutional.weight torch.Size([512, 512, 3, 3]) 111 backbone.stages.3.1.conv1.bn.weight torch.Size([512]) baseNet_0.residualBlock_10.residual.1.block.bn2d.weight torch.Size([512]) 112 backbone.stages.3.1.conv1.bn.bias torch.Size([512]) baseNet_0.residualBlock_10.residual.1.block.bn2d.bias torch.Size([512]) 113 backbone.stages.3.1.conv1.bn.running_mean torch.Size([512]) baseNet_0.residualBlock_10.residual.1.block.bn2d.running_mean torch.Size([512]) 114 backbone.stages.3.1.conv1.bn.running_var torch.Size([512]) baseNet_0.residualBlock_10.residual.1.block.bn2d.running_var torch.Size([512])
反卷积没有bias: head.binarize.conv2.weight torch.Size([64, 64, 2, 2]) dbHead_2.binarize.conv2.block.deconv.weight torch.Size([64, 64, 2, 2]) head.binarize.conv2.bias torch.Size([64]) 缺少bias
@lpj0822
crnn中的MobileNetv3也有不同,少了第二层卷积torch.Size([8, 8, 1, 1]):
id | pytorchocr层名 | pytorchocr层大小 | 我们的层名 | 我们的层大小
0 backbone.conv1.conv.weight torch.Size([8, 3, 3, 3]) baseNet_0.convBNActivationBlock_0.block.convolutional.weight torch.Size([8, 3, 3, 3])
1 backbone.conv1.bn.weight torch.Size([8]) baseNet_0.convBNActivationBlock_0.block.bn2d.weight torch.Size([8])
2 backbone.conv1.bn.bias torch.Size([8]) baseNet_0.convBNActivationBlock_0.block.bn2d.bias torch.Size([8])
3 backbone.conv1.bn.running_mean torch.Size([8]) baseNet_0.convBNActivationBlock_0.block.bn2d.running_mean torch.Size([8])
4 backbone.conv1.bn.running_var torch.Size([8]) baseNet_0.convBNActivationBlock_0.block.bn2d.running_var torch.Size([8])
5 backbone.blocks.0.expand_conv.conv.weight torch.Size([8, 8, 1, 1]) baseNet_0.invertedResidualV2_1.block.convBNActivationBlock_1.block.convolutional.weight torch.Size([8, 1, 3, 3])
6 backbone.blocks.0.expand_conv.bn.weight torch.Size([8]) baseNet_0.invertedResidualV2_1.block.convBNActivationBlock_1.block.bn2d.weight torch.Size([8])
7 backbone.blocks.0.expand_conv.bn.bias torch.Size([8]) baseNet_0.invertedResidualV2_1.block.convBNActivationBlock_1.block.bn2d.bias torch.Size([8])
8 backbone.blocks.0.expand_conv.bn.running_mean torch.Size([8]) baseNet_0.invertedResidualV2_1.block.convBNActivationBlock_1.block.bn2d.running_mean torch.Size([8])
9 backbone.blocks.0.expand_conv.bn.running_var torch.Size([8]) baseNet_0.invertedResidualV2_1.block.convBNActivationBlock_1.block.bn2d.running_var torch.Size([8])
@lpj0822
少了一层1*1的卷积:
0 backbone.conv1.0.conv.weight torch.Size([32, 3, 3, 3]) baseNet_0.convBNActivationBlock_0.block.convolutional.weight torch.Size([32, 3, 3, 3])
1 backbone.conv1.0.bn.weight torch.Size([32]) baseNet_0.convBNActivationBlock_0.block.bn2d.weight torch.Size([32])
2 backbone.conv1.0.bn.bias torch.Size([32]) baseNet_0.convBNActivationBlock_0.block.bn2d.bias torch.Size([32])
3 backbone.conv1.0.bn.running_mean torch.Size([32]) baseNet_0.convBNActivationBlock_0.block.bn2d.running_mean torch.Size([32])
4 backbone.conv1.0.bn.running_var torch.Size([32]) baseNet_0.convBNActivationBlock_0.block.bn2d.running_var torch.Size([32])
5 backbone.conv1.1.conv.weight torch.Size([32, 32, 3, 3]) baseNet_0.convBNActivationBlock_1.block.convolutional.weight torch.Size([32, 32, 3, 3])
6 backbone.conv1.1.bn.weight torch.Size([32]) baseNet_0.convBNActivationBlock_1.block.bn2d.weight torch.Size([32])
7 backbone.conv1.1.bn.bias torch.Size([32]) baseNet_0.convBNActivationBlock_1.block.bn2d.bias torch.Size([32])
8 backbone.conv1.1.bn.running_mean torch.Size([32]) baseNet_0.convBNActivationBlock_1.block.bn2d.running_mean torch.Size([32])
9 backbone.conv1.1.bn.running_var torch.Size([32]) baseNet_0.convBNActivationBlock_1.block.bn2d.running_var torch.Size([32])
10 backbone.conv1.2.conv.weight torch.Size([64, 32, 3, 3]) baseNet_0.convBNActivationBlock_2.block.convolutional.weight torch.Size([64, 32, 3, 3])
11 backbone.conv1.2.bn.weight torch.Size([64]) baseNet_0.convBNActivationBlock_2.block.bn2d.weight torch.Size([64])
12 backbone.conv1.2.bn.bias torch.Size([64]) baseNet_0.convBNActivationBlock_2.block.bn2d.bias torch.Size([64])
13 backbone.conv1.2.bn.running_mean torch.Size([64]) baseNet_0.convBNActivationBlock_2.block.bn2d.running_mean torch.Size([64])
14 backbone.conv1.2.bn.running_var torch.Size([64]) baseNet_0.convBNActivationBlock_2.block.bn2d.running_var torch.Size([64])
15 backbone.stages.0.0.conv0.conv.weight torch.Size([64, 64, 3, 3]) baseNet_0.down_residualBlock_4.residual.0.block.convolutional.weight torch.Size([64, 64, 3, 3])
16 backbone.stages.0.0.conv0.bn.weight torch.Size([64]) baseNet_0.down_residualBlock_4.residual.0.block.bn2d.weight torch.Size([64])
17 backbone.stages.0.0.conv0.bn.bias torch.Size([64]) baseNet_0.down_residualBlock_4.residual.0.block.bn2d.bias torch.Size([64])
18 backbone.stages.0.0.conv0.bn.running_mean torch.Size([64]) baseNet_0.down_residualBlock_4.residual.0.block.bn2d.running_mean torch.Size([64])
19 backbone.stages.0.0.conv0.bn.running_var torch.Size([64]) baseNet_0.down_residualBlock_4.residual.0.block.bn2d.running_var torch.Size([64])
20 backbone.stages.0.0.conv1.conv.weight torch.Size([64, 64, 3, 3]) baseNet_0.down_residualBlock_4.residual.1.block.convolutional.weight torch.Size([64, 64, 3, 3])
21 backbone.stages.0.0.conv1.bn.weight torch.Size([64]) baseNet_0.down_residualBlock_4.residual.1.block.bn2d.weight torch.Size([64])
22 backbone.stages.0.0.conv1.bn.bias torch.Size([64]) baseNet_0.down_residualBlock_4.residual.1.block.bn2d.bias torch.Size([64])
23 backbone.stages.0.0.conv1.bn.running_mean torch.Size([64]) baseNet_0.down_residualBlock_4.residual.1.block.bn2d.running_mean torch.Size([64])
24 backbone.stages.0.0.conv1.bn.running_var torch.Size([64]) baseNet_0.down_residualBlock_4.residual.1.block.bn2d.running_var torch.Size([64])
25 backbone.stages.0.0.shortcut.conv.conv.weight torch.Size([64, 64, 1, 1]) baseNet_0.residualBlock_5.residual.0.block.convolutional.weight torch.Size([64, 64, 3, 3])
26 backbone.stages.0.0.shortcut.conv.bn.weight torch.Size([64]) baseNet_0.residualBlock_5.residual.0.block.bn2d.weight torch.Size([64])
27 backbone.stages.0.0.shortcut.conv.bn.bias torch.Size([64]) baseNet_0.residualBlock_5.residual.0.block.bn2d.bias torch.Size([64])
28 backbone.stages.0.0.shortcut.conv.bn.running_mean torch.Size([64]) baseNet_0.residualBlock_5.residual.0.block.bn2d.running_mean torch.Size([64])
29 backbone.stages.0.0.shortcut.conv.bn.running_var torch.Size([64]) baseNet_0.residualBlock_5.residual.0.block.bn2d.running_var torch.Size([64])
@lpj0822
已经修改
dbnet模型已经上传,在百度网盘下:深度学习模型文件/pytorch/pytorch_ocr下面
crnn中的最后fc参数不匹配:
227 fcLinear_3.weight torch.Size([6625, 96]) torch.Size([93, 96])
228 fcLinear_3.bias torch.Size([6625]) torch.Size([93])
dbHead_2.binarize.conv1.block.convolutional.weight dbHead_2.thresh.conv1.block.convolutional.weight 缺少bn参数。
已经修改
dbnet已重新上传。
dbnet运行:
python3 easyai/inference_task.py -i /home/lpj/dataset/ocr_test -t polygon2d -m dbnet -w /home/lpj/dataset/dbnet.pt -s
新的CRNN已经上传。
dbnet infernce 已经跑通,可以多测试
LSTM中使用batch_first=False的需要在做一次transpose。
x_1 = torch.randn(100,200,512)
x_2 = x_1.transpose(0,1)
model_1 = torch.nn.LSTM(batch_first=True,hidden_size=1024,input_size=512)
model_2 = torch.nn.LSTM(batch_first=False,hidden_size=1024,input_size=512)
start_time_1 = time.time()
result_1 = model_1(x_1)
end_time_1 = time.time()
result_2 = model_2(x_2)
end_time_2 = time.time()
print(end_time_1 - start_time_1,end_time_2 - end_time_1)
rec text 运行:
python3 easyai/inference_task.py -t recognize_text -i /home/lpj/dataset/text_test -m CRNN -w /home/lpj/dataset/CRNN.pt
已测试,可以正常运行。
ocr 运行:
python3 ocr_infer.py --det_path /home/lpj/Downloads/ch_det_server_db_res18.pth --rec_path /home/lpj/Downloads/ch_rec_moblie_crnn_mbv3.pth --img_path /home/lpj/dataset/ocr_test/11.jpg
写错了,这是PytorchOCR的运行方式。
python3 easyai/inference_task.py -t ocr -i /home/lpj/Desktop/yolov3_person/MOT16-11-raw.mp4 -m dbnet -m CRNN -w dbnet权重 -w CRNN权重 -s
集装箱的识别数据上传到百度云:路径在数据集/公开数据/文字识别数据/ocr_recognize_data.zip
你可以跑ocr inference @foww-0001
inference已调通,训练还没有调试。
新ocr数据上传,路径在数据集/公开数据/文字识别数据/ICDAR2015.zip
train:
python3 easyai/train_task.py -t recognize_text -i /home/lpj/dataset/ocr/ICDAR2015/ImageSets/train.txt -v /home/lpj/dataset/ocr/ICDAR2015/ImageSets/val.txt -m CRNN
python3 easy_tools/easy_ai.py -t OCR -i /home/lpj/dataset/ocr/ICDAR2015/ImageSets/train.txt -v /home/lpj/dataset/ocr/ICDAR2015/ImageSets/val.txt
OCR的训练脚本,下位机转换 @foww-0001
ocr合成数据上传,在百度网盘上。文件名为图片字符。 @lpj0822
TextNet.sh运行
./easy_tools/train_scripts/TextNet.sh /home/lpj/dataset/ocr/ICDAR2015/ImageSets/train.txt /home/lpj/dataset/ocr/ICDAR2015/ImageSets/val.txt
文本识别
结构正在修改,加入几个loss(ACEloss),结果还在测试中。