AI MNIST PipelineGITHUB

Write a number 0-9 on the blackboard below!


Blackboard


Reset Predict

AI Predicted Number


This project is a demonstration of an end-to-end machine learning pipeline application that involves data acquisition, exploratory data analysis, data preprocessing, model training, and model deployment. The focus of this project was not so much the AI itself but more so the process to deploy a working AI system into production, with an interactive frontend. The AI being used is a Convolutional Neural Network.

This project uses Python with TensorFlow, Keras, Scikit-Learn, NumPy, and Pandas ML libraries for the pipeline process. For model deployment, the application is setup as a Docker image, stored in AWS ECR and deployed as an image on AWS Lambda accessible through the AWS Gateway as a REST API. The frontend process involves capturing the number written on the blackboard as a base64 encoded image where it is sent to the AWS Lambda function. From there, the image is converted into a NumPy 28x28 pixel area, is preprocessed, then passed into the model for prediction.

This function uses the basic MNIST training and testing datasets, achieving a validation accuracy of ~99% and a categorical cross entropy loss of ~0.03 as seen from the plots below. From both plots, there are almost no signs of overfitting.

MNIST Accuracy
MNIST Loss

To reiterate, the objective of this project was not the machine learning models themselves but with a focus on the process as a whole. However, some time was spent tuning the hyperparameters for the Convolutional Neural Network that is being used to perform the predictions. The neural network is composed of a convolutional and max pooling layers followed by two fully connected dense layers with dropout and batch normalization to help reduce overfitting of the model. Finally, the last layer is a 10 neuron dense layer using the oftmax activation function. The neural network was fitted using the Adam optimizer with Exponential Learning Rate Decay.

MNIST Model