kotaro-kinoshita/yomitoku
About
YomiToku is an AI-powered Python package that provides a document image analysis engine designed specifically for Japanese.
Design & MediaMeasured star growth
- in 24h
- -1
- in 7 days
- +3
- in 15 days
- +11
- in 1 month
- +32
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README_EN.md
Original日本語版 | English
🌐 Try it in your browser, no install required → YomiToku Studio Inference runs entirely in your browser (WebAssembly / WebGPU) — your images are never uploaded anywhere. Test it on your own images first.
🌟 Introduction
YomiToku is a Document AI engine specialized in Japanese document image analysis. It provides full OCR (optical character recognition) and layout analysis capabilities, enabling the recognition, extraction, and conversion of text and diagrams from images.
- 🤖 Equipped with four AI models trained on Japanese datasets: text detection, text recognition, layout analysis, and table structure recognition. All models are independently trained and optimized for Japanese documents, delivering high-precision inference.
- 🇯🇵 Each model is specifically trained for Japanese document images, supporting the recognition of over 7,000 Japanese characters, including vertical text and other layout structures unique to Japanese documents. (It also supports English documents.)
- 📈 By leveraging layout analysis, table structure parsing, and reading order estimation, it extracts information while preserving the semantic structure of the document layout.
- 📄 Supports a variety of output formats, including HTML, Markdown, JSON, and CSV. It also allows for the extraction of diagrams and images contained within the documents.
- ⚡ Operates efficiently in GPU environments, enabling fast document transcription and analysis. It requires less than 8GB of VRAM, eliminating the need for high-end GPUs.
- 📷 Includes an optional page detection and geometric correction (dewarping) preprocessing step: it detects the regions of multiple documents in a camera image (both pages of a spread, receipts side by side, ...), removes the curvature, curl, tilt and keystone distortion of each, and analyzes every page on its own. Being a non-linear correction, it also handles curved and curled paper and is robust to paper cut off by the frame and to poor lighting. Pages whose correction is judged to have failed are analyzed without it.
Processing Pipeline
flowchart LR
IN[/Input image/] --> PRE
subgraph PRE["Preprocessing (optional)"]
DW["Geometric correction<br>Dewarper"]
end
PRE --> OCR
PRE --> LA
subgraph OCR["OCR"]
direction TB
TD["Text Detector"] --> TR["Text Recognizer"]
end
subgraph LA["Layout Analysis"]
direction TB
LP["Layout Parser"] --> TSR["Table Structure Recognizer"]
end
OCR --> RO["Reading order estimation"]
LA --> RO
RO --> OUT[/"Output<br>JSON / HTML / Markdown / CSV / PDF"/]
- Preprocessing (geometric correction): runs only with
--dewarp. Finds the pages of the image (both pages of a spread, receipts side by side, ...), estimates the distortion of each and corrects them into flat documents. - OCR: detects the text lines and recognizes the characters of each of them.
- Layout analysis: detects paragraphs, figures and tables, and recognizes the cell structure (rows, columns, spans) of the tables.
- Reading order estimation: merges the OCR and layout analysis results and estimates the reading order of the document.
🖼️ Demo
Before installing, you can try it on your own images in the browser with YomiToku Studio (images are never uploaded).
The verification results for various types of images are also included in gallery.md
| Input | Results of OCR |
|---|---|
![]() |
![]() |
| Results of Layout Analysis | Results of HTML Export |
![]() |
![]() |
For the results exported in Markdown, please refer to static/out/in_demo_p1.md in the repository.
Red Frame: Positions of figures and imagesGreen Frame: Overall table regionPink Frame:` Table cell structure (text within the cells represents [row number, column number] (rowspan x colspan))Blue Frame: Paragraph and text group regionsRed Arrow: Results of reading order estimation
Source of the image: Created by processing content from “Reiwa 6 Edition Information and Communications White Paper, Chapter 3, Section 2: Technologies Advancing with AI Evolution” (https://www.soumu.go.jp/johotsusintokei/whitepaper/ja/r06/pdf/n1410000.pdf):(Ministry of Internal Affairs and Communications).
Page Detection and Geometric Correction (Dewarping)
With --dewarp, the regions of multiple documents in a camera image (both pages of a spread, receipts or business cards side by side, ...) are detected, the curvature, curl, tilt and keystone distortion of each are corrected, and document analysis (OCR, layout analysis) runs page by page. Several documents in one photo are analyzed as separate flat documents, without retaking or cropping the photo. Rather than a simple correction that extracts the paper outline and applies a projective transform to its four corners, it estimates the distortion over the whole page (non-linear correction), so curved and curled paper is flattened as well. It is robust to photos where part of the paper is cut off by the frame and to shadows and uneven lighting.
| Estimated correction (pages found and their grids) | Results on the dewarped image | Results mapped back to the input image |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The first row shows OCR (text detection and recognition) on three receipts photographed side by side: each receipt is found as its own page, dewarped and analyzed on its own (the three dewarped pages are shown side by side); the second row layout analysis on an open booklet: the spread is found as its left and right pages, each dewarped and analyzed on its own (the dewarped pages are shown side by side).
Thin lines: grid of each page found (where the rows / columns of the dewarped image lie in the input image, including the part cut off by the frame)Thick line: the part of the page dewarped (the part in the image)Number: page index (left to right, then top to bottom) and detection score- When mapping back (
--dewarp_coordinate photo), the rectangles found on the dewarped image are output as curved polygons on the input image.
📣 Release
- November 4, 2026 – YomiToku v0.16.0: Added geometric correction (dewarping) preprocessing for photographed documents.
- July 30, 2026 – YomiToku v0.14.0: Official release of the Table Semantic Parser (semantic table analysis with key-value/grid extraction and the
yomitoku_tablecommand). - November 5, 2025 – YomiToku v0.10.1: Added support for a GPU-free OCR model optimized for CPU inference.
- April 4, 2025 – YomiToku v0.8.0: Added support for handwritten character recognition.
- November 26, 2024 – YomiToku v0.5.1 (beta): Public release.
💡 Installation
pip install yomitoku
- Please install the version of PyTorch that matches your CUDA version. By default, a version compatible with CUDA 12.4 or higher will be installed.
- PyTorch versions 2.5 and above are supported. As a result, CUDA version 11.8 or higher is required. If this is not feasible, please use the Dockerfile provided in the repository.
🚀 Usage
Normal Mode
yomitoku ${path_data} -f md -o results -v --figure
Efficient Mode
yomitoku ${path_data} -f md --lite -d cpu -o results -v --figure
With Geometric Correction (Dewarping)
Use the --dewarp option for document images photographed with a smartphone or similar. The dewarped image (*_dewarped.jpg) is also output.
yomitoku ${path_data} -f md -o results -v --dewarp
Do not use it for images of documents that are already flat, such as scans or PDFs (without the paper outline the correction brings nothing and may slightly distort the page).
Command Line Arguments List
| Argument Name | Description |
|---|---|
${path_data} |
Specify the path to a directory containing images to be analyzed or directly provide the path to an image file. If a directory is specified, images in its subdirectories will also be processed. |
--format(-f) |
Specify the output file format. Supported formats are json, csv, html, md, and pdf (searchable-pdf). |
--outdir(-o) |
Specify the name of the output directory. If it does not exist, it will be created. |
--vis(-v) |
If specified, outputs visualized images of the analysis results. |
--lite(-l) |
Inference is performed using a lightweight model. This enables fast inference even on a CPU. |
--device(-d) |
Specify the device for running the model. If a GPU is unavailable, inference will be executed on the CPU. (Default: cuda) |
--ignore_line_break |
Ignores line breaks in the image and concatenates sentences within a paragraph. (Default: respects line breaks as they appear in the image.) |
--figure_letter |
Exports characters contained within detected figures and tables to the output file. |
--figure |
Exports detected figures and images to the output file. |
--encoding |
Specifies the character encoding for the output file to be exported. If unsupported characters are included, they will be ignored. (Supported encodings: utf-8, utf-8-sig, shift-jis, enc-jp, cp932) |
--combine |
When a PDF is provided as input and contains multiple pages, this option combines their prediction results into a single file for export. |
--ignore_meta |
Excludes text information such as headers and footers from the output file. |
--split_text_across_cells |
Splits detected text lines spanning multiple table cells at cell boundaries before recognition. |
--ignore_ruby |
Excludes ruby (furigana) text from the output. |
--ruby_threshold |
Specifies the threshold for ruby detection (default: 0.5). Used together with --ignore_ruby. |
--disable-repetition-stop |
Disables early stopping of repeated-character loops in text recognition (enabled by default). |
--dewarp |
Corrects the curvature, curl, tilt and keystone distortion of photographed documents before the analysis. The dewarped image is output as *_dewarped.jpg and, with --vis, the estimated correction (pages found and their grids) as *_dewarp_grid.jpg. Pages whose correction is judged to have failed are analyzed without it. |
--dewarp_coordinate |
Coordinates of the output with --dewarp: dewarped (the dewarped image, default) or photo (the input image; each element gets a curved polygon). |
--dewarp_model |
Dewarping model with --dewarp: pagenet_v2 (finds every page of the image and outputs each as *_p{page}_{k}.*, default; flat pages such as scans and PDFs are only rotated level), pagenet_v1 (the earlier multi-page model) or uvdoc_v1 (dewarps the image as one page). |
For other options, please refer to the help documentation.
yomitoku --help
NOTE
- In normal mode, It is recommended to run on a GPU. The system is not optimized for inference on CPUs, which may result in significantly longer processing times.
- In efficient mode, fast inference is possible even on a CPU.
- YomiToku is optimized for document OCR and is not designed for scene OCR (e.g., text printed on non-paper surfaces like signs).
- The resolution of input images is critical for improving the accuracy of AI-OCR recognition. Low-resolution images may lead to reduced recognition accuracy. It is recommended to use images with a minimum short side resolution of 720px for inference.
📊 Table Semantic Parser
The Table Semantic Parser detects tables in document images and PDFs and automatically estimates their semantic structure: cell roles (header/value), key-value pairs (label → value), and grids (matrix-like records). The yomitoku_table command exports whole-document analysis results as per-page structured JSON.
yomitoku_table ${path_data} -o results -v
By default, the output is structured JSON with the resolved key-value/grid texts and the originating cell ids and coordinates embedded. Paragraphs are also included.
| Option | Description |
|---|---|
--simple |
Output text-only structured JSON without coordinates and other metadata. |
--raw |
Output the normalized TableSemanticParserSchema JSON (for template round-trips). |
--lite |
Use lite models (for CPU). |
--studio-template FILE |
Batch-analyze with a YomiToku Studio form template (v2/v3), using OCR only. |
--grid_only / --kv_only |
Parse only grids / key-value items. |
For the other options (per-module model/config overrides, templates, page selection, etc.), see the Table Semantic Parser CLI documentation. For the Python API, see the Table Semantic Parser documentation.
See gallery_table_semantic_parser.md for visualized results on various forms.
Note: Only forms with ruled separator lines are supported.
📋 Extractor (Structured Data Extraction)
YomiToku Extractor extracts structured data from document images and PDFs based on a YAML schema. It automatically extracts field values from OCR and layout analysis results and outputs them as JSON.
Extraction Modes
| Command | Mode | Features |
|---|---|---|
yomitoku_extract |
Rule-based | No LLM required. Fast extraction via KV search, grid matching, and regex |
yomitoku_extract_with_llm |
LLM-based | More flexible extraction using an LLM server such as vLLM |
- Rule-based: Best for fixed-format documents (application forms, reports, slips). When the position or text pattern of extraction targets is known, it extracts quickly and accurately.
- LLM-based: Best for variable-format documents (business cards, receipts, invoices). Even when layouts or value patterns vary, it can extract flexibly by understanding context.
Installation
pip install yomitoku[extract]
Schema Definition Example
fields:
- name: phone_number
description: Phone Number
type: string
normalize: phone_jp
- name: invoice_number
regex: 'T\d{13}'
type: string
- name: order_items
structure: table
columns:
- name: product
description: Product Name
- name: price
description: Amount
normalize: numeric
Usage Examples
# Rule-based extraction
yomitoku_extract input.jpg -s schema.yaml -o results -v
# LLM-based extraction (using vLLM server)
yomitoku_extract_with_llm input.jpg -s schema.yaml -m Qwen/Qwen3-8B-Instruct
For details, see the Extractor documentation.
📝 Documents
For more details, please refer to the documentation
以下は、あなたの LICENSE セクションの 正確で自然な英訳(GitHub向け最適化版) です。 ライセンス表記の国際標準表現と英語 OSS 文書の慣習も反映しています。
LICENSE
The source code in this repository, as well as the model weight files hosted on HuggingFace Hub that are associated with this project, are provided under the CC BY-NC-SA 4.0 license. Non-commercial personal use and academic/research use are permitted freely.
YomiToku © 2024 by Kotaro Kinoshita is licensed under CC BY-NC-SA 4.0. To view a copy of this license, please visit: https://creativecommons.org/licenses/by-nc-sa/4.0/
Determination of commercial vs. non-commercial use will follow the guideline below:
Commercial Use
For commercial use of YomiToku, we provide a licensed product edition through the options below.
The commercial edition includes numerous enhancements such as improved handwriting recognition accuracy, automatic image orientation correction, and advanced layout analysis features that are only available in the product version.
On-Premises / Local PC Commercial Use
For commercial use on on-premises servers or local PCs, we offer a dedicated on-premises commercial license.
For inquiries, please contact us via:
Cloud-Based Commercial Use (AWS Marketplace)
The commercial edition of YomiToku is also available on AWS Marketplace.
All processing is executed entirely within your own AWS environment, with no external network communication or transmission to third-party servers.
This makes it suitable for workloads involving confidential documents, internal corporate materials, or personal information.
The following products are available. Each is a separate AWS Marketplace product, so subscribe to each product you plan to use.
| Product | Description |
|---|---|
| YomiToku-Pro - Document Analyzer | OCR and layout analysis of document images (standard edition) |
| YomiToku-Pro Lite - Document Analyzer | A lightweight edition of Document Analyzer (see the technical article, in Japanese, for accuracy and processing time compared with the standard edition) |
| YomiToku-Pro - Table Semantic Parser | Extraction of table structures (cells, key-value items and grids) from forms |
You can also find the product list in the AWS Marketplace search results.
For deployment and analysis procedures, see the guides for the dedicated client library YomiToku-Client.
- YomiToku-Client README (per-product setup and quick start)
https://github.com/MLism-Inc/yomitoku-client/blob/main/README.en.md - YomiToku-Client documentation (detailed usage guide)
https://mlism-inc.github.io/yomitoku-client/
Explore related projects
Loading…









