Skip to content

bocianowski1/digit-predictor

Repository files navigation

Predicting handwritten digits with ONNX.js, PyTorch and React

Using a convolutional neural network trained on the MNSIT dataset to predict handwritten digits in React. The PyTorch model is trained locally and then converted to an ONNX model, allowing usage in the browser. Since the input from the MNIST dataset are $28\times28$ pixel images, the canvas has a shape of $280\times280$ making it easier to use the canvas as input.

Network Arcitecture Inspired By:

Screenshot 2022-11-16 at 09 56 06

To learn feature patterns two convolutional layers with a relu activation between them are being used.

After the second convolutional layer, max pooling is being performed. Max pooling extracts the highest value from the feature map.

Screenshot 2022-11-16 at 10 10 06


This is followed by the first dropout layer, dropping $25%$ of the neurons. This is done to prevent overfitting and to speed up the learning process.

As a part of the classification the input is flattened before entering a fully connected layer, another relu activation, a $50%$ dropout layer and the last fully connected layer.

Finally the softmax activation function is applied, giving predictions for each label, i.e. digit.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors