Skip to main content

meikiocr

license: apache 2.0 hugging face space detection model recognition model

high-speed, high-accuracy, local ocr for japanese video games.

meikiocr is a python-based ocr pipeline that combines state-of-the-art detection and recognition models to provide an unparalleled open-source solution for extracting japanese text from video games and similar rendered content.

original image ocr result
input input_ocrresult
ナルホド
こ、こんなにドキドキするの、
小学校の学級裁判のとき以来です。

live demo

the easiest way to see meikiocr in action is to try the live demo hosted on hugging face spaces. no installation required!

try the meikiocr live demo here


core features

  • high accuracy: purpose-built and trained on japanese video game text, meikiocr significantly outperforms general-purpose ocr tools like paddleocr or easyocr on this specific domain.
  • high speed: the architecture is pareto-optimal, delivering exceptional performance on both cpu and gpu.
  • fully local & private: unlike cloud-based services, meikiocr runs entirely on your machine, ensuring privacy and eliminating api costs or rate limits.
  • cross-platform: it works wherever onnx runtime runs, providing a much-needed local ocr solution for linux users.
  • open & free: both the code and the underlying models are freely available under permissive licenses.

performance & benchmarks

meikiocr is built from two highly efficient models that establish a new pareto front for japanese text recognition. this means they offer a better accuracy/latency tradeoff than any other known open-weight model.

detection (cpu) detection (gpu)
accuracy_vs_cpu_latency accuracy_vs_gpu_latency
recognition (cpu) recognition (gpu)
accuracy_vs_cpu_latency accuracy_vs_gpu_latency

installation

pip install meikiocr

for a massive performance boost, you can install the gpu-enabled version of the onnx runtime. this will be detected automatically by the script.

pip install meikiocr
pip uninstall onnxruntime
pip install onnxruntime-gpu

usage - cli

after installation, you can use the meikiocr tool directly from your terminal.

meikiocr image.png

options

  • save visualization: draw bounding boxes and save the result to a file.
    meikiocr image.png --output result.jpg
    
  • json output: get detailed results (coordinates, confidence scores) for integration with other scripts.
    meikiocr image.png --json
    
  • adjust thresholds: fine-tune detection and recognition sensitivity.
    meikiocr image.png --det-threshold 0.6 --rec-threshold 0.2
    

run meikiocr --help for a full list of available options.

usage - python

this is how meikiocr can be called. you can also run demo.py for additional visual output.

import cv2
import numpy as np
from urllib.request import urlopen
from meikiocr import MeikiOCR

IMAGE_URL = "https://huggingface.co/spaces/rtr46/meikiocr/resolve/main/example.jpg"

with urlopen(IMAGE_URL) as resp:
    image = cv2.imdecode(np.asarray(bytearray(resp.read()), dtype="uint8"), cv2.IMREAD_COLOR)

ocr = MeikiOCR() # Initialize the OCR pipeline
results = ocr.run_ocr(image) # Run the full OCR pipeline
print('\n'.join([line['text'] for line in results if line['text']]))

adjusting thresholds

you can adjust the confidence thresholds for both the text line detection and the character recognition models. lowering the thresholds results in more detected text lines and characters, while higher values prevent false positives.

MeikiOCR().run_ocr(self, image, det_threshold=0.8, rec_threshold=0.2) # less, but more confident text boxes and characters returned

running dedicated detection

if you only care about the position of the text and not the content you can run the detection by itself, which is faster than running the whole ocr pipeline:

MeikiOCR().run_detection(self, image, det_threshold=0.8, rec_threshold=0.2) # only returns text line coordinates

in the same way you can also run_recognition by itself on images of precropped text lines.

how it works

meikiocr is a two-stage pipeline:

  1. text detection: the meiki.text.detect.v0 model first identifies the bounding boxes of all text lines in the image.
  2. text recognition: each detected text line is then cropped and processed in a batch by the meiki.text.recognition.v0 model, which recognizes the individual characters within it.

limitations

while meikiocr is state-of-the-art for its niche, it's important to understand its design constraints:

  • domain specific: it is highly optimized for rendered text from video games and may not perform well on handwritten or complex real-world scene text.
  • architectural limits: the detection model is capped at finding 64 text boxes, and the recognition model can process up to 48 characters per line. these limits are sufficient for over 99% of video game scenarios but may be a constraint for other use cases.
  • vertical text line accuracy: vertical text line support is in beta. it should work, but dont expect the same level of accuracy as on horizontal lines.

advanced usage & potential

the meiki_ocr.py script provides a straightforward implementation of a post-processing pipeline that selects the most confident prediction for each character. however, the raw output from the recognition model is richer and can be used for more advanced applications. for example, one could build a language-aware post-processing step using n-grams to correct ocr mistakes by considering alternative character predictions.

this opens the door for meikiocr to be integrated into a variety of projects.

license

this project is licensed under the apache 2.0 license. see the license file for details.

Release files for meikiocr 0.3.5

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

Source distribution (sdist)

Source distribution for meikiocr 0.3.5
File Size Uploaded
meikiocr-0.3.5.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for meikiocr 0.3.5
File Interpreter ABI Platform
meikiocr-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 34.2 kB

Release files / meikiocr-0.3.5.tar.gz

Download URL meikiocr-0.3.5.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cb9ed15deb1ff221e75b9cb3212dc8e969e0c9827198fb558d35634db46dad27
BLAKE2b-256 checksum
How to use checksums
8511f670e537b2958509449c75903f62e1cb563b69a11f9c47255d26fcb2760d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / meikiocr-0.3.5-py3-none-any.whl

Download URL meikiocr-0.3.5-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d1ede4bcf46ecf17ef9a59db26edbc3e622aa3ed3c27bb64317077abbe2fccb
BLAKE2b-256 checksum
How to use checksums
761672e7efb659963993f52ba5660a7b2acd68559c5c50ec17ea62b821b5a640
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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