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

Checkpoint

Paper 2022 Added in 0.2.0 Evaluated with 0.2.0

Portable, RTX 5060 Ti 16 GB 3.63 ms 32x128, fp16
vs the faster original 4.4× original fp32: 15.9 ms
Peak memory 79 MiB original: 125 MiB
Accuracy vs original fp32 – original not run on the test set

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

BackenddtypeTime per call (ms)vs original fp32Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32baudm/parseq902db043c02 strhub PARSeq + read.py transform (PIL bicubic) + Tokenizer.decodefp32 15.9–125 MiB/144 MiB0.73.19
Original fp16baudm/parseq902db043c02 strhub PARSeq + read.py transform (PIL bicubic) + Tokenizer.decodefp16 19.60.81×126 MiB/144 MiB0.51.04
Portable fp32fp32not measured ––––
Portablefp16 3.634.4×79 MiB/100 MiB1.40.26
Kernelsnot measured ––––
Portable + torch.compile 8.801.8×111 MiB/118 MiB20 (build)–
TensorRT fp16fp16 1.679.5×70 MiBenginenot comparable114 (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

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-15Originalfp32cannot run here–32x128
Portablefp1623.6 440 MiB processmatches32x128
Portablefp3223.1 496 MiB processmatches32x128
Kernelsfp32not 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 GitHub

fastforks 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 %

Rundtypeword_accuracy ↑ned ↑wordsms / word
Original fp32not measured
Original fp16not measured
Portable fp32fp3298.3799.62 3000 6.09
Portablenot measured
Kernelsnot 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).

CheckToleranceMeasured
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.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
parseqsynthetic (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-tinysynthetic (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): parseq 3000x4000 (0.3 GiB peak allocated, 0.3 reserved); parseq-tiny 3000x4000 (0.3 GiB peak allocated, 0.3 reserved)
  • parseq 32x128, first call: portable + torch.compile 20 s (cold Inductor cache), TensorRT fp16 114 s (ONNX + engine).
  • parseq-tiny 32x128, first call: portable + torch.compile 18 s (cold Inductor cache), TensorRT fp16 102 s (ONNX + engine).
  • parseq original (fp32) 32x128, original 32x128: baudm/parseq902db043c02 strhub PARSeq + read.py transform (PIL bicubic) + Tokenizer.decode
  • parseq-tiny original (fp32) 32x128, original 32x128: baudm/parseq902db043c02 strhub PARSeq + read.py transform (PIL bicubic) + Tokenizer.decode
  • parseq load / first call: original 0.53 s / 1.043 s (32x128), portable 1.44 s / 0.257 s (32x128)
  • parseq-tiny load / 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.

variantdatasetportable fp32note
parseqIIIT5K 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).

variantkernels error vs original, mean / p99GPU, torchkernels used
parseq0.0 / 0.0RTX 5060 Ti, torch 2.10.0+cu130pil_resample@a432ef0451fe:sm_120
parseq-tiny0.0 / 0.0RTX 5060 Ti, torch 2.10.0+cu130pil_resample@a432ef0451fe:sm_120

Example output

No example rendered for this checkpoint yet.