---
title: manga-ocr-base-CPT
canonical_url: "https://www.modelscope.cn/models/muscgab/manga-ocr-base-CPT"
md_url: "https://www.modelscope.cn/models/muscgab/manga-ocr-base-CPT.md"
repository: muscgab/manga-ocr-base-CPT
last_updated: 2026-10-15
license: cc-by-nc-sa-4.0
pipeline_tag: ocr-recognition
tasks:
  - ocr-recognition
base_model:
  - kha-white/manga-ocr-base
base_model_relation: finetune
parameters: 110.9M
tensor_type:
  - F32
library_name:
  - safetensors
  - pytorch
frameworks:
  - pytorch
language:
  - ja
downloads: 11
stars: 0
tags:
  - ocr
  - manga
  - japanese
---

# manga-ocr-base-CPT

> manga-ocr-base-CPT - muscgab 在 ModelScope 开源的模型。Code, technical report and findings: GitHub muscgab/manga-ocr-CPT · Weights: Hugging Face · ModelScope

muscgab/manga-ocr-base-CPT 是 ModelScope 魔搭社区上的 110.9M 参数ocr-recognition模型，采用 cc-by-nc-sa-4.0 许可，基于 kha-white/manga-ocr-base 构建。

- **Repository**: muscgab/manga-ocr-base-CPT
- **License**: cc-by-nc-sa-4.0
- **Tasks**: ocr-recognition
- **Parameters**: 110.9M
- **Base model**: kha-white/manga-ocr-base
- **Tags**: ocr, manga, japanese
- **Downloads**: 11
- **Stars**: 0
- **Last updated**: 2026-10-15

Source: https://www.modelscope.cn/models/muscgab/manga-ocr-base-CPT

---

# manga-ocr-base-CPT

[English](README.md) | [中文](README_zh.md)

Code, technical report and findings: [GitHub muscgab/manga-ocr-CPT](https://github.com/muscgab/manga-ocr-CPT) · Weights: [Hugging Face](https://huggingface.co/muscgab/manga-ocr-base-CPT) · [ModelScope](https://modelscope.cn/models/muscgab/manga-ocr-base-CPT)

OCR for Japanese manga text boxes. This is [mangaOCR](https://huggingface.co/kha-white/manga-ocr-base) after continued pre-training on our training data, with the architecture unchanged (ViT-B/16 encoder, 2-layer BERT decoder, autoregressive, 111M parameters) and a new vocabulary of 6,817 characters. Input: stretched to 224 × 224 (14 × 14 patches), pixel-identical to the original mangaOCR `ViTImageProcessor`.

The control of the two models: its input is exactly that of the original mangaOCR, so it shows the effect of changing only the data. For general use, manga-ocr-base-CPT-flex is better on elongated and horizontal boxes.

This model comes from an experimental study; see the [technical report](https://github.com/muscgab/manga-ocr-CPT/blob/main/TECHNICAL_REPORT.md).

## Accuracy

[JMangaBench_Read v1.3](https://github.com/muscgab/JMangaBench_Read), 7,789 boxes, RIN v1 normalisation, batch 1, RTX 2080 Ti.

| Model | Score ↑ | CER % ↓ | EM % ↑ | EM printed | EM non-printed |
|---|---|---|---|---|---|
| **manga-ocr-base-CPT** | **97.43** | **1.77** | **91.00** | 93.82 | 82.32 |
| manga-ocr-base-CPT-flex | 97.45 | 1.53 | 91.42 | 94.16 | 83.00 |
| mangaOCR (original, package defaults) | 90.23 | 4.84 | 78.25 | 88.04 | 48.17 |

## Speed

RTX 2080 Ti, Read v1.3 speed protocol, preprocessing included; a page (8.7 boxes on average) is one batch.

| Inference path | Per crop (batch 1) | Page p50 | Peak throughput |
|---|---|---|---|
| CUDA path (CUDA graphs + GPU preprocessing) | 10.4 ms | 38.1 ms | 277 crops/s (batch 32) |
| Plain PyTorch path | 27.6 ms | 69.7 ms | 234 crops/s (batch 64) |
| Original manga-ocr package (fp16) | 84.9 ms | 242.4 ms | 42 crops/s (batch 56) |

Both paths give identical outputs on all 7,789 boxes.

## Usage

The inference code is on GitHub; the weights are downloaded from this repository on first use.

```bash
pip install git+https://github.com/muscgab/manga-ocr-CPT
```

```python
from manga_ocr_cpt import MangaOcrCPT
ocr = MangaOcrCPT("224")              # or a local directory holding this repository
ocr("crop.png")                          # one crop -> str
ocr(["crop1.png", "crop2.png"])          # the crops of one page -> list[str]
```

Inputs are cropped text boxes (file paths, PIL images or uint8 RGB arrays); there is no text detection. With an NVIDIA GPU the CUDA path is used, otherwise plain PyTorch (CPU, Apple MPS, ...).

## Training

- Initialised from `kha-white/manga-ocr-base`; the 5,133 characters already in the original vocabulary keep their embeddings.
- Data (same as manga-ocr-nar-small): 4,471,985 crops: synthetic printed text 1,795,869, synthetic handwriting 1,670,000, [AnimeText-OCR](https://huggingface.co/datasets/JustANormalTinkerer/animetext-ocr) real crops 1,006,116. Labels of 1–64 characters.
- 139,749 steps, global batch 256 (8 epochs), 4 × RTX 2080 Ti; encoder fp16 mixed precision, decoder fp32. Released weights are from the last step.

## Files

| File | Contents |
|---|---|
| `model.safetensors` | Weights, fp32 (444 MB) |
| `config.json` | Architecture and input settings (`input.fit` selects the input) |
| `nar_vocabulary_6817.json` | Vocabulary (6,817 characters) |
| `LICENSE_MODEL` | CC BY-NC-SA 4.0 |
| `NOTICE.md` | Provenance and acknowledgements |
| `SHA256SUMS` | Checksums |

## Limitations

- Japanese only. At most 64 characters per box; longer boxes must be split first. Boxes of more than 32 characters are clearly weaker.
- Handwriting and stylised lettering produce clearly more errors than printed text.
- Aimed at dialogue, narration and small annotations; onomatopoeia is not a target.
- The benchmark was built by the same author; parts of it were used during development. Not evaluated on scanned manga such as Manga109-s.

## License

- Weights: CC BY-NC-SA 4.0 (`LICENSE_MODEL`); commercial use requires separate permission. The training data AnimeText-OCR is CC BY-NC-SA 4.0.
- Initialised from kha-white/manga-ocr-base (Apache License 2.0). See `NOTICE.md`.
- The inference code on GitHub is Apache License 2.0.
