ndl-lab / text_recognition_lightning

NDLOCR(version2)用テキスト認識モジュール

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

text_recognition_lightning (NDLOCR(ver.2)用テキスト認識モジュール)

PyTorch Lightning Config: Hydra Template
Paper Conference

Description

NDLOCR(ver.2)用の画像中のテキストを認識するモジュールのリポジトリです。

本プログラムは、全文検索用途のテキスト化のために開発したver.1に対して、視覚障害者等の読み上げ用途にも利用できるよう、国立国会図書館が外部委託して追加開発したプログラムです(委託業者:株式会社モルフォAIソリューションズ)。

事業の詳細については、令和4年度NDLOCR追加開発事業及び同事業成果に対する改善作業をご覧ください。

本プログラムは、国立国会図書館がCC BY 4.0ライセンスで公開するものです。詳細については LICENSEをご覧ください。

How to run

Install dependencies

# clone project
git clone https://github.com/ndl-lab/text_recognition_lightning
cd text_recognition_lightning

# [OPTIONAL] create conda environment
conda create -n myenv python=3.8.10
conda activate myenv

# install pytorch according to instructions
# https://pytorch.org/get-started/

# install requirements
pip install -r requirements.txt

Train model with default configuration

# train on CPU
python src/train.py trainer=cpu

# train on GPU
python src/train.py trainer=gpu

You can override any parameter from command line like this

python src/train.py trainer.max_epochs=20 datamodule.batch_size=64
# eval
python src/eval.py ckpt_path=logs/your/model/ckpt/path datamodule.dataset.pred=[/your/xml/data/directory1,/your/xml/data/directory2]

# xml
python src/eval.py task=xml ckpt_path=logs/your/model/ckpt/path datamodule.dataset.pred=[/your/xml/data/directory1,/your/xml/data/directory2]

# render(visualize)
python src/eval.py task=render ckpt_path=logs/your/model/ckpt/path datamodule.dataset.pred=[/your/xml/data/directory1,/your/xml/data/directory2]

About

NDLOCR(version2)用テキスト認識モジュール

License:Other


Languages

Language:Python 98.9%Language:Makefile 0.9%Language:Shell 0.2%