This repository is for handwritten digit recognition which is integrated to Saral project. Saral is an OCR-plus application that is capable of doing OCR and can also understand the structure of the physical input.
- empty or noisy type images are included in class10
- Channel-wise normalization of input images: substracted by mean and divided by std
- Data augmentation: rotation, width shift, height shift, shearing, zooming
$ pip install -r requirement.txt
The training can be executed by the following command. In config file we can have to update training data path and model specific parameters. Once the training is done trained model will be saved in the given path.
$ python training.py
This can be done using keras_to_tf_converter.py module. As a input it takes path of keras model and save path where we want to save the tflite model. Define them in ./config.py.
$ python keras_to_tf_converter.py
- Place the .tflite model file in below project path.
- Use it in
org.ekstep.saral.saralsdk.hwmodel.HWClassifier.java
file/Project-Saral/v1.0/frontend/SaralApp/android/saralsdk/src/main/assets
prediction.ipynb for benchmarking the test dataset for both keras and tflite model at digit and roll number level
optional arguments:
--epochs EPOCHS How many epochs you need to run (default: 10)
--batch_size BATCH_SIZE
The number of images in a batch (default: 64)
--path_for_weights PATH_FOR_WEIGHTS
The path from where the weights will be saved or
loaded (default: ./models/VGG16.h5)
--path_for_image PATH_FOR_IMAGE
The path from where the model image will be saved
(default: ./images/VGG16.png)
--path_for_plot PATH_FOR_PLOT
The path from where the training progress will be
plotted (default: ./images/VGG16_plot.png)
--data_augmentation DATA_AUGMENTATION
0: No, 1: Yes (default: 1)
--save_model_and_weights SAVE_MODEL_AND_WEIGHTS
0: No, 1: Yes (default: 1)
--load_weights LOAD_WEIGHTS
0: No, 1: Yes (default: 0)
--plot_training_progress PLOT_TRAINING_PROGRESS
0: No, 1: Yes (default: 1)
--save_model_to_image SAVE_MODEL_TO_IMAGE
0: No, 1: Yes (default: 1)
├── images/ # training data: few samples are given for each digit
├── models/ # model weights (included in this repo)
├── README.md
├── base_model.py # base model interface
├── utils.py # helper functions
├── resnet164.py
├── training.py # training script