Git Product home page Git Product logo

attentionocr's Introduction

Attention OCR

A clear and maintainable implementation of Attention OCR in Tensorflow 2.0.

This sequence to sequence OCR model aims to provide a clear and maintainable implementation of attention based OCR.

Please note that this is currently a work in progress. Documentation is missing, but will be added when the code is stable.

This repository depends upon the following:

  • Tensorflow 2.0
  • Python 3.6+

Training a model

To train a model, first download the sources for generating synthetic data:

cd synthetic
./download_data_sources.sh

Next, in this project's root folder, run the training script:

python3 run.py

This will run a test training run. If everything went well, you'll find a file named "trained.h5" in your directory. To train a real model you should change the training parameters. See run.py its arguments to find out what is configurable.

python3 run.py --help

References

This work is based on the following work:

To do

  • Make image height variable
  • Name all input and output tensors
  • Write unit tests with full coverage
  • Show a test case on google colab
  • Perform a grid search on best parameters for a toy dataset
  • Document the whole API

Codacy Badge

attentionocr's People

Contributors

alleveenstra avatar dependabot[bot] 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

attentionocr's Issues

No improvement in ACC

Hi, thank you for open-sourcing this implementation. I have trained the model and everything was smooth and OK. But the problem is that there seems to be no improvement in TEST ACC. Could you please instruct me how I can solve this issue? Please note that I have not done any customization on your code and the implementation is exactly yours.

Getting error saying their signature doesnot match in lstm

Epoch 000 / 001 : : 1it [00:02, 2.66s/it, training loss=4.0050, iterations=1]
2021-01-25 17:52:40.330843: W tensorflow/core/grappler/optimizers/implementation_selector.cc:310] Skipping optimization due to error while loading function librarie
s: Invalid argument: Functions '__inference_standard_lstm_6471' and '_inference_standard_lstm_6471_specialized_for_lstm_1_5_StatefulPartitionedCall_at___inference
keras_scratch_graph_71971' both implement 'lstm_287408bc-d5fd-45ea-a08f-389dac98439a' but their signatures do not match.
2021-01-25 17:52:55.098128: W tensorflow/core/grappler/optimizers/implementation_selector.cc:310] Skipping optimization due to error while loading function librarie
s: Invalid argument: Functions '__inference_standard_lstm_43101' and '__inference_standard_lstm_43101_specialized_for_lstm_1_64_StatefulPartitionedCall_at___inferen
ce_keras_scratch_graph_77144' both implement 'lstm_cfe8d53e-9ee3-42c4-9653-ac8c91a62f7f' but their signatures do not match.

This is the error, I am getting. Any help is highly appreciated

curious about reason to use tf.eye

Hi, I ran in to u r code and it gives me a lot help. Thank you.
By the way, I just wonder why u use tf.eye for attention layer.
For many cases, attention layer is implemented by each attention cell and for loop.
tf.eye is okay for implement attention layer at once, but im still curious about why u use it.

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.