Skip to main content

Hayai OCR (速いOCR)

Fast optical character recognition for Japanese, Chinese, and Korean text, with the main focus being Japanese manga. Powered by the new Hayai OCR v2 model (JustANormalTinkerer/hayai-ocr-v2), pairing a SigLIP2 NaFlex vision encoder with a high-performance transformer architecture.

Hayai OCR v2 is MUCH faster while also adding multi-language support for Chinese (Simplified and Traditional) and Korean alongside Japanese.

Hayai OCR can be used as a general purpose printed Asian language OCR, but its main goal is to provide high quality text recognition, robust against various scenarios specific to manga:

  • both vertical and horizontal text
  • text with furigana
  • text overlaid on images
  • wide variety of fonts and font styles
  • low quality images
  • SFX

Unlike many OCR models, Hayai OCR supports recognizing multi-line text in a single forward pass, so that text bubbles found in manga can be processed at once, without splitting them into lines.

See also:

  • Poricom, a GUI reader
  • mokuro, a tool for generating HTML overlays for manga

Installation

You need Python 3.9 or newer. Please note that the newest Python release might not be supported due to a PyTorch dependency, which often breaks with new Python releases and needs some time to catch up. Refer to PyTorch website for a list of supported Python versions.

If you want to run with GPU, install PyTorch as described here, otherwise this step can be skipped.

pip install hayai-ocr

Usage

Python API

from hayai_ocr import HayaiOcr

mocr = HayaiOcr()
text = mocr('/path/to/img')

or with PIL:

import PIL.Image
from hayai_ocr import HayaiOcr

mocr = HayaiOcr()
img = PIL.Image.open('/path/to/img')
text = mocr(img)

Batch processing is also supported:

texts = mocr(['/path/to/img1.png', '/path/to/img2.png'])

Quantization (int4 / int8)

Hayai OCR supports weight-only quantization via torchao (PyTorch AO) to reduce VRAM usage:

  • int8: INT8 weight-only — ~2x memory reduction with minimal accuracy loss
  • int4: INT4 weight-only — ~4x memory reduction
# Run with int4 quantization
mocr = HayaiOcr(quantize="int4")

# Run with int8 quantization
mocr = HayaiOcr(quantize="int8")

Legacy v1 Model Fallback

If you need to use the legacy Hayai OCR v1 model (JustANormalTinkerer/hayai-ocr), you can set use_v1=True or supply the v1 model repository:

# Use the legacy v1 model
mocr = HayaiOcr(use_v1=True)

Note: The backwards-compatible MangaOcr alias is still available:

from hayai_ocr import MangaOcr
mocr = MangaOcr()

Running in the background

Hayai OCR can run in the background and process new images as they appear.

You might use a tool like ShareX or Flameshot to manually capture a region of the screen and let the OCR read it either from the system clipboard, or a specified directory. By default, Hayai OCR will write recognized text to clipboard, from which it can be read by a dictionary like Yomitan.

Clipboard mode on Linux requires wl-copy for Wayland sessions or xclip for X11 sessions. You can find out which one your system needs by running echo $XDG_SESSION_TYPE in the terminal.

Your full setup for reading manga with a dictionary might look like this:

capture region with ShareX -> write image to clipboard -> Hayai OCR -> write text to clipboard -> Yomitan

  • To read images from clipboard and write recognized texts to clipboard, run in command line:
    hayai_ocr
    
  • To run with quantization in CLI:
    hayai_ocr --quantize int4
    
  • To run with the legacy v1 model:
    hayai_ocr --use-v1
    
  • To read images from ShareX's screenshot folder, run in command line:
    hayai_ocr "/path/to/sharex/screenshot/folder"
    

Note that when running in the clipboard scanning mode, any image that you copy to clipboard will be processed by OCR and replaced by recognized text. If you want to be able to copy and paste images as usual, you should use the folder scanning mode instead and define a separate task in ShareX just for OCR, which saves screenshots to some folder without copying them to clipboard.

When running for the first time, downloading the model might take a few minutes. The OCR is ready to use after OCR ready message appears in the logs.

  • To see other options, run in command line:
    hayai_ocr --help
    

If hayai_ocr doesn't work, you might also try replacing it with python -m hayai_ocr.

Usage tips

  • OCR supports multi-line text, but the longer the text, the more likely some errors are to occur. If the recognition failed for some part of a longer text, you might try to run it on a smaller portion of the image.
  • The model was trained to handle manga, visual novels, anime graphics, and handwritten texts across Japanese, Chinese, and Korean.
  • The model always attempts to recognize some text on the image, even if there is none. Because it uses a transformer decoder (and therefore has some language model understanding), it might even "dream up" realistically looking sentences! This shouldn't be a problem for most use cases.

Examples

Here are some examples showing the capability of the model with the new Hayai OCR v2:

Note: All the example images are picked randomly from Youtube videos and raw manga sites. The model has never seen these images before. Some images (especially the youtube ones) weren't even in the scope of this project, but the model is just that good at it.

image hayai-ocr-v1 hayai-ocr-v2 hayai-ocr-v2.1 PaddleOCR-VL For Manga
知らない世界で見つけたイメージを 知らない世界で見つけたイメージを 知らない世界で見つけたイメージを 知らない世界で見つけた\n イメージを
カナデトモスソラ(Kanadetomosusora) カナデトモスツラ(Kanadetomosusora) カナデトモスソラ(Kanadetomosusura) カナデトモスリラ(Kanadetomosusora)
建設会社社員行方 建設会社社員行才 建設会社社員行方 建設会社社員行
だとしてもこのレベルがウロつくなんて...おそらく2級の呪い だとしてもこのレベルがウロつくなんて...おそらく2級の呪い だとしてもこのレベルがウロつくなんて...おそらく2級の呪い だとしてもこのレベルがウロつくなんて・・・おそらく2級の呪い
パチパチパチパチ パチパチパチパチパチパチ パチパチパチパチ アデアデデアデデアデ
バビュン バビュン バビュン 川ビュン
僕の過去とか未来とか 僕の過去とか未来とか 僕の過去とか未来とか 僕の過去とか未来とか
くらべられっ子 らぺろれっ子 くらべられっ子 くらべられっ子
そうだクラス分けがあるんだった!! そうだクラス分けがあるんだった!! そうだクラス分けがあるんだ!! そうだクラス分けがあるんだった!!
脇役よ、主役を超えよ! 脇役よ、主役を超えよ! 脇役よ、主役を超えよ! 脇役よ、主役を超えよ!
Eh~Idon'treallywantto~ EhI don't really want to Eh~ I don't really want to~ Eh~I don't really want to~
「Sorryforthewait~!Didyouwaitlong?」 「Sorry for thewait~!DidyouwaitLong?」 「Sorry for the wait~! Did you wait Long?」 「Sorry for the wait~!Did you wait long?」
YamateAreaNewresidentialdistrictforforeigners Yamate AreaNew residental district forforeignert Yamate Area New residential district for foreigners Yamate Area New residential district for foreigners

Benchmarks:

JMangaBench_Mixed

Model CER ↓ (Lower is Better) Exact match ↑ (Higher is better) Text-only CER ↓ Text-only exact match ↑
MangaOCR 4.683% 73.524% 2.700% 82.867%
HayaiOCR 6.738% 71.272% 4.967% 80.949%
HayaiOCR-v2 4.534% 73.645% 2.872% 82.227%
HayaiOCR-v2.1 3.225% 79.671% 1.896% 87.461%
BaberuOCR 4.589% 72.246% 2.603% 81.649%
PaddleOCR-VL-0.9B-For-Manga 2.910% 78.911% 1.866% 84.662%

My finetuning Dataset Train Split: Chinese + Japanese/Korean Onomatopoeia + Some English

Model Name Mean CER Throughput on L4 GPU (FPS)
Hayai OCR v2 8.52% 37.25
PaddleOCR-VL-For-Manga 24.66% 3.60

Private Pretraining Dataset Train Split: CJK

Model Name Mean CER Throughput on L4 GPU (FPS)
Hayai OCR v2 10.56% 31.95
Hayai OCR v2.1 12.94% 54.22*
PaddleOCR-VL-For-Manga 38.69% 2.22

*No idea how the throughput increased so much

Goals

While PaddleOCR-VL is also very accurate, it is 9x the size of this model and it struggles with SFX. The goal of this model is not to be State of the Art, but rather be usuable and fast at scale.

Acknowledgments

This project is a fork of manga-ocr by kha-white.

Training data included:

Metadata

Release files for hayai-ocr 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hayai-ocr 2.1.0
File Size Uploaded
hayai_ocr-2.1.0.tar.gz 875.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hayai-ocr 2.1.0
File Interpreter ABI Platform
hayai_ocr-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 955.1 kB

Release files / hayai_ocr-2.1.0.tar.gz

Download URL hayai_ocr-2.1.0.tar.gz
Size 875.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a3d8bf1480e0b9aa7fce4230e7807fa4457e32c405cfeb76a1ab7f635199e0b6
BLAKE2b-256 checksum
How to use checksums
778c33ec235a14568f0b5df3b0f6c86f2b6581f2a7bfc7dce6882e632701ca0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / hayai_ocr-2.1.0-py3-none-any.whl

Download URL hayai_ocr-2.1.0-py3-none-any.whl
Size 79.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53e9c76010c162bc2ea17d685b7300d5a181ee1650389d48d282d5eda571cc9e
BLAKE2b-256 checksum
How to use checksums
66fccd7d30946eeb2d702f416db1f7ff95894cd15957bde51bf7c7e8a88e5f7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release history Release notifications | RSS feed

2.3.0

2 release files

2.2.0

2 release files

This release

2.1.0 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

0.2.3

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page