KaiKenju/TransLayoutDocs

Translate documents, recreate layouts, convert PDF to Word, PaddleOCR, Image to Word., Table to Word

Python

6

28 commits

updated Dec 6, 2024

See the code

README

TransLayoutDocs

Translate documents, recreate layouts, convert PDF to Word, PaddleOCR, Image to Word.

ocr_vietnamese

TransLayoutDocs

🌎 English / Vietnamese / 日本


Related Projects:

  • Recognition-table-with-table-transformer: A system combining Table Transformer and vietOCR for accurate table structure and Vietnamese character recognition from images.

  • Vietnamese_OCR_documents: Converts text from images or PDF scans into digital format, streamlining Vietnamese text processing and information management.



Table of Contents

Technical Overview

  • Python > 3.6
  • Recovery Layout: PPStructure (PaddleOCR)
  • OCR: PaddleOCR
  • Translation :
    • mbart-large-50-many-to-many-mmt(jp)
    • envit5-translation(vi)
  • Spell Corection
    • oliverguhr/spelling-correction-english-base(en)
    • bmd1905/vietnamese-correction(vi)

Introduction

This diagram introduces the Layout Translation Extraction process we developed based on PaddleOCR, from image correction to information reconstruction. You can read the docs here to see differences

Visualization

  • Image: RecoveryLayout
  • Image: RecoveryLayout + Translate
  • PDF standard: RecoveryLayout

Installization

  • Clone this project:
git clone https://github.com/KaiKenju/TransLayoutDocs.git
  • Initial enviromment with Miniconda (Default: python=3.10):
conda create -n <env_name> python=3.10
  • Activate conda
conda activate <env_name> 
cd TransLayoutDocs
  • Run the commands:
pip install -r requirements.txt

Quick Start

  • Scan PDF (using OCR)
python main.py
  • Standard PDF
python predict_pdf.py --image_dir=inputs\pdf\2009.09941v3.pdf --recovery=True --use_pdf2docx_api=True --output=./outputs/
  • Image to Word
python img2docx.py --input=./inputs/imgs/check2.png --output=./detail_img --lang=vi --device=cpu
Usage: python img2docx.py --input=./inputs/imgs/chap4.png --output=./detail_img --lang=vi --device=cpu

  --input              Input img . Default: inputs
  --output             Output folder. Default: detail_img
  --lang               Languague to translate. Default: vi
  --device             Cpu or cuda. Default: cpu
  • Note: Following the step if you translate in KR,JP,CH to see in terminal : here

Contributer

Special thanks to all the developers who have contributed to TransLayoutDocs!

KaiKenju/TransLayoutDocs

Translate documents, recreate layouts, convert PDF to Word, PaddleOCR, Image to Word., Table to Word

Python

6

28 commits

updated Dec 6, 2024

See the code

README

TransLayoutDocs

Translate documents, recreate layouts, convert PDF to Word, PaddleOCR, Image to Word.

ocr_vietnamese

TransLayoutDocs

🌎 English / Vietnamese / 日本


Related Projects:

  • Recognition-table-with-table-transformer: A system combining Table Transformer and vietOCR for accurate table structure and Vietnamese character recognition from images.

  • Vietnamese_OCR_documents: Converts text from images or PDF scans into digital format, streamlining Vietnamese text processing and information management.



Table of Contents

Technical Overview

  • Python > 3.6
  • Recovery Layout: PPStructure (PaddleOCR)
  • OCR: PaddleOCR
  • Translation :
    • mbart-large-50-many-to-many-mmt(jp)
    • envit5-translation(vi)
  • Spell Corection
    • oliverguhr/spelling-correction-english-base(en)
    • bmd1905/vietnamese-correction(vi)

Introduction

This diagram introduces the Layout Translation Extraction process we developed based on PaddleOCR, from image correction to information reconstruction. You can read the docs here to see differences

Visualization

  • Image: RecoveryLayout
  • Image: RecoveryLayout + Translate
  • PDF standard: RecoveryLayout

Installization

  • Clone this project:
git clone https://github.com/KaiKenju/TransLayoutDocs.git
  • Initial enviromment with Miniconda (Default: python=3.10):
conda create -n <env_name> python=3.10
  • Activate conda
conda activate <env_name> 
cd TransLayoutDocs
  • Run the commands:
pip install -r requirements.txt

Quick Start

  • Scan PDF (using OCR)
python main.py
  • Standard PDF
python predict_pdf.py --image_dir=inputs\pdf\2009.09941v3.pdf --recovery=True --use_pdf2docx_api=True --output=./outputs/
  • Image to Word
python img2docx.py --input=./inputs/imgs/check2.png --output=./detail_img --lang=vi --device=cpu
Usage: python img2docx.py --input=./inputs/imgs/chap4.png --output=./detail_img --lang=vi --device=cpu

  --input              Input img . Default: inputs
  --output             Output folder. Default: detail_img
  --lang               Languague to translate. Default: vi
  --device             Cpu or cuda. Default: cpu
  • Note: Following the step if you translate in KR,JP,CH to see in terminal : here

Contributer

Special thanks to all the developers who have contributed to TransLayoutDocs!