manga-ocr-nar-small-distil

English | 中文 · GitHub (code, details) · larger model: manga-ocr-nar-small

OCR for Japanese manga text boxes, for CPUs. One cropped text box in, the whole text out in one forward pass (non-autoregressive). 29.8M parameters, distilled from manga-ocr-nar-small with int8 quantization-aware training.

manga-ocr-nar-small-distil manga-ocr-nar-small
Parameters 29.8M 54.2M
Read v1.3 EM % / CER % 88.83 / 2.32 91.09 / 1.73
EM %, more than 32 characters 63.91 73.96
CPU, M1 Pro (int8 ONNX, 8 threads) 21.0 ms —
CPU, Xeon Gold 6148 37.3 ms (int8) 75.4 ms (fp32)
RTX 2080 Ti, fp16 8.4 ms (3.8 ms with compile=True) 9.1 ms

Per crop, preprocessing included. Read v1.2 was the development set; see the GitHub README for all numbers and the method.

Usage

git lfs install
git clone https://huggingface.co/muscgab/manga-ocr-nar-small-distil
cd manga-ocr-nar-small-distil
pip install -e ".[cpu]"     # NVIDIA GPU: pip install -e ".[cuda]"
from manga_ocr_nar_small import MangaOcrNarSmall
ocr = MangaOcrNarSmall()            # CUDA if available, otherwise int8 ONNX (file picked by CPU)
ocr("crop.png")                     # -> str
ocr(["crop1.png", "crop2.png"])     # -> list[str]

Inputs are cropped text boxes (no text detection), at most 65 characters. Onomatopoeia is not a target.

Files

model.safetensors (PyTorch / CUDA), onnx/ (int8: u8s8 for ARM and x86 with VNNI, u8u8 for x86 without VNNI), config.json, vocabulary, inference code manga_ocr_nar_small/ (1.1.0), SHA256SUMS.

License

Code Apache-2.0 (LICENSE); weights CC BY-NC-SA 4.0 (LICENSE_MODEL). Provenance: NOTICE.md.

Downloads last month
89
Safetensors
Model size
29.8M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train muscgab/manga-ocr-nar-small-distil