Coder Social home page Coder Social logo

numpy-cnn's Introduction

Numpy-CNN

A numpy-only implementation of a Convolutional Neural Network, from the ground up.

Written by Alejandro Escontrela

Purpose

To gain a quality understanding of convolutional neural networks and what makes them peform so well, I constructed one from scratch with NumPy. This CNN is in no way intended to replace popular DL frameworks such as Tensorflow or Torch, it is instead meant to serve as an instructional tool by anyone who wishes to understand the underlying mechinery of a CNN.

Training the network

To train the network on your machine, first install all necessary dependencies using:

pip install -r requirements.txt

Afterwards, you can train the network using the following command:

python3 train_cnn.py '<file_name>.pkl'

Replace <file_name> with whatever file name you would like. The terminal should display the following progress bar to indicate the training progress, as well as the cost for the current training batch.

After the CNN has finished training, a .pkl file containing the network's parameters is saved to the directory where the script was run.

The network takes about 5 hours to train on my macbook pro. I included the trained params in the GitHub repo under the name params.pkl . To use the pretrained params when measuring the network's performance, replace <file_name> with params.pkl.

Measuring Performance

To measure the network's accuracy, run the following command in the terminal:

python3 measure_performance.py '<file_name>.pkl'

This command will use the trained parameters to run predictions on all 10,000 digits in the test dataset. After all predictions are made, a value displaying the network's accuracy will appear in the command prompt

numpy-cnn's People

Contributors

alescontrela avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

afghani-iitkgp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.