GithubHelp home page GithubHelp logo

tensorflow-mnist's Introduction

MNIST with TensorFlow

  • Just for training TensorFlow and Deep Learning
  • Try to make easy to understand building layers and using TensorFlow
    • write summaries for TensorBoard
    • save and load a model and reuse for prediction
  • Pre-trained model with default options is included
    • you can test prediction and TensorBoard without any hassle

Class

  • MNIST : building model (currently CNN only)
  • MNISTTrainer : training logic and steps
  • MNISTTester : test trained model and an image
  • TFUtils : Xavier initialization and a small utilities for my laziness

Excutable Scripts

  • train.py : can use below options
    • learning_rate=0.001
    • decay=0.9
    • training_epochs=10
    • batch_size=100
    • p_keep_conv=0.8
    • p_keep_hidden=0.5
  • test.py
    • prediction test with MNIST test set
    • prediction test with image file
      • only for square images and single number
      • size is not matter

Results

➜  TensorFlow-MNIST# python train.py 
Preparing MNIST data..
Extracting mnist/data/train-images-idx3-ubyte.gz
Extracting mnist/data/train-labels-idx1-ubyte.gz
Extracting mnist/data/t10k-images-idx3-ubyte.gz
Extracting mnist/data/t10k-labels-idx1-ubyte.gz
---
Building CNN model..
---
Start training. Please be patient. :-)
Epoch: 0001 / Accuracy = 0.9511
Epoch: 0002 / Accuracy = 0.9634
...
---
Saving my model..
---
Learning Finished!
➜  TensorFlow-MNIST# python test.py
---
Loading a model..
Preparing MNIST data..
Extracting mnist/data/train-images-idx3-ubyte.gz
Extracting mnist/data/train-labels-idx1-ubyte.gz
Extracting mnist/data/t10k-images-idx3-ubyte.gz
Extracting mnist/data/t10k-labels-idx1-ubyte.gz
---
Calculating accuracy of test set..
---
CNN accuracy of test set: 0.993600
---
Predict random item: 5 is 5, accuracy: 1.000
---
4 is digit-4.png, accuracy: 1.000000
---
2 is digit-2.png, accuracy: 1.000000
---
5 is digit-5.png, accuracy: 0.997631
➜  TensorFlow-MNIST# tensorboard --logdir=logs/mnist-cnn

tensorflow-mnist's People

Contributors

golbin avatar

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.