doctr-parseq / README.md
fishcharlie's picture
Document immutable PARSeq release revision
5c85c04 verified
|
Raw
History Blame Contribute Delete
6.36 kB
---
license: apache-2.0
library_name: doctr
pipeline_tag: image-to-text
tags:
- doctr
- pytorch
- optical-character-recognition
- text-recognition
- scene-text-recognition
- parseq
- vision-transformer
---
# docTR PARSeq Recognition
Verified, byte-for-byte mirror of the official pretrained `parseq` recognition checkpoint distributed by [docTR](https://github.com/mindee/doctr). The `rrainn` organization maintains this mirror for reproducible, immutable model resolution through the Hugging Face Hub.
> This is a redistribution of an upstream docTR artifact. rrainn did not train or modify the model and is not affiliated with or endorsed by Mindee or the docTR maintainers.
## Model details
| Property | Value |
| --- | --- |
| Task | Cropped-word text recognition |
| Architecture | PARSeq with a Vision Transformer encoder and permuted autoregressive sequence decoder |
| Framework | PyTorch via `python-doctr` |
| Input | RGB word crop, normalized and resized for a `3 × 32 × 128` model input |
| Output | Recognized text and sequence confidence |
| Vocabulary | docTR `french` vocabulary: digits, ASCII Latin letters, punctuation, common currency symbols, and French accented characters |
| Maximum sequence length | 32 characters |
| Upstream model version | Checkpoint introduced for docTR v0.7.0; mirrored from the configuration shipped in docTR v1.0.1 |
| Artifact SHA-256 | `56125471b17e660253c4179c3fbf3c906c34606d898148895dbb84db257d98ba` |
The model implements the approach described in [Scene Text Recognition with Permuted Autoregressive Sequence Models](https://arxiv.org/abs/2207.06966). docTR documents implementation-specific differences, including a maximum length of 32 and decoder feed-forward settings that differ from the paper.
## Intended use
This model is intended for recognizing text in already-localized word images as part of an OCR pipeline. Suitable uses include document transcription, OCR benchmarking, and initialization for domain-specific fine-tuning.
This checkpoint is not a full-page detector. Pair it with a text detection model through docTR's `ocr_predictor`, or provide appropriately cropped word images through `recognition_predictor`.
## Usage
Install the upstream runtime:
```bash
pip install "python-doctr==1.0.1"
```
Load directly with docTR's native Hugging Face integration:
```python
from doctr.models import from_hub, recognition_predictor
# Pin a repository commit in production for reproducible model resolution.
model = from_hub("rrainn/doctr-parseq", revision="db17d8c3d1fe5a113177c52f8aa87f9e2bdfb3ea")
predictor = recognition_predictor(model)
```
For integrity-sensitive deployments, verify `pytorch_model.bin` against `SHA256SUMS` before loading the checkpoint.
## Preprocessing
The docTR configuration bundled with this repository defines:
- RGB channel order
- Input shape: `3 × 32 × 128`
- Mean: `(0.694, 0.695, 0.693)`
- Standard deviation: `(0.299, 0.296, 0.301)`
Use docTR's recognition predictor to apply the matching preprocessing and decoding behavior.
## Training data and evaluation
The upstream checkpoint is described by docTR as pretrained on its text-recognition dataset. The exact training dataset composition, dataset versions, filtering, and training hyperparameters are not disclosed alongside this artifact. Accordingly, this mirror does not declare Hugging Face `datasets` metadata or make unsupported claims about training provenance.
rrainn has not independently benchmarked this mirrored checkpoint. docTR publishes recognition-model evaluations on FUNSD and CORD in its [model-selection documentation](https://mindee.github.io/doctr/latest/using_doctr/using_models.html); consult the upstream documentation for its methodology and current results.
## Limitations and risks
- Recognition is limited to the configured Latin/French character vocabulary. Other scripts and unsupported characters cannot be represented.
- Accuracy may degrade on handwriting, curved or vertical text, severe blur, unusual typography, low contrast, or domains unlike the undisclosed training distribution.
- Because the complete training-data composition is unavailable, demographic, geographic, linguistic, and source-domain biases cannot be fully assessed.
- Autoregressive decoding can propagate an early character error into later positions.
- Sequence confidence is not guaranteed to be calibrated and should not be interpreted as a probability of correctness without task-specific validation.
- OCR output can contain consequential errors. Human review and domain-specific evaluation are required for legal, medical, financial, identity, accessibility, or other high-impact uses.
## Security
PyTorch checkpoint formats should be treated as executable-adjacent untrusted input. Download only from a trusted revision, verify the published SHA-256 digest, and use a current PyTorch release with restricted loading such as `torch.load(..., weights_only=True)` where applicable. This mirror preserves the exact upstream bytes and does not add serialized code.
## Artifact provenance
The binary was downloaded from the URL embedded in docTR v1.0.1 and renamed from `parseq-56125471.pt` to the docTR Hub-standard `pytorch_model.bin`. Its bytes were not changed. Machine-readable provenance is available in `PROVENANCE.json`; the digest is also recorded in `SHA256SUMS`.
## License and attribution
The upstream docTR project distributes this work under the [Apache License 2.0](LICENSE). This repository includes the complete license text and an attribution `NOTICE`. The checkpoint is redistributed without modification and without warranty.
The Apache-2.0 license does not grant trademark rights. Names such as docTR, PARSeq, and Mindee are used only to identify the origin and architecture of the artifact. Users are responsible for confirming that their use of the model and any underlying data complies with applicable laws and third-party rights.
## Citation
```bibtex
@inproceedings{bautista2022parseq,
title={Scene Text Recognition with Permuted Autoregressive Sequence Models},
author={Bautista, Darwin and Atienza, Rowel},
booktitle={European Conference on Computer Vision},
year={2022}
}
```
Please also cite the [docTR project](https://github.com/mindee/doctr) when this implementation or checkpoint materially contributes to your work.