Models · Text recognition (OCR)
PARSeq (scene text recognition)
PARSeq (Bautista and Atienza, ECCV 2022): reads one cropped word (Latin letters, digits, punctuation) with a Vision Transformer and a small decoder that refines its own guess; a base and a tiny version. Apache-2.0 code and weights.
experimental Fork of baudm/parseq@1902db0 · backends: portable, kernels
- Paper Scene Text Recognition with Permuted Autoregressive Sequence Models ECCV 2022 · first released 14 Jul 2022
Paper 2022 Added in 0.2.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import ocr
model = ocr.load("parseq") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.boxes # also: texts, scores
result.backend # what ran: mode, device, dtype, kernels fastforks bench parseq Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
Input: synthetic, 32x128
| Backend | dtype | Time per call (ms) | vs original fp32 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32baudm/parseq902db043c02 strhub PARSeq + read.py transform (PIL bicubic) + Tokenizer.decode | fp32 | 15.9 | – | 125 MiB/144 MiB | 0.7 | 3.19 |
| Original fp16baudm/parseq902db043c02 strhub PARSeq + read.py transform (PIL bicubic) + Tokenizer.decode | fp16 | 19.6 | 0.81× | 126 MiB/144 MiB | 0.5 | 1.04 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 3.63 | 4.4× | 79 MiB/100 MiB | 1.4 | 0.26 |
| Kernels | not measured | – | – | – | – | |
| Portable + torch.compile | 8.80 | 1.8× | 111 MiB/118 MiB | 20 (build) | – | |
| TensorRT fp16 | fp16 | 1.67 | 9.5× | 70 MiBenginenot comparable | 114 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-14 to 2026-11-15. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-15 | Original | fp32 | cannot run here | – | 32x128 | |
| Portable | fp16 | 23.6 | 440 MiB process | matches | 32x128 | |
| Portable | fp32 | 23.1 | 496 MiB process | matches | 32x128 | |
| Kernels | fp32 | not implemented | – | 32x128 | ||
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
- Code
- Apache-2.0 LICENSENOTICE
- Weights
- Apache-2.0 (assumed from code)(not stated by the authors; assumed to follow the code) source
- Training data
- The README does not say which data the released checkpoints were trained on; the paper's best models use its real-data union (COCO-Text, RCTW17, Uber-Text, ArT, LSVT, MLT19, ReCTS, TextOCR, OpenVINO; Datasets.md).
- weights licence not stated by the original authors; assumed to be the code licence
Our reading of the licences, not legal advice.
Weights
parseq-bb5792a6.pt 95.4 MB· hosted on GitHubfastforks downloads and checks these files on first use (fastforks download parseq).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
IIIT5K test word crops
word accuracy / normalized edit similarity %
| Run | dtype | word_accuracy ↑ | ned ↑ | words | ms / word |
|---|---|---|---|---|---|
| Original fp32 | not measured | ||||
| Original fp16 | not measured | ||||
| Portable fp32 | fp32 | 98.37 | 99.62 | 3000 | 6.09 |
| Portable | not measured | ||||
| Kernels | not measured | ||||
The original code was not run on this dataset, so the table cannot show the distance to it.
The 3,000 official cropped test words, with no lexicon. Exact accuracy and normalized edit similarity compare lowercase ASCII letters and digits. Similarity is one minus edit distance divided by the longer word's length, averaged over the crops. For a model that also detects text, this benchmark runs only its recognition network on the supplied word crop. Measured on RTX 5060 Ti, torch 2.14.1+cu130, fastforks 3bf0bac7, 2026-11-18.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.01 and p99 <= 0.01 (absolute error of the output boxes).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.001 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.01 | 0 |
| GPU default dtypes, p99 |diff| | ≤ 0.01 | 0 |
Recorded for parseq on RTX 5060 Ti, torch 2.10.0+cu130, 2026-11-17, with these kernels: pil_resample
Details
PARSeq (Bautista and Atienza, ECCV 2022): a ViT encoder over the word crop (32 x 128) and one two-stream Transformer decoder layer trained with permuted autoregressive sequence modelling; reads one cropped word or short line (94 characters: Latin letters, digits, ASCII punctuation; no space). Greedy autoregressive decoding plus one refinement pass, as upstream `read.py`. A recogniser only: the whole input is one line (one quad over the image); pair it with a detector (e.g. `ppocrv5-mobile` boxes) for full pages.
- Input / output
- Input: one RGB image. Output: the text lines in reading order: a quad
[N, 4, 2]per line, its text and a confidence[N](text detector + recogniser; recognisers alone read the whole image as one line). - Input size
- any H x W >= 32, padded to a multiple of 32; tested up to 3000x4000 (295 MiB allocated)
- Options
cuda_graphs=true
- Outputs
boxes,texts,scores- Checkpoint
dim=384,enc_heads=6,dec_heads=12- CUDA kernels
pil_resample
- Apple (MPS)
- fp32, fp16
Full reference, generated from the repository
PARSeq (Bautista and Atienza, ECCV 2022): reads one cropped word (Latin letters, digits, punctuation) with a Vision Transformer and a small decoder that refines its own guess; a base and a tiny version. Apache-2.0 code and weights.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
parseq | synthetic (32x128) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 15.9 19.6 3.62 – 8.80 1.67 | 125 / 144 126 / 144 79 / 100 – 111 / 118 148 / 168 |
parseq-tiny | synthetic (32x128) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 14.6 18.0 2.10 – 1.54 1.67 | 56 / 58 56 / 58 44 / 54 – 76 / 94 82 / 90 |
Details
- Original code: https://github.com/baudm/parseq at
1902db043c02 - Code licence: Apache-2.0 (permissive); files:
LICENSE,NOTICE - Weights licence: Apache-2.0 (assumed from code)
- Licence evidence: https://github.com/baudm/parseq/blob/1902db043c029a7e03a3818c616c06600af574be/LICENSE
- Training data: The README does not say which data the released checkpoints were trained on; the paper's best models use its real-data union (COCO-Text, RCTW17, Uber-Text, ArT, LSVT, MLT19, ReCTS, TextOCR, OpenVINO; Datasets.md).
- Options:
cuda_graphs= True (speed only) - Kernel libraries:
pil_resample - Variants:
parseq,parseq-tiny - Outputs: boxes, texts, scores
- Input size: any H x W >= 32, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
parseq3000x4000 (0.3 GiB peak allocated, 0.3 reserved);parseq-tiny3000x4000 (0.3 GiB peak allocated, 0.3 reserved) parseq32x128, first call: portable + torch.compile 20 s (cold Inductor cache), TensorRT fp16 114 s (ONNX + engine).parseq-tiny32x128, first call: portable + torch.compile 18 s (cold Inductor cache), TensorRT fp16 102 s (ONNX + engine).parseqoriginal (fp32) 32x128, original 32x128: baudm/parseq902db043c02 strhub PARSeq + read.py transform (PIL bicubic) + Tokenizer.decodeparseq-tinyoriginal (fp32) 32x128, original 32x128: baudm/parseq902db043c02 strhub PARSeq + read.py transform (PIL bicubic) + Tokenizer.decodeparseqload / first call: original 0.53 s / 1.043 s (32x128), portable 1.44 s / 0.257 s (32x128)parseq-tinyload / first call: original 0.34 s / 0.946 s (32x128), portable 0.74 s / 0.198 s (32x128)- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
The 3,000 official cropped test words, with no lexicon. Exact accuracy and normalized edit similarity compare lowercase ASCII letters and digits. Similarity is one minus edit distance divided by the longer word's length, averaged over the crops. For a model that also detects text, this benchmark runs only its recognition network on the supplied word crop. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | portable fp32 | note |
|---|---|---|---|
parseq | IIIT5K test word crops, word accuracy / normalized edit similarity % | 98.37 / 99.62 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 3bf0bac7, 2026-11-18.
Parity
CPU, float32: max |diff| <= 0.001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.01 and p99 <= 0.01 (absolute error of the output boxes).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
parseq | 0.0 / 0.0 | RTX 5060 Ti, torch 2.10.0+cu130 | pil_resample@a432ef0451fe:sm_120 |
parseq-tiny | 0.0 / 0.0 | RTX 5060 Ti, torch 2.10.0+cu130 | pil_resample@a432ef0451fe:sm_120 |
Example output
No example rendered for this checkpoint yet.