Git Product home page Git Product logo

chargrid's Introduction

Chargrid model : Extraction of meaningful instances from document images

Author: Antoine DELPLACE
Last update: 26/03/2020

This repository corresponds to my implementation of "Chargrid: Towards Understanding 2D Documents" by A. R. Katti et al. The data used to test the model comes from the ICDAR 2019 Robust Reading Challenge on Scanned Receipts OCR and Information Extraction.

Data description

The ICDAR 2019 dataset is composed of 690 images of receipts along with, for each invoice, a json file containing 4 classes (the company name, the date, the store address and the total amount) and the true bounding boxes of strings in the bill.

Because the inputs have purposely "poor paper quality, poor ink and printing quality; low resolution scanner and scanning distortion", only 682 images were kept after the Optical Character Recognition (OCR).

The images are of different shapes and resolutions.

The number of classes successfully extracted from the bounding boxes with the json file are presented in the following table :

Number of detected classes 0 1 2 3 4
Number of input images 8 7 3 34 630

Method description

  • The first step is to preprocess the dataset in order to have homogeneous and trainable inputs (chargrid) and ground truths.
  • Once chargrids are ready, they are used to train the model composed of :
    • a VGG encoder
    • a Semantic Segmentation Decoder with skip connections
    • a Bounding Box Regression Decoder with skip connections

Usage

Dependencies

  • Python 3.6.8
  • Numpy 1.16.2
  • Pandas 0.24.2
  • Matplotlib 3.1.1
  • Scikit-learn 0.20.3 -- preprocessing.py
  • Pytesseract 0.3.3 -- preprocessing.py
  • Tensorflow 2.0.0 -- network.py
  • Scikit-image 0.15.0 -- preprocessing_ter.py and network.py

File description

  1. preprocessing.py is the first preprocessing program designed to:

    • generate Chargrids from input images thanks to Tesseract
    • extract bounding boxes for each class from the ground truth files
    • generate class segmentation from the class bounding boxes
    • reduce the size of images by removing empty rows and empty columns
  2. preprocessing_bis.py is the second preprocessing program that reduces the size of each image as much as possible without losing too much information.

  3. preprocessing_ter.py is the third and final preprocessing program designed to:

    • resize all images to the same shape
    • convert all inputs and ground truth files to one-hot encoding
  4. network.py is the main program to train and test the chargrid model.

Results

[TODO]

Possible improvements

  • Remove one-hot encoding and use categorical cross-entropy (more memory-efficient)
  • Implement focal cross-entropy loss

References

  1. A. R. Katti et al. "Chargrid: Towards Understanding 2D Documents", EMNLP 2018, September 2018. arXiv:1809.08799
  2. Z. Huang et al. ICDAR 2019 Robust Reading Challenge on Scanned Receipts OCR and Information Extraction, ICDAR, 2019, 2019. link

chargrid's People

Contributors

antoinedelplace 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.