Giter Club home page Giter Club logo

doc_ocr_by_template's Introduction

Document OCR by template

This is an OCR program designed for travel document. It can now support 23 types of documents with pre-defined template. You can add whatever you like.

  1. Passport
  2. China ID card
  3. HK ID card (new format)
  4. HK ID card (old format)
  5. Macau ID card (new format)
  6. Macau ID card (old format)
  7. Macau ID card - backside with MRZ
  8. China to HK/Macau Entry Permit card
  9. China to HK/Macau Entry Permit (Old)
  10. China to Taiwan Entry Permit card
  11. HK/Macau to China Entry Permit card
  12. HK/Macau to China Entry Permit card (Old)
  13. Taiwan to China Entry Permit card
  14. Taiwan to China Entry Permit (Old)
  15. Australia Driver Licence - New South Wales
  16. Australia Driver Licence - Victoria
  17. Australia Driver Licence - Capital Territory
  18. Australia Driver Licence - Queensland
  19. Australia Driver Licence - Western
  20. Australia Driver Licence - Northern Territory
  21. Australia Driver Licence - Tasmania
  22. Australia Driver Licence - South Australia
  23. New Zealand Driver Licence

Environment

  • CentOS / Windows
  • python 3.7+

Installation

git clone --recursive https://github.com/wisebobo/doc_ocr_by_template
cd doc_ocr_by_template
pip3 install -r requirements.txt

How to use?

Go to project folder, edit the settings.py to update those APP_ID/APP_KEY to your own one.

Then execute

./startServer.sh

or

python3 startServer.py

Image text

Design Concept

  1. Running tornado for exposing API service
  2. After receiving base64 image, pass to a pre-trained ResNet50 model for image classification to retrieve the document type.
  3. After getting the document type, create multiple threads to call Tencent/Baidu/Face++/Netease/JD OCR API to retrieve the 1st round of OCR result
  4. Base on the 1st round of OCR result, to match against the pre-defined template. Template is created by using the [project folder]/templates/template_generator.html. If template match, crop the recognition area to a new image (idea is to remove those unnecessary information to get a more accurate OCR result), then pass to Tencent/Baidu/Face++/Netease/JD OCR API again.
  5. Match the 2nd OCR result against the template fields
  6. According to corresponding document type to apply respective data cleasing logic
  7. Calculate the score

Reference

  1. MRZ https://github.com/konstantint/PassportEye

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.