End-to-end OCR#
An OCR predictor combines a detection model with a recognition model: any pair of the architectures listed in this section works. A word counts as correct when it is both well localized and correctly transcribed.
Benchmark#
Architecture |
FUNSD recall |
FUNSD precision |
CORD recall |
CORD precision |
|---|---|---|---|---|
|
73.37 |
76.11 |
84.80 |
79.09 |
|
73.06 |
75.79 |
84.64 |
78.94 |
|
73.17 |
75.90 |
84.96 |
79.25 |
|
73.90 |
76.66 |
85.84 |
80.07 |
|
73.58 |
76.33 |
85.64 |
79.88 |
|
73.06 |
75.79 |
85.95 |
80.17 |
|
73.70 |
76.46 |
85.76 |
79.99 |
|
73.52 |
76.27 |
85.91 |
80.13 |
Google Vision — text detection |
59.50 |
62.50 |
75.30 |
59.03 |
Google Vision — document text detection |
64.00 |
53.30 |
68.90 |
61.10 |
AWS Textract |
78.10 |
83.00 |
87.50 |
66.00 |
Azure Form Recognizer (v3.2) |
79.42 |
85.89 |
89.62 |
88.93 |
Commercial services are shown in italics, for reference.
Usage#
from doctr.models import ocr_predictor
predictor = ocr_predictor(det_arch="db_resnet50", reco_arch="master", pretrained=True)