Neural network based techniques to recognize digits from handwritten images in the MNIST dataset. There are two main implementations in this code.
network2.py
has the code for a Neural network we create using just thenumpy
library.mnist-pytorch.ipynb
does the same task using pytorch
Create a python environment:
$ python3 -m venv env
Activate the environment
$ source env/bin/activate
Install the requirements
$ pip install -r requirements.txt
- To train the model, and save it
$ python runner.py train
The model will be saved as mnist_model.py
- To check the model output
$ python runner.py test
This will load the saved model.
It will print the predicted number.
The image for which the prediction was run will be saved in the
project directory as infer.png
.