muscgab/JMangaBench_Mixed

1

stars

10

commits

Python

primary language

Jul 28, 2026

updated

README

JMangaBench_Mixed

License Python Samples Languages

A reproducible mixed-domain benchmark for Japanese manga OCR.

English · 中文


English

JMangaBench_Mixed is a relatively easy, reproducible mixed-domain benchmark for Japanese manga OCR that simulates real-world conditions. It evaluates both real manga text and controlled synthetic text. It contains 3,286 samples and reports not only one overall score, but also results by data source, text-length group, crop type, scene type, and writing orientation.

The repository contains the code, recipes, released rendering layers, hashes, and evaluator required to reproduce the benchmark. Manga109-s pixels are not redistributed: users obtain Manga109-s separately and build the image set locally.

Dataset composition

ComponentCountDescription
Total3,286One image and one reference string per sample
Real crops1,286Locally reconstructed from Manga109-s
Synthetic samples2,000Four groups of 500
Synthetic body-text masks2,000Furigana is excluded from the body-text mask
Orientation1,390 vertical / 610 horizontalSynthetic samples only
Crop type1,000 text crops / 1,000 balloon cropsSynthetic samples only
Scene type1,600 balloon / 400 direct textSynthetic samples only

Synthetic crop types

crop_typeCrop ruleBalloon sceneDirect-text sceneTotal
text_detector_cropBody-text mask bounding box plus realized padding6004001,000
balloon_detectorFull generated canvas; no second crop around the text1,00001,000

Both crop types are scored with OCR metrics. No detector metric is computed.

The synthetic groups are:

SubsetSamplesConfigured visible-text range
mixed_4_85004–8
mixed_9_135009–13
mixed_14_1850014–18
mixed_19_4050019–40

Every group is balanced between 250 text_detector_crop and 250 balloon_detector samples.

The synthetic set uses 28 distinct font files and 82 distinct container assets:

  • 44 GPL-licensed SVG balloon assets;
  • 36 project hand-drawn assets;
  • 2 project procedural assets.

The repository retains 48 GPL SVG sources; 44 of them are used by the final samples. A pool of 1,000 Manga109-s background regions is used twice across the 2,000 synthetic samples.

Manga109-s source version

FieldFrozen value
Source datasetManga109-s
Source releaseManga109-v2026
Reference package date2026-05-21
Annotation source used to prepare the recipesCurrent annotations/ included with Manga109-v2026
Manga109-s files read during local reconstructionimages/ only
Real-crop source verificationFull-page file SHA-256, page dimensions, and decoded crop pixel SHA-256 are strict checks
Synthetic source verificationPage dimensions, source-region pixel SHA-256, foreground SHA-256, and label-layer SHA-256 are strict checks
Generated-image verificationFinal PNG SHA-256 differences are warnings recorded in sha256_warnings.jsonl

The version label is recorded as source metadata. A mismatch in a source asset or decoded source crop stops construction. A final generated-image SHA-256 difference does not stop construction and is recorded in the warning report.

Linux reference environment and Docker

The generated-image reference hashes were produced on the following Linux/amd64 system:

FieldReference value
JMangaBench_Mixedv1.0.0
OSUbuntu 22.04.1 LTS
Kernel5.15.0-133-generic
Architecturex86_64
CPUIntel Xeon Platinum 8358P
GPUNVIDIA GeForce RTX 4090, 24 GB; used for OCR inference only, not PNG construction
Python3.13.14 (Anaconda, GCC 14.3)
Pillow12.3.0
JPEG codec ABI6.2
libjpeg-turbo3.1.4.1
zlib1.3.2

The repository also provides a pinned Linux/amd64 Docker build. Its base image is ghcr.io/astral-sh/uv@sha256:531f855bda2c73cd6ef67d56b733b357cea384185b3022bd09f05e002cd144ca. The resulting runtime uses Python 3.13.11, Pillow 12.3.0, JPEG codec ABI 6.2, libjpeg-turbo 3.1.4.1, and zlib 1.2.13.

Native builds on macOS or Windows can produce a different final PNG byte stream or slightly different generated pixels because image codecs and numerical implementations differ across platforms. Such differences may be visually and OCR-negligible, but SHA-256 alone does not measure their practical effect. The builder therefore reports every affected generated image without treating it as a source-data failure.

Reference OCR results

The following results were exported on 2026-07-28. All inference was performed on the same Linux server with one NVIDIA GeForce RTX 4090 24 GB GPU. Each model processed one image at a time in canonical benchmark order. Per-image latency does not include model loading and is hardware-dependent.

Two locally constructed image sets were evaluated:

  • Linux reference: the Linux/amd64 reference construction described above;
  • macOS private: the earlier private construction produced on macOS.

Both sets contain the same 3,286 sample IDs and reference strings. The accuracy metrics were identical for each model, so they are reported once:

ModelCER ↓Exact match ↑Text-only CER ↓Text-only exact match ↑
MangaOCR4.683%73.524%2.700%82.867%
HayaiOCR6.738%71.272%4.967%80.949%
BaberuOCR4.589%72.246%2.603%81.649%
PaddleOCR-VL-0.9B-For-Manga2.910%78.911%1.866%84.662%

Sequential per-image latency on the RTX 4090:

ModelLinux-reference input meanLinux-reference p50Linux-reference p95macOS-private input meanmacOS-private p50macOS-private p95
MangaOCR83.0 ms74.8 ms151.5 ms84.6 ms77.0 ms153.0 ms
HayaiOCR102.6 ms96.3 ms175.3 ms101.5 ms95.3 ms172.0 ms
BaberuOCR103.1 ms92.1 ms203.7 ms104.2 ms92.6 ms205.8 ms
PaddleOCR-VL-0.9B-For-Manga242.0 ms211.8 ms490.6 ms246.7 ms219.2 ms487.7 ms

Cross-construction prediction comparison:

ModelSamplesRaw prediction differencesNormalized prediction differencesMetric differences
MangaOCR3,286000
HayaiOCR3,286000
BaberuOCR3,286000
PaddleOCR-VL-0.9B-For-Manga3,286100

The single raw PaddleOCR difference for jmm_19_40_000180 consisted only of inserted line breaks; whitespace normalization made the predictions identical. Across 13,144 model-sample comparisons, there were no normalized prediction differences and no metric differences. For these two constructions and four tested models, the cross-platform image differences had no measurable effect on the reported OCR accuracy.

Quick start

Docker is the shortest reference-platform path. Docker Desktop users on macOS or Windows should keep --platform linux/amd64 in both commands:

docker build --platform linux/amd64 -t jmangabench-mixed:1.0.0 .

mkdir -p /absolute/path/to/output-parent

docker run --rm --platform linux/amd64 \
  -v "/absolute/path/to/Manga109s_released_2026_05_21:/data/Manga109s:ro" \
  -v "/absolute/path/to/output-parent:/output" \
  jmangabench-mixed:1.0.0 \
  build \
  --manga109s-root /data/Manga109s \
  --output /output/JMangaBench_Mixed \
  --workers 10

For a native installation, requirements are:

  • Python 3.13;
  • uv;
  • a separately obtained Manga109-s image package matching the recorded hashes (reference release: Manga109-v2026).

From the repository root:

uv sync --frozen

uv run python tools/verify_release.py --release-root .

uv run python -m jmangabench build \
  --manga109s-root /path/to/Manga109s_released \
  --output ./JMangaBench_Mixed \
  --workers 10

The one-command builder verifies the repository, reconstructs the real and synthetic components, performs strict source checks, and assembles the final benchmark in canonical order. The output directory must not already exist.

Expected output:

JMangaBench_Mixed/
  annotations.jsonl
  manifest.json
  sha256_warnings.jsonl
  images/
    real_crops/
    synthetic/
  masks/
    body_text/

sha256_warnings.jsonl is empty when every generated image matches the Linux reference. Otherwise, each line identifies one image, its reference SHA-256, and its actual SHA-256. Source asset and source-crop failures remain fatal.

Connect a model

JMangaBench_Mixed does not import or manage model frameworks. Copy examples/predict_jsonl_template.py into the model's own environment and implement load_model() and predict():

cp examples/predict_jsonl_template.py /path/to/model/run_jmangabench.py

/path/to/model/python /path/to/model/run_jmangabench.py \
  --benchmark ./JMangaBench_Mixed \
  --output ./predictions.jsonl

The model must produce exactly one JSON object for every benchmark ID:

{"id":"jmm_4_8_000001","prediction":"やあ坊主","latency_seconds":0.123,"error":null}

latency_seconds and error are optional. prediction must always be a string.

Evaluate predictions

uv run python -m jmangabench validate-predictions \
  --benchmark ./JMangaBench_Mixed \
  --predictions ./predictions.jsonl

uv run python -m jmangabench evaluate \
  --benchmark ./JMangaBench_Mixed \
  --predictions ./predictions.jsonl \
  --output ./evaluation/my_model

Evaluation creates:

evaluation/my_model/
  report.json
  per_sample.jsonl

The evaluator rejects missing, extra, or duplicate IDs; invalid predictions or latencies; modified annotations; and image or mask hash mismatches.

Metrics and slices

The frozen protocols are:

jmangabench_mixed_ocr_metrics/v1
jmangabench_mixed_text_normalization/v1

Normalization applies Unicode NFKC and removes whitespace. The text-only policy removes Unicode punctuation while preserving U+30FC (). CER is micro-averaged; exact match is sample-averaged.

Each report contains overall results and slices by:

  • source_kind: real or synthetic;
  • subset: real crops or one of the four synthetic length groups;
  • crop_type: real crop, text crop, or balloon crop;
  • scene_type: real crop, balloon, or direct text;
  • orientation: horizontal, vertical, or unspecified.

When latency is provided, the report also includes mean, p50, and p95 latency.

Reproducibility

  • release_manifest.json records every distributable file's size and SHA-256.
  • Source-page, source-crop, foreground, and label-layer hashes are strict construction checks.
  • Generated-image reference differences are preserved in sha256_warnings.jsonl and summarized in manifest.json.
  • The built image and mask hashes are frozen in annotations.jsonl and checked by the evaluator before scoring.
  • Final ordering is independent of input JSONL line order.
  • The assembled manifest.json freezes annotations and slice counts.
  • Public repository files contain no Manga109-s pixels or local absolute paths.
  • The locally built image benchmark contains Manga109-s-derived pixels and is marked redistribution_allowed: false.

Do not upload the locally built benchmark or any private verification image directory.

License and data terms

Project-authored code, documentation, recipes, metadata, and assets are licensed under GPL-3.0-only, unless a file or directory says otherwise.

Third-party terms remain in effect:

  • GPLv3 speech-bubble SVG sources are preserved under notices/manga_editor_desu_gpl3/;
  • font notices are preserved under notices/fonts/ under SIL Open Font License 1.1;
  • Manga109-s must be obtained separately and remains governed by its own terms.

See THIRD_PARTY_NOTICES.md for details.


中文

JMangaBench_Mixed 是一个面向日文漫画 OCR 的模拟真实情况的较简单的可复现混合域评测集。它同时测试真实漫画文字与可控合成文字,共包含 3,286 个样本。

本仓库提供复现 benchmark 所需的代码、配方、发布渲染层、哈希和 evaluator,不重新分发 Manga109-s 像素。用户需要单独取得 Manga109-s,并在本地构建图片测试集。

数据组成

组成数量说明
总计3,286每个样本包含一张图片和一个正文答案
真实 crop1,286在本地从 Manga109-s 恢复
合成样本2,000四组,每组 500 张
合成正文 mask2,000正文 mask 不包含 furigana
文字方向竖排 1,390 / 横排 610仅统计合成样本
Crop 类型文字 crop 1,000 / 气泡 crop 1,000仅统计合成样本
场景类型气泡 1,600 / 直接文字 400仅统计合成样本

合成 crop 类型

crop_type裁剪规则气泡场景直接文字场景合计
text_detector_crop正文 mask 包围框加实际 padding6004001,000
balloon_detector保留完整生成画布,不围绕正文二次裁剪1,00001,000

两种 crop 均使用 OCR 指标评分,不计算检测器指标。

四个合成分组为:

子集样本数配置的可见文字范围
mixed_4_85004–8
mixed_9_135009–13
mixed_14_1850014–18
mixed_19_4050019–40
每组均包含 250 张 text_detector_crop 和 250 张 balloon_detector

合成样本实际使用 28 个不同的字体文件和 82 个不同的容器资产:

  • 44 个 GPL SVG 气泡资产;
  • 36 个项目自绘资产;
  • 2 个项目程序生成资产。

仓库保留了 48 个 GPL SVG 源文件,其中 44 个实际进入最终样本。合成数据使用 1,000 个 Manga109-s 背景区域,每个背景在 2,000 张样本中使用两次。

Manga109-s 来源版本

字段冻结值
来源数据集Manga109-s
来源版本Manga109-v2026
参考数据包日期2026-05-21
生成配方时使用的 annotationManga109-v2026 中当前的 annotations/
本地重建时读取的 Manga109-s 文件images/
真实 crop 来源验证完整页面文件 SHA-256、页面尺寸和解码后 crop 像素 SHA-256 均为严格校验
合成来源验证页面尺寸、源区域像素 SHA-256、foreground SHA-256 和 label layer SHA-256 均为严格校验
生成图片验证最终 PNG SHA-256 差异仅作 Warning,并写入 sha256_warnings.jsonl

版本名称作为来源元数据记录。源资产或解码后源 crop 不一致时构建会立即失败;仅最终 生成图片 SHA-256 不一致时不会中止,而是写入 Warning 报告。

Linux 参考环境与 Docker

最终生成图片的参考哈希来自以下 Linux/amd64 环境:

字段参考值
JMangaBench_Mixedv1.0.0
操作系统Ubuntu 22.04.1 LTS
内核5.15.0-133-generic
架构x86_64
CPUIntel Xeon Platinum 8358P
GPUNVIDIA GeForce RTX 4090,24 GB;仅用于 OCR 推理,不参与 PNG 构建
Python3.13.14(Anaconda,GCC 14.3)
Pillow12.3.0
JPEG codec ABI6.2
libjpeg-turbo3.1.4.1
zlib1.3.2

仓库同时提供固定的 Linux/amd64 Docker 构建,基础镜像为 ghcr.io/astral-sh/uv@sha256:531f855bda2c73cd6ef67d56b733b357cea384185b3022bd09f05e002cd144ca。 容器运行时使用 Python 3.13.11、Pillow 12.3.0、JPEG codec ABI 6.2、 libjpeg-turbo 3.1.4.1 和 zlib 1.2.13。

在 macOS 或 Windows 上原生构建时,图片编解码器和数值实现的跨平台差异可能改变最终 PNG 字节流,或造成轻微的生成像素差异。这类差异对肉眼观感和 OCR prediction 的影响 可能很小,但 SHA-256 本身不能衡量实际影响。因此构建器会列出所有受影响的生成图片, 但不会把它们判定为源数据错误。

参考 OCR 结果

以下结果导出于 2026-07-28。全部推理均在同一台 Linux 服务器上使用一张 NVIDIA GeForce RTX 4090 24 GB GPU 完成。每个模型按照 benchmark 固定顺序逐张处理图片。 单张延迟不包含模型加载时间,并且与硬件相关。

本次评测使用两套本地构建图片:

  • Linux reference:使用上文 Linux/amd64 参考环境构建;
  • macOS private:此前在 macOS 上构建的 private 版本。

两套图片包含相同的 3,286 个样本 ID 和 reference。每个模型在两套图片上的准确率指标 完全相同,因此只展示一次:

模型CER ↓Exact Match ↑忽略标点 CER ↓忽略标点 EM ↑
MangaOCR4.683%73.524%2.700%82.867%
HayaiOCR6.738%71.272%4.967%80.949%
BaberuOCR4.589%72.246%2.603%81.649%
PaddleOCR-VL-0.9B-For-Manga2.910%78.911%1.866%84.662%

RTX 4090 上的逐张推理延迟:

模型Linux-reference 输入平均Linux-reference p50Linux-reference p95macOS-private 输入平均macOS-private p50macOS-private p95
MangaOCR83.0 ms74.8 ms151.5 ms84.6 ms77.0 ms153.0 ms
HayaiOCR102.6 ms96.3 ms175.3 ms101.5 ms95.3 ms172.0 ms
BaberuOCR103.1 ms92.1 ms203.7 ms104.2 ms92.6 ms205.8 ms
PaddleOCR-VL-0.9B-For-Manga242.0 ms211.8 ms490.6 ms246.7 ms219.2 ms487.7 ms

跨构建 prediction 对比:

模型样本数原始 prediction 差异规范化 prediction 差异指标差异
MangaOCR3,286000
HayaiOCR3,286000
BaberuOCR3,286000
PaddleOCR-VL-0.9B-For-Manga3,286100

PaddleOCR 唯一一条原始差异出现在 jmm_19_40_000180,内容仅为插入换行;删除空白后 两条 prediction 完全相同。四个模型共 13,144 次样本对比中,规范化 prediction 差异 为 0,评测指标差异也为 0。对于本次对比的两套构建和四个模型,跨平台图片差异没有对 报告中的 OCR 准确率产生可测量影响。

快速开始

Docker 是最短的参考平台构建方式。在 macOS 或 Windows 的 Docker Desktop 上也应在 两条命令中保留 --platform linux/amd64

docker build --platform linux/amd64 -t jmangabench-mixed:1.0.0 .

mkdir -p /absolute/path/to/output-parent

docker run --rm --platform linux/amd64 \
  -v "/absolute/path/to/Manga109s_released_2026_05_21:/data/Manga109s:ro" \
  -v "/absolute/path/to/output-parent:/output" \
  jmangabench-mixed:1.0.0 \
  build \
  --manga109s-root /data/Manga109s \
  --output /output/JMangaBench_Mixed \
  --workers 10

原生安装的环境要求:

  • Python 3.13;
  • uv
  • 用户单独取得且符合配方哈希的 Manga109-s 图片包(参考版本:Manga109-v2026)。

在仓库根目录执行:

uv sync --frozen

uv run python tools/verify_release.py --release-root .

uv run python -m jmangabench build \
  --manga109s-root /path/to/Manga109s_released \
  --output ./JMangaBench_Mixed \
  --workers 10

一键构建程序会验证仓库文件,恢复真实与合成数据,严格检查源数据,并按照固定顺序组装 最终 benchmark。输出目录不能预先存在。

构建结果:

JMangaBench_Mixed/
  annotations.jsonl
  manifest.json
  sha256_warnings.jsonl
  images/
    real_crops/
    synthetic/
  masks/
    body_text/

所有生成图片与 Linux 参考值一致时,sha256_warnings.jsonl 为空。否则每一行会记录 一个图片路径、参考 SHA-256 和实际 SHA-256。源资产和源 crop 校验失败仍会中止构建。

接入模型

JMangaBench_Mixed 不会导入或管理模型框架。将 examples/predict_jsonl_template.py 复制到模型自己的环境,并实现 load_model()predict()

cp examples/predict_jsonl_template.py /path/to/model/run_jmangabench.py

/path/to/model/python /path/to/model/run_jmangabench.py \
  --benchmark ./JMangaBench_Mixed \
  --output ./predictions.jsonl

模型必须为每个 benchmark ID 输出且只输出一个 JSON 对象:

{"id":"jmm_4_8_000001","prediction":"やあ坊主","latency_seconds":0.123,"error":null}

latency_secondserror 可以省略,prediction 必须始终是字符串。

评测 prediction

uv run python -m jmangabench validate-predictions \
  --benchmark ./JMangaBench_Mixed \
  --predictions ./predictions.jsonl

uv run python -m jmangabench evaluate \
  --benchmark ./JMangaBench_Mixed \
  --predictions ./predictions.jsonl \
  --output ./evaluation/my_model

成功后生成:

evaluation/my_model/
  report.json
  per_sample.jsonl

如果存在缺失、额外或重复 ID,非法 prediction 或延迟,annotation 被修改,或者图片、 mask 哈希不一致,evaluator 会拒绝评分。

指标与切片

冻结的协议为:

jmangabench_mixed_ocr_metrics/v1
jmangabench_mixed_text_normalization/v1

文本规范化执行 Unicode NFKC 并删除空白。忽略标点规则删除 Unicode 标点,但保留 U+30FC()。CER 使用 micro-average,Exact Match 使用样本平均。

每份报告包含总体结果,以及以下切片:

  • source_kind:真实或合成;
  • subset:真实 crop 或四个合成长度分组;
  • crop_type:真实 crop、文字 crop 或气泡 crop;
  • scene_type:真实 crop、气泡或直接文字;
  • orientation:横排、竖排或 unspecified。

如果 prediction 提供延迟,报告还会计算平均、p50 和 p95 延迟。

可复现性

  • release_manifest.json 记录全部发布文件的大小和 SHA-256;
  • 源页面、源 crop、foreground 和 label layer 哈希均为严格构建校验;
  • 生成图片参考哈希差异保存在 sha256_warnings.jsonl,并汇总到 manifest.json
  • 构建后的图片与 mask 哈希写入 annotations.jsonl,evaluator 会在评分前验证;
  • 最终顺序不受输入 JSONL 行顺序影响;
  • 组装后的 manifest.json 冻结 annotation 和切片数量;
  • GitHub 仓库不包含 Manga109-s 像素或本机绝对路径;
  • 本地构建的图片 benchmark 包含 Manga109-s 派生像素,并标记为 redistribution_allowed: false

不得上传本地构建的 benchmark 或任何 Private 验证图片目录。

许可证与数据条款

除非文件或目录另有说明,项目原创代码、文档、配方、元数据和资产采用 GPL-3.0-only

第三方条款继续有效:

  • GPLv3 气泡 SVG 源文件保存在 notices/manga_editor_desu_gpl3/
  • 字体声明保存在 notices/fonts/,采用 SIL Open Font License 1.1;
  • Manga109-s 由用户单独取得,并继续受其自身条款约束。

详情见 THIRD_PARTY_NOTICES.md

Contributors

muscgab

10 commits

muscgab/JMangaBench_Mixed

1

stars

10

commits

Python

primary language

Jul 28, 2026

updated

README

JMangaBench_Mixed

License Python Samples Languages

A reproducible mixed-domain benchmark for Japanese manga OCR.

English · 中文


English

JMangaBench_Mixed is a relatively easy, reproducible mixed-domain benchmark for Japanese manga OCR that simulates real-world conditions. It evaluates both real manga text and controlled synthetic text. It contains 3,286 samples and reports not only one overall score, but also results by data source, text-length group, crop type, scene type, and writing orientation.

The repository contains the code, recipes, released rendering layers, hashes, and evaluator required to reproduce the benchmark. Manga109-s pixels are not redistributed: users obtain Manga109-s separately and build the image set locally.

Dataset composition

ComponentCountDescription
Total3,286One image and one reference string per sample
Real crops1,286Locally reconstructed from Manga109-s
Synthetic samples2,000Four groups of 500
Synthetic body-text masks2,000Furigana is excluded from the body-text mask
Orientation1,390 vertical / 610 horizontalSynthetic samples only
Crop type1,000 text crops / 1,000 balloon cropsSynthetic samples only
Scene type1,600 balloon / 400 direct textSynthetic samples only

Synthetic crop types

crop_typeCrop ruleBalloon sceneDirect-text sceneTotal
text_detector_cropBody-text mask bounding box plus realized padding6004001,000
balloon_detectorFull generated canvas; no second crop around the text1,00001,000

Both crop types are scored with OCR metrics. No detector metric is computed.

The synthetic groups are:

SubsetSamplesConfigured visible-text range
mixed_4_85004–8
mixed_9_135009–13
mixed_14_1850014–18
mixed_19_4050019–40

Every group is balanced between 250 text_detector_crop and 250 balloon_detector samples.

The synthetic set uses 28 distinct font files and 82 distinct container assets:

  • 44 GPL-licensed SVG balloon assets;
  • 36 project hand-drawn assets;
  • 2 project procedural assets.

The repository retains 48 GPL SVG sources; 44 of them are used by the final samples. A pool of 1,000 Manga109-s background regions is used twice across the 2,000 synthetic samples.

Manga109-s source version

FieldFrozen value
Source datasetManga109-s
Source releaseManga109-v2026
Reference package date2026-05-21
Annotation source used to prepare the recipesCurrent annotations/ included with Manga109-v2026
Manga109-s files read during local reconstructionimages/ only
Real-crop source verificationFull-page file SHA-256, page dimensions, and decoded crop pixel SHA-256 are strict checks
Synthetic source verificationPage dimensions, source-region pixel SHA-256, foreground SHA-256, and label-layer SHA-256 are strict checks
Generated-image verificationFinal PNG SHA-256 differences are warnings recorded in sha256_warnings.jsonl

The version label is recorded as source metadata. A mismatch in a source asset or decoded source crop stops construction. A final generated-image SHA-256 difference does not stop construction and is recorded in the warning report.

Linux reference environment and Docker

The generated-image reference hashes were produced on the following Linux/amd64 system:

FieldReference value
JMangaBench_Mixedv1.0.0
OSUbuntu 22.04.1 LTS
Kernel5.15.0-133-generic
Architecturex86_64
CPUIntel Xeon Platinum 8358P
GPUNVIDIA GeForce RTX 4090, 24 GB; used for OCR inference only, not PNG construction
Python3.13.14 (Anaconda, GCC 14.3)
Pillow12.3.0
JPEG codec ABI6.2
libjpeg-turbo3.1.4.1
zlib1.3.2

The repository also provides a pinned Linux/amd64 Docker build. Its base image is ghcr.io/astral-sh/uv@sha256:531f855bda2c73cd6ef67d56b733b357cea384185b3022bd09f05e002cd144ca. The resulting runtime uses Python 3.13.11, Pillow 12.3.0, JPEG codec ABI 6.2, libjpeg-turbo 3.1.4.1, and zlib 1.2.13.

Native builds on macOS or Windows can produce a different final PNG byte stream or slightly different generated pixels because image codecs and numerical implementations differ across platforms. Such differences may be visually and OCR-negligible, but SHA-256 alone does not measure their practical effect. The builder therefore reports every affected generated image without treating it as a source-data failure.

Reference OCR results

The following results were exported on 2026-07-28. All inference was performed on the same Linux server with one NVIDIA GeForce RTX 4090 24 GB GPU. Each model processed one image at a time in canonical benchmark order. Per-image latency does not include model loading and is hardware-dependent.

Two locally constructed image sets were evaluated:

  • Linux reference: the Linux/amd64 reference construction described above;
  • macOS private: the earlier private construction produced on macOS.

Both sets contain the same 3,286 sample IDs and reference strings. The accuracy metrics were identical for each model, so they are reported once:

ModelCER ↓Exact match ↑Text-only CER ↓Text-only exact match ↑
MangaOCR4.683%73.524%2.700%82.867%
HayaiOCR6.738%71.272%4.967%80.949%
BaberuOCR4.589%72.246%2.603%81.649%
PaddleOCR-VL-0.9B-For-Manga2.910%78.911%1.866%84.662%

Sequential per-image latency on the RTX 4090:

ModelLinux-reference input meanLinux-reference p50Linux-reference p95macOS-private input meanmacOS-private p50macOS-private p95
MangaOCR83.0 ms74.8 ms151.5 ms84.6 ms77.0 ms153.0 ms
HayaiOCR102.6 ms96.3 ms175.3 ms101.5 ms95.3 ms172.0 ms
BaberuOCR103.1 ms92.1 ms203.7 ms104.2 ms92.6 ms205.8 ms
PaddleOCR-VL-0.9B-For-Manga242.0 ms211.8 ms490.6 ms246.7 ms219.2 ms487.7 ms

Cross-construction prediction comparison:

ModelSamplesRaw prediction differencesNormalized prediction differencesMetric differences
MangaOCR3,286000
HayaiOCR3,286000
BaberuOCR3,286000
PaddleOCR-VL-0.9B-For-Manga3,286100

The single raw PaddleOCR difference for jmm_19_40_000180 consisted only of inserted line breaks; whitespace normalization made the predictions identical. Across 13,144 model-sample comparisons, there were no normalized prediction differences and no metric differences. For these two constructions and four tested models, the cross-platform image differences had no measurable effect on the reported OCR accuracy.

Quick start

Docker is the shortest reference-platform path. Docker Desktop users on macOS or Windows should keep --platform linux/amd64 in both commands:

docker build --platform linux/amd64 -t jmangabench-mixed:1.0.0 .

mkdir -p /absolute/path/to/output-parent

docker run --rm --platform linux/amd64 \
  -v "/absolute/path/to/Manga109s_released_2026_05_21:/data/Manga109s:ro" \
  -v "/absolute/path/to/output-parent:/output" \
  jmangabench-mixed:1.0.0 \
  build \
  --manga109s-root /data/Manga109s \
  --output /output/JMangaBench_Mixed \
  --workers 10

For a native installation, requirements are:

  • Python 3.13;
  • uv;
  • a separately obtained Manga109-s image package matching the recorded hashes (reference release: Manga109-v2026).

From the repository root:

uv sync --frozen

uv run python tools/verify_release.py --release-root .

uv run python -m jmangabench build \
  --manga109s-root /path/to/Manga109s_released \
  --output ./JMangaBench_Mixed \
  --workers 10

The one-command builder verifies the repository, reconstructs the real and synthetic components, performs strict source checks, and assembles the final benchmark in canonical order. The output directory must not already exist.

Expected output:

JMangaBench_Mixed/
  annotations.jsonl
  manifest.json
  sha256_warnings.jsonl
  images/
    real_crops/
    synthetic/
  masks/
    body_text/

sha256_warnings.jsonl is empty when every generated image matches the Linux reference. Otherwise, each line identifies one image, its reference SHA-256, and its actual SHA-256. Source asset and source-crop failures remain fatal.

Connect a model

JMangaBench_Mixed does not import or manage model frameworks. Copy examples/predict_jsonl_template.py into the model's own environment and implement load_model() and predict():

cp examples/predict_jsonl_template.py /path/to/model/run_jmangabench.py

/path/to/model/python /path/to/model/run_jmangabench.py \
  --benchmark ./JMangaBench_Mixed \
  --output ./predictions.jsonl

The model must produce exactly one JSON object for every benchmark ID:

{"id":"jmm_4_8_000001","prediction":"やあ坊主","latency_seconds":0.123,"error":null}

latency_seconds and error are optional. prediction must always be a string.

Evaluate predictions

uv run python -m jmangabench validate-predictions \
  --benchmark ./JMangaBench_Mixed \
  --predictions ./predictions.jsonl

uv run python -m jmangabench evaluate \
  --benchmark ./JMangaBench_Mixed \
  --predictions ./predictions.jsonl \
  --output ./evaluation/my_model

Evaluation creates:

evaluation/my_model/
  report.json
  per_sample.jsonl

The evaluator rejects missing, extra, or duplicate IDs; invalid predictions or latencies; modified annotations; and image or mask hash mismatches.

Metrics and slices

The frozen protocols are:

jmangabench_mixed_ocr_metrics/v1
jmangabench_mixed_text_normalization/v1

Normalization applies Unicode NFKC and removes whitespace. The text-only policy removes Unicode punctuation while preserving U+30FC (). CER is micro-averaged; exact match is sample-averaged.

Each report contains overall results and slices by:

  • source_kind: real or synthetic;
  • subset: real crops or one of the four synthetic length groups;
  • crop_type: real crop, text crop, or balloon crop;
  • scene_type: real crop, balloon, or direct text;
  • orientation: horizontal, vertical, or unspecified.

When latency is provided, the report also includes mean, p50, and p95 latency.

Reproducibility

  • release_manifest.json records every distributable file's size and SHA-256.
  • Source-page, source-crop, foreground, and label-layer hashes are strict construction checks.
  • Generated-image reference differences are preserved in sha256_warnings.jsonl and summarized in manifest.json.
  • The built image and mask hashes are frozen in annotations.jsonl and checked by the evaluator before scoring.
  • Final ordering is independent of input JSONL line order.
  • The assembled manifest.json freezes annotations and slice counts.
  • Public repository files contain no Manga109-s pixels or local absolute paths.
  • The locally built image benchmark contains Manga109-s-derived pixels and is marked redistribution_allowed: false.

Do not upload the locally built benchmark or any private verification image directory.

License and data terms

Project-authored code, documentation, recipes, metadata, and assets are licensed under GPL-3.0-only, unless a file or directory says otherwise.

Third-party terms remain in effect:

  • GPLv3 speech-bubble SVG sources are preserved under notices/manga_editor_desu_gpl3/;
  • font notices are preserved under notices/fonts/ under SIL Open Font License 1.1;
  • Manga109-s must be obtained separately and remains governed by its own terms.

See THIRD_PARTY_NOTICES.md for details.


中文

JMangaBench_Mixed 是一个面向日文漫画 OCR 的模拟真实情况的较简单的可复现混合域评测集。它同时测试真实漫画文字与可控合成文字,共包含 3,286 个样本。

本仓库提供复现 benchmark 所需的代码、配方、发布渲染层、哈希和 evaluator,不重新分发 Manga109-s 像素。用户需要单独取得 Manga109-s,并在本地构建图片测试集。

数据组成

组成数量说明
总计3,286每个样本包含一张图片和一个正文答案
真实 crop1,286在本地从 Manga109-s 恢复
合成样本2,000四组,每组 500 张
合成正文 mask2,000正文 mask 不包含 furigana
文字方向竖排 1,390 / 横排 610仅统计合成样本
Crop 类型文字 crop 1,000 / 气泡 crop 1,000仅统计合成样本
场景类型气泡 1,600 / 直接文字 400仅统计合成样本

合成 crop 类型

crop_type裁剪规则气泡场景直接文字场景合计
text_detector_crop正文 mask 包围框加实际 padding6004001,000
balloon_detector保留完整生成画布,不围绕正文二次裁剪1,00001,000

两种 crop 均使用 OCR 指标评分,不计算检测器指标。

四个合成分组为:

子集样本数配置的可见文字范围
mixed_4_85004–8
mixed_9_135009–13
mixed_14_1850014–18
mixed_19_4050019–40
每组均包含 250 张 text_detector_crop 和 250 张 balloon_detector

合成样本实际使用 28 个不同的字体文件和 82 个不同的容器资产:

  • 44 个 GPL SVG 气泡资产;
  • 36 个项目自绘资产;
  • 2 个项目程序生成资产。

仓库保留了 48 个 GPL SVG 源文件,其中 44 个实际进入最终样本。合成数据使用 1,000 个 Manga109-s 背景区域,每个背景在 2,000 张样本中使用两次。

Manga109-s 来源版本

字段冻结值
来源数据集Manga109-s
来源版本Manga109-v2026
参考数据包日期2026-05-21
生成配方时使用的 annotationManga109-v2026 中当前的 annotations/
本地重建时读取的 Manga109-s 文件images/
真实 crop 来源验证完整页面文件 SHA-256、页面尺寸和解码后 crop 像素 SHA-256 均为严格校验
合成来源验证页面尺寸、源区域像素 SHA-256、foreground SHA-256 和 label layer SHA-256 均为严格校验
生成图片验证最终 PNG SHA-256 差异仅作 Warning,并写入 sha256_warnings.jsonl

版本名称作为来源元数据记录。源资产或解码后源 crop 不一致时构建会立即失败;仅最终 生成图片 SHA-256 不一致时不会中止,而是写入 Warning 报告。

Linux 参考环境与 Docker

最终生成图片的参考哈希来自以下 Linux/amd64 环境:

字段参考值
JMangaBench_Mixedv1.0.0
操作系统Ubuntu 22.04.1 LTS
内核5.15.0-133-generic
架构x86_64
CPUIntel Xeon Platinum 8358P
GPUNVIDIA GeForce RTX 4090,24 GB;仅用于 OCR 推理,不参与 PNG 构建
Python3.13.14(Anaconda,GCC 14.3)
Pillow12.3.0
JPEG codec ABI6.2
libjpeg-turbo3.1.4.1
zlib1.3.2

仓库同时提供固定的 Linux/amd64 Docker 构建,基础镜像为 ghcr.io/astral-sh/uv@sha256:531f855bda2c73cd6ef67d56b733b357cea384185b3022bd09f05e002cd144ca。 容器运行时使用 Python 3.13.11、Pillow 12.3.0、JPEG codec ABI 6.2、 libjpeg-turbo 3.1.4.1 和 zlib 1.2.13。

在 macOS 或 Windows 上原生构建时,图片编解码器和数值实现的跨平台差异可能改变最终 PNG 字节流,或造成轻微的生成像素差异。这类差异对肉眼观感和 OCR prediction 的影响 可能很小,但 SHA-256 本身不能衡量实际影响。因此构建器会列出所有受影响的生成图片, 但不会把它们判定为源数据错误。

参考 OCR 结果

以下结果导出于 2026-07-28。全部推理均在同一台 Linux 服务器上使用一张 NVIDIA GeForce RTX 4090 24 GB GPU 完成。每个模型按照 benchmark 固定顺序逐张处理图片。 单张延迟不包含模型加载时间,并且与硬件相关。

本次评测使用两套本地构建图片:

  • Linux reference:使用上文 Linux/amd64 参考环境构建;
  • macOS private:此前在 macOS 上构建的 private 版本。

两套图片包含相同的 3,286 个样本 ID 和 reference。每个模型在两套图片上的准确率指标 完全相同,因此只展示一次:

模型CER ↓Exact Match ↑忽略标点 CER ↓忽略标点 EM ↑
MangaOCR4.683%73.524%2.700%82.867%
HayaiOCR6.738%71.272%4.967%80.949%
BaberuOCR4.589%72.246%2.603%81.649%
PaddleOCR-VL-0.9B-For-Manga2.910%78.911%1.866%84.662%

RTX 4090 上的逐张推理延迟:

模型Linux-reference 输入平均Linux-reference p50Linux-reference p95macOS-private 输入平均macOS-private p50macOS-private p95
MangaOCR83.0 ms74.8 ms151.5 ms84.6 ms77.0 ms153.0 ms
HayaiOCR102.6 ms96.3 ms175.3 ms101.5 ms95.3 ms172.0 ms
BaberuOCR103.1 ms92.1 ms203.7 ms104.2 ms92.6 ms205.8 ms
PaddleOCR-VL-0.9B-For-Manga242.0 ms211.8 ms490.6 ms246.7 ms219.2 ms487.7 ms

跨构建 prediction 对比:

模型样本数原始 prediction 差异规范化 prediction 差异指标差异
MangaOCR3,286000
HayaiOCR3,286000
BaberuOCR3,286000
PaddleOCR-VL-0.9B-For-Manga3,286100

PaddleOCR 唯一一条原始差异出现在 jmm_19_40_000180,内容仅为插入换行;删除空白后 两条 prediction 完全相同。四个模型共 13,144 次样本对比中,规范化 prediction 差异 为 0,评测指标差异也为 0。对于本次对比的两套构建和四个模型,跨平台图片差异没有对 报告中的 OCR 准确率产生可测量影响。

快速开始

Docker 是最短的参考平台构建方式。在 macOS 或 Windows 的 Docker Desktop 上也应在 两条命令中保留 --platform linux/amd64

docker build --platform linux/amd64 -t jmangabench-mixed:1.0.0 .

mkdir -p /absolute/path/to/output-parent

docker run --rm --platform linux/amd64 \
  -v "/absolute/path/to/Manga109s_released_2026_05_21:/data/Manga109s:ro" \
  -v "/absolute/path/to/output-parent:/output" \
  jmangabench-mixed:1.0.0 \
  build \
  --manga109s-root /data/Manga109s \
  --output /output/JMangaBench_Mixed \
  --workers 10

原生安装的环境要求:

  • Python 3.13;
  • uv
  • 用户单独取得且符合配方哈希的 Manga109-s 图片包(参考版本:Manga109-v2026)。

在仓库根目录执行:

uv sync --frozen

uv run python tools/verify_release.py --release-root .

uv run python -m jmangabench build \
  --manga109s-root /path/to/Manga109s_released \
  --output ./JMangaBench_Mixed \
  --workers 10

一键构建程序会验证仓库文件,恢复真实与合成数据,严格检查源数据,并按照固定顺序组装 最终 benchmark。输出目录不能预先存在。

构建结果:

JMangaBench_Mixed/
  annotations.jsonl
  manifest.json
  sha256_warnings.jsonl
  images/
    real_crops/
    synthetic/
  masks/
    body_text/

所有生成图片与 Linux 参考值一致时,sha256_warnings.jsonl 为空。否则每一行会记录 一个图片路径、参考 SHA-256 和实际 SHA-256。源资产和源 crop 校验失败仍会中止构建。

接入模型

JMangaBench_Mixed 不会导入或管理模型框架。将 examples/predict_jsonl_template.py 复制到模型自己的环境,并实现 load_model()predict()

cp examples/predict_jsonl_template.py /path/to/model/run_jmangabench.py

/path/to/model/python /path/to/model/run_jmangabench.py \
  --benchmark ./JMangaBench_Mixed \
  --output ./predictions.jsonl

模型必须为每个 benchmark ID 输出且只输出一个 JSON 对象:

{"id":"jmm_4_8_000001","prediction":"やあ坊主","latency_seconds":0.123,"error":null}

latency_secondserror 可以省略,prediction 必须始终是字符串。

评测 prediction

uv run python -m jmangabench validate-predictions \
  --benchmark ./JMangaBench_Mixed \
  --predictions ./predictions.jsonl

uv run python -m jmangabench evaluate \
  --benchmark ./JMangaBench_Mixed \
  --predictions ./predictions.jsonl \
  --output ./evaluation/my_model

成功后生成:

evaluation/my_model/
  report.json
  per_sample.jsonl

如果存在缺失、额外或重复 ID,非法 prediction 或延迟,annotation 被修改,或者图片、 mask 哈希不一致,evaluator 会拒绝评分。

指标与切片

冻结的协议为:

jmangabench_mixed_ocr_metrics/v1
jmangabench_mixed_text_normalization/v1

文本规范化执行 Unicode NFKC 并删除空白。忽略标点规则删除 Unicode 标点,但保留 U+30FC()。CER 使用 micro-average,Exact Match 使用样本平均。

每份报告包含总体结果,以及以下切片:

  • source_kind:真实或合成;
  • subset:真实 crop 或四个合成长度分组;
  • crop_type:真实 crop、文字 crop 或气泡 crop;
  • scene_type:真实 crop、气泡或直接文字;
  • orientation:横排、竖排或 unspecified。

如果 prediction 提供延迟,报告还会计算平均、p50 和 p95 延迟。

可复现性

  • release_manifest.json 记录全部发布文件的大小和 SHA-256;
  • 源页面、源 crop、foreground 和 label layer 哈希均为严格构建校验;
  • 生成图片参考哈希差异保存在 sha256_warnings.jsonl,并汇总到 manifest.json
  • 构建后的图片与 mask 哈希写入 annotations.jsonl,evaluator 会在评分前验证;
  • 最终顺序不受输入 JSONL 行顺序影响;
  • 组装后的 manifest.json 冻结 annotation 和切片数量;
  • GitHub 仓库不包含 Manga109-s 像素或本机绝对路径;
  • 本地构建的图片 benchmark 包含 Manga109-s 派生像素,并标记为 redistribution_allowed: false

不得上传本地构建的 benchmark 或任何 Private 验证图片目录。

许可证与数据条款

除非文件或目录另有说明,项目原创代码、文档、配方、元数据和资产采用 GPL-3.0-only

第三方条款继续有效:

  • GPLv3 气泡 SVG 源文件保存在 notices/manga_editor_desu_gpl3/
  • 字体声明保存在 notices/fonts/,采用 SIL Open Font License 1.1;
  • Manga109-s 由用户单独取得,并继续受其自身条款约束。

详情见 THIRD_PARTY_NOTICES.md

Contributors

muscgab

10 commits

Languages

Python

99.4%