MNIST web app

Github pages deployment of a simple machine learning model that uses MNIST database for digit recognition using TensorFlow.js.

For more information, visit the GitHub repository In order to see and test the live demo click here

Introduction

Github pages deployment of a simple machine learning model that uses the MNIST database for digit recognition using TensorFlow.js.

image

Figure 1. Model summary table.

Key Challenges

Generally, having to train the model and making the data preprocessing is not difficult per se. Dealing with the user input images was the biggest deal as, for example, investigating how to transform the raw data into the desired arrays used for input into the prediction function.

Input images are obtained as a 112x112 array but need to be transformed into a 28x28 array.

input

Figure 2. Input images.

Several things can be used for this like only saving 1 out of 4 pixels but I found out that key pixels were lost in the process. So I desided to use an average-like approach that works considerably better. Surely there are better methods that can be used but the latter was considered satisfactory.