Add multi-source CRNN recognizer and its character language model (v0.3)
Browse files- README.md +29 -8
- charlm6_scene-883dd7cd.json +0 -0
- crnn_resnet34_vd_scene-38393899.pth +3 -0
README.md
CHANGED
|
@@ -11,6 +11,9 @@ tags:
|
|
| 11 |
- pytorch
|
| 12 |
datasets:
|
| 13 |
- icdar2015
|
|
|
|
|
|
|
|
|
|
| 14 |
---
|
| 15 |
|
| 16 |
# torchocr weights
|
|
@@ -39,7 +42,8 @@ postprocess = DBPostProcessor(**weights.meta["postprocess"])
|
|
| 39 |
| `DBNet_MobileNetV3_Large_05_Weights.PPOCR_V3_EN` | `dbnet_mobilenet_v3_large_05_ppocr_v3_en-9bfd3b59.pth` | 0.60 M | hmean 0.441 ¹ |
|
| 40 |
| `DBNet_MobileNetV3_Large_05_Weights.PPOCR_V3_CH` | `dbnet_mobilenet_v3_large_05_ppocr_v3_ch-fc000d1e.pth` | 0.60 M | hmean 0.422 ¹ |
|
| 41 |
| `DBNet_ResNet18_VD_Weights.PPOCR_SERVER_V2` | `dbnet_resnet18_vd_ppocr_server_v2-59d99b11.pth` | 12.4 M | hmean 0.414 ¹ |
|
| 42 |
-
| `CRNN_ResNet34_VD_Weights.
|
|
|
|
| 43 |
| `CRNN_ResNet34_VD_Weights.PPOCR_SERVER_V2` | `crnn_resnet34_vd_ppocr_server_v2-803ba4c9.pth` | 27.9 M | word acc. 0.665 ² |
|
| 44 |
|
| 45 |
¹ Line-level detectors converted from PaddleOCR. ICDAR-2015 scores *word* boxes, so adjacent words
|
|
@@ -48,18 +52,30 @@ you will see on documents.
|
|
| 48 |
² 2077 alphanumeric care words of ICDAR-2015 test cropped from the full images with
|
| 49 |
`torchocr.ops.crop_quads` on their ground-truth quads, case-insensitive (not the official Task 4.3
|
| 50 |
crops). Axis-aligned crops of the same words score 0.579.
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
End to end (`OCRPipeline.from_pretrained`, image → text
|
| 53 |
-
read correctly, case-insensitive, generic vocabulary
|
| 54 |
-
`DBNet_ResNet18_VD_Weights.ICDAR2015` + `CRNN_ResNet34_VD_Weights.
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
```python
|
| 58 |
from torchocr import OCRPipeline, load_image
|
| 59 |
|
| 60 |
pipeline = OCRPipeline.from_pretrained(
|
| 61 |
-
"DBNet_ResNet18_VD_Weights.ICDAR2015", "CRNN_ResNet34_VD_Weights.
|
| 62 |
-
)
|
|
|
|
| 63 |
doc = pipeline(load_image("photo.jpg")) # doc.text, doc.polygons
|
| 64 |
```
|
| 65 |
|
|
@@ -77,7 +93,8 @@ python references/recognition/evaluate.py --root <icdar2015> --weights CRNN_ResN
|
|
| 77 |
|
| 78 |
### The `ICDAR2015` checkpoints
|
| 79 |
|
| 80 |
-
All
|
|
|
|
| 81 |
**last epoch** and no checkpoint or hyper-parameter was selected on the test set.
|
| 82 |
|
| 83 |
- `DBNet_ResNet18_VD_Weights.ICDAR2015`: `PPOCR_SERVER_V2` fine-tuned 300 epochs with the recipe below;
|
|
@@ -86,6 +103,10 @@ All three were fine-tuned by torchocr on the ICDAR-2015 training split only; rep
|
|
| 86 |
training words, cropped with `crop_quads` from jittered ground-truth quads
|
| 87 |
(`references/recognition/train.py`). It keeps PaddleOCR's Chinese + Latin charset but saw only Latin
|
| 88 |
scene text, so Chinese accuracy is no longer guaranteed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
- `DBNet_MobileNetV3_Large_05_Weights.ICDAR2015`, described next.
|
| 90 |
|
| 91 |
#### `DBNet_MobileNetV3_Large_05_Weights.ICDAR2015`
|
|
|
|
| 11 |
- pytorch
|
| 12 |
datasets:
|
| 13 |
- icdar2015
|
| 14 |
+
- total-text
|
| 15 |
+
- mlt2019
|
| 16 |
+
- funsd
|
| 17 |
---
|
| 18 |
|
| 19 |
# torchocr weights
|
|
|
|
| 42 |
| `DBNet_MobileNetV3_Large_05_Weights.PPOCR_V3_EN` | `dbnet_mobilenet_v3_large_05_ppocr_v3_en-9bfd3b59.pth` | 0.60 M | hmean 0.441 ¹ |
|
| 43 |
| `DBNet_MobileNetV3_Large_05_Weights.PPOCR_V3_CH` | `dbnet_mobilenet_v3_large_05_ppocr_v3_ch-fc000d1e.pth` | 0.60 M | hmean 0.422 ¹ |
|
| 44 |
| `DBNet_ResNet18_VD_Weights.PPOCR_SERVER_V2` | `dbnet_resnet18_vd_ppocr_server_v2-59d99b11.pth` | 12.4 M | hmean 0.414 ¹ |
|
| 45 |
+
| `CRNN_ResNet34_VD_Weights.ICDAR2015_TOTALTEXT_MLT19` | `crnn_resnet34_vd_scene-38393899.pth` (+ LM `charlm6_scene-883dd7cd.json`) | 27.9 M | **word acc. 0.791** · Total-Text 0.802 ³ |
|
| 46 |
+
| `CRNN_ResNet34_VD_Weights.ICDAR2015` | `crnn_resnet34_vd_ic15-da0782b5.pth` | 27.9 M | word acc. 0.738 · CER 0.101 ² |
|
| 47 |
| `CRNN_ResNet34_VD_Weights.PPOCR_SERVER_V2` | `crnn_resnet34_vd_ppocr_server_v2-803ba4c9.pth` | 27.9 M | word acc. 0.665 ² |
|
| 48 |
|
| 49 |
¹ Line-level detectors converted from PaddleOCR. ICDAR-2015 scores *word* boxes, so adjacent words
|
|
|
|
| 52 |
² 2077 alphanumeric care words of ICDAR-2015 test cropped from the full images with
|
| 53 |
`torchocr.ops.crop_quads` on their ground-truth quads, case-insensitive (not the official Task 4.3
|
| 54 |
crops). Axis-aligned crops of the same words score 0.579.
|
| 55 |
+
³ Decoded with its declared CTC beam search (width 10) and 6-gram character language model; 0.750 with greedy
|
| 56 |
+
decoding. Same ground-truth-quad protocol; Total-Text curved words use their minimum-area rectangle.
|
| 57 |
|
| 58 |
+
End to end (`OCRPipeline.from_pretrained`, image → text; a word counts when it is detected *and*
|
| 59 |
+
read correctly, case-insensitive, generic vocabulary; `references/end2end/evaluate.py`), with
|
| 60 |
+
`DBNet_ResNet18_VD_Weights.ICDAR2015` + `CRNN_ResNet34_VD_Weights.ICDAR2015_TOTALTEXT_MLT19`:
|
| 61 |
+
|
| 62 |
+
| Test set | Detection hmean | End-to-end hmean | `min_text_score=0.8` |
|
| 63 |
+
| --- | --- | --- | --- |
|
| 64 |
+
| ICDAR-2015 (street scenes) | 0.809 | 0.621 | **0.649** |
|
| 65 |
+
| Total-Text (curved text) | 0.696 | 0.566 | **0.585** |
|
| 66 |
+
| FUNSD (scanned forms) | 0.826 | 0.711 | **0.715** |
|
| 67 |
+
|
| 68 |
+
`min_text_score=0.8` drops regions read with low confidence; the value maximizes end-to-end hmean on the
|
| 69 |
+
ICDAR-2015 *training* split. The converted PaddleOCR weights reach 0.219 on ICDAR-2015 and 0.17–0.18 detection
|
| 70 |
+
hmean on FUNSD, whose word-level boxes do not match their line-level output.
|
| 71 |
|
| 72 |
```python
|
| 73 |
from torchocr import OCRPipeline, load_image
|
| 74 |
|
| 75 |
pipeline = OCRPipeline.from_pretrained(
|
| 76 |
+
"DBNet_ResNet18_VD_Weights.ICDAR2015", "CRNN_ResNet34_VD_Weights.ICDAR2015_TOTALTEXT_MLT19", device="cuda"
|
| 77 |
+
) # the recognizer's beam search + language model is set up automatically
|
| 78 |
+
pipeline.min_text_score = 0.8
|
| 79 |
doc = pipeline(load_image("photo.jpg")) # doc.text, doc.polygons
|
| 80 |
```
|
| 81 |
|
|
|
|
| 93 |
|
| 94 |
### The `ICDAR2015` checkpoints
|
| 95 |
|
| 96 |
+
All were fine-tuned by torchocr on *training* splits only (ICDAR-2015, plus Total-Text and MLT-2019 for the
|
| 97 |
+
recognizer noted below); reported weights are the
|
| 98 |
**last epoch** and no checkpoint or hyper-parameter was selected on the test set.
|
| 99 |
|
| 100 |
- `DBNet_ResNet18_VD_Weights.ICDAR2015`: `PPOCR_SERVER_V2` fine-tuned 300 epochs with the recipe below;
|
|
|
|
| 103 |
training words, cropped with `crop_quads` from jittered ground-truth quads
|
| 104 |
(`references/recognition/train.py`). It keeps PaddleOCR's Chinese + Latin charset but saw only Latin
|
| 105 |
scene text, so Chinese accuracy is no longer guaranteed.
|
| 106 |
+
- `CRNN_ResNet34_VD_Weights.ICDAR2015_TOTALTEXT_MLT19`: `PPOCR_SERVER_V2` fine-tuned 10 epochs (bf16) on
|
| 107 |
+
66k Latin scene words (ICDAR-2015 train ×2, Total-Text train, MLT-2019 Latin crops). Its language model
|
| 108 |
+
(`charlm6_scene-883dd7cd.json`) is a case-insensitive 6-gram character model built from those *training*
|
| 109 |
+
transcriptions only; beam width and LM weight were chosen on Total-Text *training* words.
|
| 110 |
- `DBNet_MobileNetV3_Large_05_Weights.ICDAR2015`, described next.
|
| 111 |
|
| 112 |
#### `DBNet_MobileNetV3_Large_05_Weights.ICDAR2015`
|
charlm6_scene-883dd7cd.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
crnn_resnet34_vd_scene-38393899.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:38393899588fdde96a8c7c3b18190353c23136170df816739e8806bcf3f59714
|
| 3 |
+
size 111589324
|