PARSeq (scene text recognition) (fastforks)
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.
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/baudm/parseq at 1902db043c02.
Task: ocr. Tier: experimental. Outputs: boxes, texts, scores. Backends: portable, kernels.
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).
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
parseq@1 |
parseq-bb5792a6.pt | bb5792a68e36 |
Apache-2.0 (assumed from code) | yes |
parseq-tiny@1 |
parseq_tiny-e7a21b54.pt | e7a21b543c98 |
Apache-2.0 (assumed from code) | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE, NOTICE.
Code licence: Apache-2.0; the authors do not state a separate weights licence.
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)..
Licence evidence: https://github.com/baudm/parseq/blob/1902db043c029a7e03a3818c616c06600af574be/LICENSE
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): parseq 3000x4000 (0.3 GiB peak allocated, 0.3 reserved); parseq-tiny 3000x4000 (0.3 GiB peak allocated, 0.3 reserved)
Speed and memory
Ocr, synthetic
| model | input | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|---|---|
parseq |
32x128 | 15.9 | 19.6 | 3.68 | 3.66 | 4.4x | 1.0x | 126 / 144 | 79 / 92 | 79 / 92 |
parseq-tiny |
32x128 | 14.6 | 18.0 | 2.17 | 2.19 | 6.6x | 1.0x | 56 / 58 | 44 / 46 | 44 / 46 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
parseq |
0.53 (32x128) | 1.44 (32x128) | 0.91 (32x128) | 1.04 (32x128) | 0.26 (32x128) | 0.20 (32x128) |
parseq-tiny |
0.34 (32x128) | 0.74 (32x128) | 0.76 (32x128) | 0.95 (32x128) | 0.20 (32x128) | 0.19 (32x128) |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT (fp16 unless shown) | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
parseq |
32x128 | 3.68 ms | 8.80 ms | 1.67 ms | 3.66 ms | 19.9 s | 114 s | 79 / 92 | 111 / 118 | 79 / 92 | 148 / 168 |
parseq-tiny |
32x128 | 2.17 ms | 1.54 ms | 1.67 ms | 2.19 ms | 18.0 s | 102 s | 44 / 46 | 76 / 94 | 44 / 46 | 82 / 90 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
On public datasets
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 | original fp32 | portable | portable fp32 | kernels | portable + torch.compile | TensorRT | note |
|---|---|---|---|---|---|---|---|---|
parseq |
IIIT5K test word crops, word accuracy / normalized edit similarity % | 98.37 / 99.62 | 98.37 / 99.62 | 98.37 / 99.62 | 98.37 / 99.62 | |||
parseq-tiny |
IIIT5K test word crops, word accuracy / normalized edit similarity % | 97.67 / 99.45 | 97.67 / 99.45 | |||||
parseq-tiny |
IIIT5K test (300 crops), word accuracy / normalized edit similarity % | 97.00 / 99.32 | 97.00 / 99.32 | 97.00 / 99.32 | 97.00 / 99.32 |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 535aedbb / 5f4a908a0, 2026-11-19; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 3bf0bac7, 2026-11-18; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 67dbea00 / a54f74f7, 2026-11-19 to 2026-11-20; compile: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 535aedbb, 2026-11-19; tensorrt: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 535aedbb, 2026-11-19.
Parity with the original code
Every variant is checked against reference outputs of the original code at its pinned commit. 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).
Usage
from fastforks import ocr
model = ocr.load("parseq") # mode="auto": the preferred backend from recorded measurements
result = model("receipt.jpg")
result.texts # the text lines in reading order
result.boxes, result.scores # [N, 4, 2] quads in input pixels, [N] confidences
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: parseq, parseq-tiny.
Kernels backend
ocr.load("parseq", mode="kernels") runs our CUDA kernels (pil_resample). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.