Git Product home page Git Product logo

vietnamese-ocr-toolbox's Introduction

An OCR Toolbox for Vietnamese Documents

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

dependabot[bot] avatar kaylode avatar nhtlongcs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vietnamese-ocr-toolbox's Issues

The scripts can be run but nothing in output

Hi team,
I tried to use your codes to identify and extract a test identification card, I can run the script from my Windows CMD, no issue happen. But at the end, there is no output in my output folder:
image

Here is my folder extracted from your github codes:
image

Thank you

How to use only the detection and ocr part of toolbox ?

Hello, Im very appreciate your work and attempt to do something using it. However, I found that my work only requires parts of your pipeline, not all the steps.
So are there any methods or function that help me with this problem ?
Thank you very much đồng hương :D

File pth và file config không khớp nhau

Sau khi chạy thử model thì em thấy file pth trong link drive của tác giả đã đổi và cấu trúc hiện tại khác với cấu trúc trong file config. Nên em có thể xin file pth trong drive của team mình với tên PANNet_last.pth không ạ?

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.