GithubHelp home page GithubHelp logo

invoice-reader's Introduction

invoice-reader

An app to read and store invoices using Machine Learning and AWS

Installation notes

LayoutLM requires tesseract and pytesseract.

It seemed there was an issue with conda and libtiff.so.5. What worked:

conda install -c conda-forge tesseract 
pip install pytesseract

Basic installation from HF article:

sudo apt install -y tesseract-ocr
pip install pytesseract transformers datasets seqeval tensorboard

Label studio

Type of data to import

Label studio import data OCR

[{
  "data": {
    "image": "/static/samples/sample.jpg" 
  },

  "predictions": [{
    "model_version": "one",
    "score": 0.5,
    "result": [
      {
        "id": "result1",
        "type": "rectanglelabels",        
        "from_name": "label", "to_name": "image",
        "original_width": 600, "original_height": 403,
        "image_rotation": 0,
        "value": {
          "rotation": 0,          
          "x": 4.98, "y": 12.82,
          "width": 32.52, "height": 44.91,
          "rectanglelabels": ["Airplane"]
        }
      },
      {
        "id": "result2",
        "type": "rectanglelabels",        
        "from_name": "label", "to_name": "image",
        "original_width": 600, "original_height": 403,
        "image_rotation": 0,
        "value": {
          "rotation": 0,          
          "x": 75.47, "y": 82.33,
          "width": 5.74, "height": 7.40,
          "rectanglelabels": ["Car"]
        }
      },
      {
        "id": "result3",
        "type": "choices",
        "from_name": "choice", "to_name": "image",
        "value": {
          "choices": ["Airbus"]
      }
    }]
  }]
}]

COnvert pdf into image

apt-get install poppler-utils
pip install pdf2image

Good AWS Sagemaker / MLOps resources

If I had to start over

  • Objectives
  • Data
  • Models design
  • Prepare Benchmark (should not be relative to training data)
  • Evaluate existing solutions
  • ML
    • Prepare sample of data for first model
    • Preprocess
    • Cloud:
      • Explore model training using Cloud
      • Inference
    • Prepare Estimator + Inference + Preprocess + W&B (or similar)
    • Sagemaker Training jobs
    • Model registry
    • Deployment

Deployment

  • If inference.py is added as an entry_point, it will repack the S3 artifact which takes a lot of time
  • Maybe it's better to have the script ready during the training stage.
  • Error message:
sagemaker.exceptions.UnexpectedStatusException: Error hosting endpoint huggingface-pytorch-inference-2024-03-07-10-01-23-289: Failed. Reason: Failed to extract model data archive from URL "s3://sagemaker-eu-central-1-265890761777/huggingface-pytorch-inference-2024-03-07-09-41-59-363/model.tar.gz". The model data archive is too large. Please reduce the size of the model data archive or move to an instance type with more memory.. Try changing the instance type or reference the troubleshooting page https://docs.aws.amazon.com/sagemaker/latest/dg/async-inference-troubleshooting.html
  • It looks like the decompress -> add file -> compress is done on my computer, that's why it's so slow (25min / 2.5GB)
  • Possibility to repack model using Lambda or Lambda step?

AWS Deep Learning Containers

https://github.com/aws/deep-learning-containers/blob/master/available_images.md

invoice-reader's People

Contributors

jeremyarancio avatar

Stargazers

 avatar Richard Reed avatar Philip Patterson avatar Cpop avatar  avatar

Watchers

 avatar

Forkers

pi6eon

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.