mokuro

mokuro

日本漫画OCR工具,为学习者提供可选文本阅读体验

mokuro是一个开源项目,为日语学习者提供了便捷的漫画阅读工具。该工具通过文本检测和OCR技术,将日本漫画中的文字转换为可选文本。mokuro离线处理漫画页面,生成包含OCR结果的.mokuro文件,用户可通过网页阅读器浏览处理后的漫画。支持弹出字典功能,方便学习者查询生词。此外,mokuro具备多卷处理能力,并兼容旧版HTML格式,适合各类漫画爱好者和日语学习者使用。

mokuro日语漫画OCR技术阅读器文本检测Github开源项目

mokuro

Read Japanese manga with selectable text inside a browser.

See demo: https://kha-white.github.io/manga-demo

https://user-images.githubusercontent.com/22717958/164993274-3e8d1650-9be3-457d-84cb-f92f9598cd5a.mp4

<sup>Demo contains excerpt from Manga109-s dataset. うちの猫’ず日記 © がぁさん</sup>

mokuro is aimed towards Japanese learners, who want to read manga in Japanese with a pop-up dictionary like Yomitan. It works like this:

  1. Perform text detection and OCR for each page.
  2. After processing a whole volume, generate a .mokuro file, which contains OCR results and metadata. All processing is done offline (before reading).
  3. Load the .mokuro file together with manga images in web reader, which serves both as a manga reader and a catalog for processed series and volumes.

Alternatively, you can still use the old method from mokuro 0.1.*: Instead of a .mokuro file, generate an HTML file, which you can open in a browser. You can transfer the resulting HTML file together with manga images to another device (e.g. your mobile phone) and read there. This method is still supported for backward compatibility, but it is recommended to use the new .mokuro format and the web reader. For details, see Legacy HTML vs. new .mokuro format.

mokuro uses comic-text-detector for text detection and manga-ocr for OCR.

Try running on your manga in Colab: Open In Colab

See also:

  • mokuro-reader, a web reader for mokuro, developed by ZXY101
  • Mokuro2Pdf, cli Ruby script to generate pdf files with selectable text from Mokuro's html overlay
  • Xelieu's guide, a comprehensive guide on setting up a reading and mining workflow with manga-ocr/mokuro (and many other useful tips)

Installation

You need Python 3.6 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.

Some users have reported problems with Python installed from Microsoft Store. If you see an error: ImportError: DLL load failed while importing fugashi: The specified module could not be found., try installing Python from the official site.

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

Run in command line:

pip3 install mokuro

Usage

Run on one volume

mokuro /path/to/manga/vol1

This will generate /path/to/manga/vol1.html file, which you can open in a browser.

If your path contains spaces, enclose it in double quotes, like this:

mokuro "/path/to/manga/volume 1"

Run on multiple volumes

mokuro /path/to/manga/vol1 /path/to/manga/vol2 /path/to/manga/vol3

For each volume, a separate HTML file will be generated.

Run on a directory containing multiple volumes

If your directory structure looks somewhat like this:

manga_title/
├─vol1/
├─vol2/
├─vol3/
└─vol4/

You can process all volumes by running:

mokuro --parent_dir manga_title/

Other options

--pretrained_model_name_or_path: Name or path of the manga-ocr model.
--force_cpu: Force the use of CPU even if CUDA is available.
--disable_confirmation: Disable confirmation prompt. If False, the user will be prompted to confirm the list of volumes to be processed.
--disable_ocr: Disable OCR processing. Generate mokuro/HTML files without OCR results.
--ignore_errors: Continue processing volumes even if an error occurs.
--no_cache: Do not use cached OCR results from previous runs (_ocr directories).
--unzip: Extract volumes in zip/cbz format in their original location.
--disable_html: Disable legacy HTML output. If True, acts as if --unzip is True.
--as_one_file: Applies only to legacy HTML. If False, generate separate CSS and JS files instead of embedding them in the HTML file.
--version: Print the version of mokuro and exit.

Legacy HTML vs. new .mokuro format

Before version 0.2.0, mokuro generated a separate HTML file for each processed volume, which caused some usability issues:

  • HTML files contained both the OCR results and the whole web reader GUI, so in order to update the GUI, all volumes needed to be updated with a new mokuro version
  • images were stored separately and linked in HTML files, so any change in the directory structure could break the links
  • transferring the manga to another device required transferring both the HTML files and the images
  • there was no unified GUI for a whole catalog containing multiple volumes
  • on some mobile devices, some workarounds were needed to open HTML files

Starting from version 0.2.0, a new .mokuro format is introduced, which is generated for each volume and contains only the OCR results and metadata necessary for the web reader GUI. Web reader is now a separate web app, which can open manga volumes with their associated .mokuro files.

The old HTML format is still generated for backward compatibility, but it will not be developed further, and it is recommended to use the new .mokuro format and the web reader.

Contact

For any inquiries, please feel free to contact me at kha-white@mail.com

Acknowledgments

编辑推荐精选

iTerms

iTerms

企业专属的AI法律顾问

iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。

SimilarWeb流量提升

SimilarWeb流量提升

稳定高效的流量提升解决方案,助力品牌曝光

稳定高效的流量提升解决方案,助力品牌曝光

Sora2视频免费生成

Sora2视频免费生成

最新版Sora2模型免费使用,一键生成无水印视频

最新版Sora2模型免费使用,一键生成无水印视频

Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
TRAE编程

TRAE编程

AI辅助编程,代码自动修复

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
商汤小浣熊

商汤小浣熊

最强AI数据分析助手

小浣熊家族Raccoon,您的AI智能助手,致力于通过先进的人工智能技术,为用户提供高效、便捷的智能服务。无论是日常咨询还是专业问题解答,小浣熊都能以快速、准确的响应满足您的需求,让您的生活更加智能便捷。

imini AI

imini AI

像人一样思考的AI智能体

imini 是一款超级AI智能体,能根据人类指令,自主思考、自主完成、并且交付结果的AI智能体。

Keevx

Keevx

AI数字人视频创作平台

Keevx 一款开箱即用的AI数字人视频创作平台,广泛适用于电商广告、企业培训与社媒宣传,让全球企业与个人创作者无需拍摄剪辑,就能快速生成多语言、高质量的专业视频。

即梦AI

即梦AI

一站式AI创作平台

提供 AI 驱动的图片、视频生成及数字人等功能,助力创意创作

下拉加载更多