manga-ocr-base Reads Japanese Comics Where Every Other OCR Tool Fails
A specialized Vision Encoder Decoder model reads Japanese manga speech bubbles in one forward pass, handling vertical text, furigana, and messy fonts.
Takeaways
- manga-ocr-base is a Vision Encoder Decoder model for Japanese manga OCR, now near 878k downloads on Hugging Face.
- Reads full speech bubbles in a single forward pass, no line detection or character segmentation pipeline needed.
- Handles vertical text, furigana, overlays on artwork, varied fonts and low-quality scans.
- Trained on Manga109-s plus synthetic pairs rendered with headless Chrome via html2image.
- Apache 2.0 licensed, works with Transformers directly or via the standalone manga-ocr package.
- Not designed for handwritten text; accuracy drops as input line length grows.
Reading Japanese manga breaks generic OCR engines. Text runs vertically, sits on top of busy artwork, mixes in tiny phonetic guides called furigana, and jumps between dozens of stylized fonts on a single page. manga-ocr-base, a compact Vision Encoder Decoder model from developer kha-white, tackles exactly that problem and has accumulated close to 878k downloads and 3.7k likes on Hugging Face.
One model, one pass, whole speech bubble
Conventional OCR stacks are pipelines: detect lines, segment characters, classify glyphs, stitch results together. manga-ocr collapses all of that into a single forward pass using Transformers' Vision Encoder Decoder framework. Crop a speech bubble, hand it to the model, and get the full utterance back with context preserved. According to the model card, it handles:
- Both vertical and horizontal text
- Furigana (small phonetic readings printed alongside kanji)
- Text overlaid directly on artwork
- A wide variety of fonts and font styles
- Low-quality scans
Built on synthetic data and a browser engine
The real labeled dataset, Manga109-s, is small, so kha-white leaned heavily on synthetic image-text pairs generated to imitate Japanese manga. The training pipeline renders text using html2image, a wrapper around Chrome's headless mode. Offloading typesetting to a browser keeps the codebase simple: the browser engine handles the genuinely hard parts of horizontal and vertical typesetting, including furigana injection, without custom rendering code. It runs slowly, but parallelized across a 16-thread machine it processes around 10,000 images in 17 minutes. The generator composites rendered text onto sampled backgrounds, with line lengths drawn from the natural distribution measured from Manga109-s. The full training recipe is open in the GitHub repo.
Five lines to get started
The model is Apache 2.0 licensed. The simplest path is the standalone manga-ocr package, but you can load it directly through Transformers:
from transformers import VisionEncoderDecoderModel, AutoTokenizer, AutoImageProcessor
from PIL import Image
model = VisionEncoderDecoderModel.from_pretrained("kha-white/manga-ocr-base")
tokenizer = AutoTokenizer.from_pretrained("kha-white/manga-ocr-base")
processor = AutoImageProcessor.from_pretrained("kha-white/manga-ocr-base")
pixel_values = processor(Image.open("bubble.png").convert("RGB"), return_tensors="pt").pixel_values
out = model.generate(pixel_values)
print(tokenizer.decode(out[0], skip_special_tokens=True))
One caveat: the image-to-text pipeline shortcut is no longer supported in Transformers v5, so load the model directly or pin transformers<5.0.0.
Where it holds up and where it slips
The sweet spot is printed Japanese in visually noisy contexts. The model also handles novels and video game screenshots well, but handwritten text is explicitly out of scope. Hand-drawn sound effects and author notes will trip it up. Accuracy also degrades on long inputs: feeding one speech bubble at a time produces better results than passing whole pages.
Why downloads keep climbing
manga-ocr solves a concrete problem for language learners and translation hobbyists who want to look up unknown kanji without retyping them by hand. It became the OCR backbone for mokuro, which generates HTML overlays that make manga pages selectable and searchable in a browser, and 43 Hugging Face Spaces now build on top of it. The practical use cases fall into a few clear buckets:
- Immersion reading tools where extracted text feeds a pop-up dictionary like Yomichan or a flashcard app like Anki.
- Fan translation pipelines that need clean text as input to a downstream machine translation model.
- Digitizing Japanese print media, including novels and video game screenshots, where text sits on complex backgrounds.
- Accessibility tooling that converts image-based Japanese content into selectable, screen-reader-friendly text.
What it shows about niche vision models
A single developer, using an existing encoder-decoder recipe, a small labeled dataset, and a browser-rendered synthetic corpus, built something that outperforms far larger general-purpose OCR systems on its target domain. For anyone facing a niche visual recognition problem with thin public data, the synthetic-render-plus-fine-tune approach here is worth close attention.