Machine Learning to Denoise Images for Better OCR Accuracy

This project is an adaptation of this tutorial and used only for learning purposes:

Setting Up the project 🚀

First and foremost clone the project with:

$ git clone

You don’t need to extract the zip files in order to train the model.

Once you have cloned the repository you will need to extract the features from the noisy images. This script will extract 5 x 5 – 25-d feature vectors and the it will extract the target (or cleaned) pixel value from the correspondiente ground truth standard image. And then, this features will be saved in a csv file (~200MB). To extract this features you will have to execute:

$ python3

It will generate the following output:

alt text

Once you have done that we will have to load those features in a proper split to train our Random Forest Regressor. That code is implemented in the file To train the model you will have to run the command:

$ python

And it will generate:

alt text

To check that the model performs good you can execute:

$ python3 --testing denoising-dirty-documents/test

And some images will be written in disk so you can check the original image and the image obtained by the model we just have trained.

Any doubts or suggestions please open an issue.


View Github