Convolutional Neural Network from scratch [](http://cnndigits.pythonanywhere.com/)
February 24, 2018 ยท View on GitHub
Live Demo
Objective of this work was to write the Convolutional Neural Network without using any Deep Learning Library to gain insights of what is actually happening and thus the algorithm is not optimised enough and hence is slow on large dataset like CIFAR-10.
This piece of code could be used for learning purpose and could be implemented with trained parameter available in the respective folders for any testing applications like Object Detection and Digit recognition.
It's Accuracy on MNIST test set is above 97%.

Architecture
INPUT - CONV1 - RELU - CONV2 - RELU- MAXPOOL - FC1 - OUT


Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
- Numpy - Multidimensioanl Mathematical Computing
- Matplotlib - Used to plot Graph
- Pickle - Used to save trained models/object
- MNIST Dataset - Dataset for Digit Recognition
- CIFAR-10 Dataset - Dataset for Object Recognition
Followings are also required if working/testing on the app.py
Directories
Installing
- Clone the repository
git clone https://github.com/zishansami102/CNN-from-Scratch
- Downlad the dataset and copy that to it's corresponding folder(CIFAR-10/MNIST).
- Move into the required directory and then run the following command to start training model
python run.py
Output:

- To load pre-trained models, change the pickle filename from output.pickle to trained.pickle in run.py:
line No. - 27-28and comment out the training part form the code in run.py:line No. - 80-104
Contributing
KWoC Action Plan
Short term Issues
See the issue section of this repositiory
Long term project
Plan is to make a Web App which can predict the digit between 0 to 9 if the user writes anything on the app drawing board(using the functions written in convnet.py). Following are the steps in which we may proceed:
- A python based Flask API which recieves image as input and gives digit prediction for that image as output
- Front-end of the Web App which should have a drawing board on which the user will draw
- Integration of the API with the front-end
Respond on the google group from the list above to know details and start the contribution
Acknowledgments
- CS231n.stanford.edu - Most of the theorotical concepts are taken from here
- dorajam - Used to gain more concepts
- Mathematical Concepts - Still need to be implemented, but helpful to gain insight