Read Japanese manga inside browser with selectable text.

Overview

mokuro

Read Japanese manga with selectable text inside a browser.

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

mokuro_demo.mp4

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

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

  1. Perform text detection and OCR for each page.
  2. After processing a whole volume, generate a HTML file, which you can open in a browser.
  3. All processing is done offline (before reading). You can transfer the resulting HTML file together with manga images to another device (e.g. your mobile phone) and read there.

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

Try running on your manga in Colab: Open In Colab

For a comprehensive guide on setting up a reading and mining workflow with manga-ocr/mokuro, check out Xelieu's guide.

Installation

You need Python 3.6, 3.7, 3.8 or 3.9. Unfortunately, PyTorch does not support Python 3.10 yet.

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.

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

--force_cpu - disable GPU
--as_one_file - generate separate css and js files instead of embedding everything in html
--disable_confirmation - run without asking for confirmation

Contact

For any inquiries, please feel free to contact me at [email protected]

Acknowledgments

Comments
  • Blank HTML File

    Blank HTML File

    Hello, I recently followed Xelieu's guide on using Mokuro. I finished creating the HTML and OCR files for 18 volumes of Karakai Takagi-san but none of the HTML works. Done through google collab.

    opened by SebyKebby 3
  • Folders with spaces don't work

    Folders with spaces don't work

    When the folder is named with spaces like this image it thinks that every space is another directory image when in fact its only one folder when you run it like this it will give you instantly bunch of errors and not work image

    if i rename that same folder so that there are no spaces image image it works like it should image

    opened by OltiP2 3
  • Converted manga won't work with yomichan

    Converted manga won't work with yomichan

    image

    I converted this manga and tried to shift hover over multiple pages. Nothing came up but when I went to the other tab it worked with just random text on google.

    opened by KolbyML 2
  • ImportError: DLL load failed while importing fugashi: The specified module could not be found.

    ImportError: DLL load failed while importing fugashi: The specified module could not be found.

    C:\Users\Seven7>mokuro "C:\A\Summertime renderer v01"
    
    Paths to process:
    
    C:\A\Summertime renderer v01
    
    Each of the paths above will be treated as one volume. Continue? [yes/no]
    yes
    2022-05-05 13:18:13.152 | INFO     | mokuro.run:run:40 - Processing 1/1: C:\A\Summertime renderer v01
    Processing pages...:   0%|                                                                                                                                                                                          | 0/294 [00:00<?, ?it/s]2022-05-05 13:18:13.170 | INFO     | mokuro.manga_page_ocr:__init__:30 - Initializing text detector
    2022-05-05 13:18:13.614 | INFO     | manga_ocr.ocr:__init__:13 - Loading OCR model from kha-white/manga-ocr-base
    Processing pages...:   0%|                                                                                                                                                                                          | 0/294 [00:06<?, ?it/s]
    2022-05-05 13:18:19.524 | ERROR    | mokuro.run:run:44 - Error while processing C:\A\Summertime renderer v01
    Traceback (most recent call last):
    
      File "c:\program files\python39\lib\runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
               │         │     └ {'__name__': '__main__', '__doc__': None, '__package__': '', '__loader__': <zipimporter object "C:\Users\Seven7\AppData\...
               │         └ <code object <module> at 0x000002AF10CFFF50, file "C:\Users\Seven7\AppData\Roaming\Python\Python39\Scripts\mokuro.exe\__...
               └ <function _run_code at 0x000002AF104DECA0>
    
      File "c:\program files\python39\lib\runpy.py", line 87, in _run_code
        exec(code, run_globals)
             │     └ {'__name__': '__main__', '__doc__': None, '__package__': '', '__loader__': <zipimporter object "C:\Users\Seven7\AppData\...
             └ <code object <module> at 0x000002AF10CFFF50, file "C:\Users\Seven7\AppData\Roaming\Python\Python39\Scripts\mokuro.exe\__...
    
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\Scripts\mokuro.exe\__main__.py", line 7, in <module>
        sys.exit(main())
        │   │    └ <function main at 0x000002AF10CEC280>
        │   └ <built-in function exit>
        └ <module 'sys' (built-in)>
    
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\mokuro\__main__.py", line 7, in main
        fire.Fire(run)
        │    │    └ <function run at 0x000002AF36438CA0>
        │    └ <function Fire at 0x000002AF36438F70>
        └ <module 'fire' from 'C:\\Users\\Seven7\\AppData\\Roaming\\Python\\Python39\\site-packages\\fire\\__init__.py'>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\fire\core.py", line 141, in Fire
        component_trace = _Fire(component, args, parsed_flag_args, context, name)
                          │     │          │     │                 │        └ 'mokuro'
                          │     │          │     │                 └ {}
                          │     │          │     └ Namespace(verbose=False, interactive=False, separator='-', completion=None, help=False, trace=False)
                          │     │          └ ['C:\\A\\Summertime renderer v01']
                          │     └ <function run at 0x000002AF36438CA0>
                          └ <function _Fire at 0x000002AF364C0F70>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\fire\core.py", line 466, in _Fire
        component, remaining_args = _CallAndUpdateTrace(
        │                           └ <function _CallAndUpdateTrace at 0x000002AF364C20D0>
        └ <function run at 0x000002AF36438CA0>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\fire\core.py", line 681, in _CallAndUpdateTrace
        component = fn(*varargs, **kwargs)
                    │   │          └ {}
                    │   └ ['C:\\A\\Summertime renderer v01']
                    └ <function run at 0x000002AF36438CA0>
    > File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\mokuro\run.py", line 42, in run
        ovg.process_dir(path, as_one_file=as_one_file)
        │   │           │                 └ True
        │   │           └ WindowsPath('C:/A/Summertime renderer v01')
        │   └ <function OverlayGenerator.process_dir at 0x000002AF36438790>
        └ <mokuro.overlay_generator.OverlayGenerator object at 0x000002AF364AE490>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\mokuro\overlay_generator.py", line 82, in process_dir
        self.init_models()
        │    └ <function OverlayGenerator.init_models at 0x000002AF36438700>
        └ <mokuro.overlay_generator.OverlayGenerator object at 0x000002AF364AE490>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\mokuro\overlay_generator.py", line 55, in init_models
        self.mpocr = MangaPageOcr(self.pretrained_model_name_or_path, self.force_cpu, **self.kwargs)
        │    │       │            │    │                              │    │            │    └ {}
        │    │       │            │    │                              │    │            └ <mokuro.overlay_generator.OverlayGenerator object at 0x000002AF364AE490>
        │    │       │            │    │                              │    └ False
        │    │       │            │    │                              └ <mokuro.overlay_generator.OverlayGenerator object at 0x000002AF364AE490>
        │    │       │            │    └ 'kha-white/manga-ocr-base'
        │    │       │            └ <mokuro.overlay_generator.OverlayGenerator object at 0x000002AF364AE490>
        │    │       └ <class 'mokuro.manga_page_ocr.MangaPageOcr'>
        │    └ None
        └ <mokuro.overlay_generator.OverlayGenerator object at 0x000002AF364AE490>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\mokuro\manga_page_ocr.py", line 34, in __init__
        self.mocr = MangaOcr(pretrained_model_name_or_path, force_cpu)
        │           │        │                              └ False
        │           │        └ 'kha-white/manga-ocr-base'
        │           └ <class 'manga_ocr.ocr.MangaOcr'>
        └ <mokuro.manga_page_ocr.MangaPageOcr object at 0x000002AF36512BE0>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\manga_ocr\ocr.py", line 15, in __init__
        self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path)
        │                │             │               └ 'kha-white/manga-ocr-base'
        │                │             └ <classmethod object at 0x000002AF36322BB0>
        │                └ <class 'transformers.models.auto.tokenization_auto.AutoTokenizer'>
        └ <manga_ocr.ocr.MangaOcr object at 0x000002AF36512BB0>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\transformers\models\auto\tokenization_auto.py", line 528, in from_pretrained
        return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
               │               │               │                               │         └ {'_from_auto': True}
               │               │               │                               └ ()
               │               │               └ 'kha-white/manga-ocr-base'
               │               └ <classmethod object at 0x000002AF362883D0>
               └ <class 'transformers.models.bert_japanese.tokenization_bert_japanese.BertJapaneseTokenizer'>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\transformers\tokenization_utils_base.py", line 1780, in from_pretrained
        return cls._from_pretrained(
               │   └ <classmethod object at 0x000002AF36288490>
               └ <class 'transformers.models.bert_japanese.tokenization_bert_japanese.BertJapaneseTokenizer'>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\transformers\tokenization_utils_base.py", line 1915, in _from_pretrained
        tokenizer = cls(*init_inputs, **init_kwargs)
                    │    │              └ {'unk_token': '[UNK]', 'sep_token': '[SEP]', 'pad_token': '[PAD]', 'cls_token': '[CLS]', 'mask_token': '[MASK]', 'do_lower_ca...
                    │    └ ()
                    └ <class 'transformers.models.bert_japanese.tokenization_bert_japanese.BertJapaneseTokenizer'>
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\transformers\models\bert_japanese\tokenization_bert_japanese.py", line 151, in __init__
        self.word_tokenizer = MecabTokenizer(
        │                     └ <class 'transformers.models.bert_japanese.tokenization_bert_japanese.MecabTokenizer'>
        └ PreTrainedTokenizer(name_or_path='kha-white/manga-ocr-base', vocab_size=6144, model_max_len=1000000000000000019884624838656, ...
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\transformers\models\bert_japanese\tokenization_bert_japanese.py", line 231, in __init__
        import fugashi
      File "C:\Users\Seven7\AppData\Roaming\Python\Python39\site-packages\fugashi\__init__.py", line 1, in <module>
        from .fugashi import *
    
    ImportError: DLL load failed while importing fugashi: The specified module could not be found.
    2022-05-05 13:18:19.552 | INFO     | mokuro.run:run:48 - Processed successfully: 0/1
    
    opened by YinnVI 2
  • onnx-simplifier onnxoptimizer dependency conflict

    onnx-simplifier onnxoptimizer dependency conflict

    During pip install:

      Downloading mokuro-0.1.1-py3-none-any.whl (114 kB)
         ---------------------------------------- 114.3/114.3 KB 3.4 MB/s eta 0:00:00
      Downloading mokuro-0.1.0-py3-none-any.whl (114 kB)
         ---------------------------------------- 114.3/114.3 KB 3.4 MB/s eta 0:00:00
    ERROR: Cannot install mokuro because these package versions have conflicting dependencies.
    
    The conflict is caused by:
        onnx-simplifier 0.3.8 depends on onnxoptimizer>=0.2.6
        onnx-simplifier 0.3.7 depends on onnxoptimizer>=0.2.5
        onnx-simplifier 0.3.6 depends on onnxoptimizer>=0.2.5
    
    To fix this you could try to:
    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip attempt to solve the dependency conflict
    
    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
    opened by ixMarcel 1
  • Processed successfully: 0/1

    Processed successfully: 0/1

    AssertionError: /Users/_/Downloads/Manga/ジョジョリオン 27.cbz must be a directory | INFO | mokuro.run:run:48 - Processed successfully: 0/1 Device: M1 Macbook Pro Monterey 12.1

    No HTML file is made if a file is directly path to

    opened by evka745 0
  • Sorts manga pages wrong way.

    Sorts manga pages wrong way.

    Have my manga sorted like this image all pages in order, no issues, yet chapter 2 is page 340 or 380 and chapter 3 is page 333(?)

    i have 480 pages overall, chapter 10 happens right after chapter 1 yet it doesnt in my folder.

    opened by iGrizion 0
  • Manga missing - Blank pages

    Manga missing - Blank pages

    Not sure what is happening now, but it was working before and now everything is just broken. The pages do not come up only the words but its more of trying to find them. Not sure what happened or why image

    opened by noxxid3 0
  • [REQUEST] Scanned light novels

    [REQUEST] Scanned light novels

    There are so many light novels you can easily find scanned on certain websites, but you can't really find them as ebooks that easily without having to buy them. Would it be possible? I know this was created thinking about manga, but it'd be cool if it worked for light novels too.

    010 I tried running mokuro on light novels too, but it doesn't seem catch text pages, only pages with ilustrations and some text within all pages. Also if someone mentioned it before I'll delete this request asap.

    opened by Astarka06 0
  • Yomichan unable to use pop ups

    Yomichan unable to use pop ups

    Using Yomichan im able to get pop ups on the html, its working every else but this. Not entirely sure why its not working on the html file. But also would be cool if you also shared the text format you're using for the OCR for that pop up.

    Edit: I was stupid and never enabled URL in the yomichan settings

    opened by noxxid3 1
  • Can't get mokuro to work with GPU.

    Can't get mokuro to work with GPU.

    Hi, i used the following command to install the requirements but mokuro still uses CPU only: pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

    Python location (version 3.9.12): \AppData\Local\Programs\Python\Python39\python.exe \AppData\Local\Microsoft\WindowsApps\python.exe

    Mokuro location: \AppData\Local\Programs\Python\Python39\Scripts\mokuro.exe

    OS: Windows 10

    opened by avc1657 0
  • Can't move processed manga to other computers

    Can't move processed manga to other computers

    I copied the ocr folder and the html file but when I tried to open it on another machine it didn't work. Is there a solution to make the process manga portable not including turning it into a pdf

    opened by KolbyML 1
Owner
Maciej Budyś
Maciej Budyś
Tracking the latest progress in Scene Text Detection and Recognition: Must-read papers well organized

SceneTextPapers Tracking the latest progress in Scene Text Detection and Recognition: must-read papers well organized Information about this repositor

Shangbang Long 757 Sep 12, 2022
computer vision, image processing and machine learning on the web browser or node.

Image processing and Machine learning labs   computer vision, image processing and machine learning on the web browser or node note Fast Fourier Trans

ryohei tanaka 485 Aug 18, 2022
Read-only mirror of https://gitlab.gnome.org/GNOME/ocrfeeder

================================= OCRFeeder - A Complete OCR Suite ================================= OCRFeeder is a complete Optical Character Recogn

GNOME Github Mirror 80 Aug 14, 2022
Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.

Deskew by Marek Mauder https://galfar.vevb.net/deskew https://github.com/galfar/deskew v1.30 2019-06-07 Overview Deskew is a command line tool for des

Marek Mauder 121 Sep 18, 2022
An Implementation of the alogrithm in paper IncepText: A New Inception-Text Module with Deformable PSROI Pooling for Multi-Oriented Scene Text Detection

InceptText-Tensorflow An Implementation of the alogrithm in paper IncepText: A New Inception-Text Module with Deformable PSROI Pooling for Multi-Orien

GeorgeJoe 116 Jan 31, 2022
Code for the paper STN-OCR: A single Neural Network for Text Detection and Text Recognition

STN-OCR: A single Neural Network for Text Detection and Text Recognition This repository contains the code for the paper: STN-OCR: A single Neural Net

Christian Bartz 494 Sep 20, 2022
text detection mainly based on ctpn model in tensorflow, id card detect, connectionist text proposal network

text-detection-ctpn Scene text detection based on ctpn (connectionist text proposal network). It is implemented in tensorflow. The origin paper can be

Shaohui Ruan 3.3k Sep 24, 2022
keras复现场景文本检测网络CPTN: 《Detecting Text in Natural Image with Connectionist Text Proposal Network》;欢迎试用,关注,并反馈问题...

keras-ctpn [TOC] 说明 预测 训练 例子 4.1 ICDAR2015 4.1.1 带侧边细化 4.1.2 不带带侧边细化 4.1.3 做数据增广-水平翻转 4.2 ICDAR2017 4.3 其它数据集 toDoList 总结 说明 本工程是keras实现的CPTN: Detecti

mick.yi 109 Aug 6, 2022
Detecting Text in Natural Image with Connectionist Text Proposal Network (ECCV'16)

Detecting Text in Natural Image with Connectionist Text Proposal Network The codes are used for implementing CTPN for scene text detection, described

Tian Zhi 1.3k Sep 23, 2022
huoyijie 1.2k Oct 1, 2022
OCR system for Arabic language that converts images of typed text to machine-encoded text.

Arabic OCR OCR system for Arabic language that converts images of typed text to machine-encoded text. The system currently supports only letters (29 l

Hussein Youssef 128 Sep 19, 2022
OCR, Scene-Text-Understanding, Text Recognition

Scene-Text-Understanding Survey [2015-PAMI] Text Detection and Recognition in Imagery: A Survey paper [2014-Front.Comput.Sci] Scene Text Detection and

Alan Tang 355 Sep 22, 2022
Total Text Dataset. It consists of 1555 images with more than 3 different text orientations: Horizontal, Multi-Oriented, and Curved, one of a kind.

Total-Text-Dataset (Official site) Updated on April 29, 2020 (Detection leaderboard is updated - highlighted E2E methods. Thank you shine-lcy.) Update

Chee Seng Chan 652 Sep 20, 2022
Code related to "Have Your Text and Use It Too! End-to-End Neural Data-to-Text Generation with Semantic Fidelity" paper

DataTuner You have just found the DataTuner. This repository provides tools for fine-tuning language models for a task. See LICENSE.txt for license de

null 77 Sep 15, 2022
Handwritten Text Recognition (HTR) system implemented with TensorFlow (TF) and trained on the IAM off-line HTR dataset. This Neural Network (NN) model recognizes the text contained in the images of segmented words.

Handwritten-Text-Recognition Handwritten Text Recognition (HTR) system implemented with TensorFlow (TF) and trained on the IAM off-line HTR dataset. T

null 24 Sep 27, 2022
Code for generating synthetic text images as described in "Synthetic Data for Text Localisation in Natural Images", Ankush Gupta, Andrea Vedaldi, Andrew Zisserman, CVPR 2016.

SynthText Code for generating synthetic text images as described in "Synthetic Data for Text Localisation in Natural Images", Ankush Gupta, Andrea Ved

Ankush Gupta 1.8k Sep 23, 2022
This can be use to convert text in a file to handwritten text.

TextToHandwriting This can be used to convert text to handwriting. Clone this project or download the code. Run TextToImage.py give the filename of th

Ashutosh Mahapatra 2 Feb 6, 2022