GithubHelp home page GithubHelp logo

cyborgx0x / vietnamese-ocr-toolbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kaylode/vietnamese-ocr-toolbox

0.0 0.0 0.0 23.65 MB

A toolbox for Vietnamese Optical Character Recognition.

License: Apache License 2.0

C++ 55.78% Python 44.17% C 0.01% Makefile 0.03%

vietnamese-ocr-toolbox's Introduction

An OCR Toolbox for Vietnamese Documents

TO RUN in Codespace:

curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
sudo apt-get update && sudo apt-get install ffmpeg libsm6 libxext6  -y

CodeFactor

This toolbox provides a pipeline to do OCR in Vietnamese documents (such as receipts, personal id, licenses,...). The project also support flexibility for adaptation.

๐Ÿ“‘ More infomation:

  • Report: link
  • Youtube: Youtube

Invoice (from SROIE19 dataset)

Alt text

Personal ID (image from internet)

Alt text

Pipeline in detail:

  1. Use Canny Edge Detector and then detect contours.
  2. Extract receipt from image and normalize.
  3. Use Pixel Agreation Network (PAN) to detect text regions from extracted receipt, then crop these regions.
  4. Use VietOCR to extract texts from regions, then perform word correction.
  5. Retrieve information

Notebooks

  • Notebook for training PAN: Notebook

  • Notebook for training Transformer OCR: Notebook

  • Notebook for training PhoBERT: Notebook

  • Notebook for inference: Notebook

Pipeline

Main Pipeline

Alt Text

Process Flow Block

Alt Text

There are two stages (can also run in second stage only):

  • The first stage is to detect and rectify document in the image, then forward through the "process flow" to find the best orientation of the document.
  • The second stage is to forward the rotated image through the entire "process flow" normally to retrieve information

Datasets

screen screen screen
screen screen screen

Pretrained weights

  • Pretrained PAN weights on SROIE19:
Model Image Size Weights [email protected] Pixel accuracy IOU
PAN (baseline) 640 x 640 link 0.71 0.95 0.91
PAN (rotation) 640 x 640 link 0.66 0.93 0.88
  • Pretrained OCR weights on MCOCR2021:
Model Weights Accuracy (full seq) Accuracy (per char)
Transformer OCR link 0.890 0.981
  • Pretrained PhoBERT weights on MCOCR2021:
Model Weights Accuracy (train) Accuracy (val)
PhoBERT link 0.978 0.924

Inference

  • Install dependencies pip install -r requirements.txt

  • Full pipeline:

python run.py --input=<input image> --output=<output folder>
  • Extra Parameters:
    • --debug: whether to save output of each step
    • --find_best_rotation: whether to find best rotation first
    • --do_retrieve: whether to retrieve information (based on class defined in config) or ocr only

References

vietnamese-ocr-toolbox's People

Contributors

kaylode avatar nhtlongcs avatar dependabot[bot] avatar cyborgx0x avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.