GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - txsing/microcr: A repository utilizing TensorFlow and TensorFlow Lite to train an OCR model for MICR recognition in cheques.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
dataset
dataset
 
 
tmp
tmp
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
dataset-preview.png
dataset-preview.png
 
 
filestack-logo.svg
filestack-logo.svg
 
 
m1.jpg
m1.jpg
 
 
main.ipynb
main.ipynb
 
 
make_dataset.py
make_dataset.py
 
 
micr-encoding.regular.ttf
micr-encoding.regular.ttf
 
 
model_v2.tflite
model_v2.tflite
 
 
models.py
models.py
 
 
requirements.txt
requirements.txt
 
 
tf_model_inference.py
tf_model_inference.py
 
 
tf_model_train.py
tf_model_train.py
 
 
training-metrics.png
training-metrics.png
 
 

Repository files navigation

MICRST Competition

This is the repository accompanying the article: From MNIST classification to Intelligent Check Processing

Quickstart

Use the introductory notebook

Step by step:

  1. Prepare the dataset config:

    There is a basic example in ..blob/master/dataset/generator.py#L12
    You can change images dimensions and probabilities of randomly applied image transformations, e.g. setting:
    'blur_probability': 0.5
    will generate a dataset where 50% of samples have blurring applied.

    To preview the dataset use the

    dataset.generator.make_preview(config)
    

  2. Generate the full dataset:

    Declare total number of sumples and execute the function:

    number_of_samples = 60_000
    dataset.generator.make_dataset(
        config=dataset_config,
        number_of_samples=number_of_samples
    )

    This can take anything from 20 - 90 minutes, depending on the machine you're using and number of samples you choose and will create a new directory in the ./tmp folder of this repository (can change in the config) containing all all of the images and one labels.csv file with information about the ground truth character for each image.

  3. Load dataset with PyTorch loaders:

    Using the same config object you can make training and validation data loaders:

    train_loader, test_loader = dataset.dataset.make_dataset_loaders(
        config=dataset_config,
        batch_size=batch_size
    )
  4. Train models!

    We are including a neural network model with 3 convolutional layers, 2 fully connected and batch normalization. Is pseudo-python the training procedure boils down to:

    model = models.DeepMicrClassifier()
    for batch in train_loader:
        # Load the data
        image_data = batch['image']
        target_labels = batch['label']
    
        # Feed it to the model
        output = model(image_data)
    
        # Calculate error
        loss = your_loss_function(output, target_labels)
    
        # Back propagation
        loss.backward()
        
        # Gradient descent
        optimizer.step()

    Running the notebook as is should give you 90% accuracy on the validation set.

  5. Experiment!

    This is clearly a toy example - we encourage you try and beat our baseline. Ideas for improvements:

    • make the model deeper
    • add data augmentation
    • remove convolutional layers
    • remove fully connected layers
    • train multiple models and try the ensemble approach

Dataset structure

The tree arrangement of the data directory:

└── MICRST
    ├── image
    │   ├── MICRST_1000000.png
    │   ├── MICRST_1000001.png
    │   ├── .
    │   ├── ..
    │   ├── ...
    └── labels.csv

And the structure of labels.csv:

label,path
7,./tmp/MICRST/image/MICRST_1000000.png
D,./tmp/MICRST/image/MICRST_1000001.png
.
..
...

Where the label column is the MICR character in string format.

About

A repository utilizing TensorFlow and TensorFlow Lite to train an OCR model for MICR recognition in cheques.

Topics

chequemicrocrtensorflow-lite

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.