All Projects → hwalsuklee → Tensorflow Mnist Cnn

hwalsuklee / Tensorflow Mnist Cnn

MNIST classification using Convolutional NeuralNetwork. Various techniques such as data augmentation, dropout, batchnormalization, etc are implemented.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tensorflow Mnist Cnn

Svhn Cnn
Google Street View House Number(SVHN) Dataset, and classifying them through CNN
Stars: ✭ 44 (-75.82%)
Mutual labels:  cnn, mnist, dropout
numpy-neuralnet-exercise
Implementation of key concepts of neuralnetwork via numpy
Stars: ✭ 49 (-73.08%)
Mutual labels:  dropout, mnist
Gordon cnn
A small convolution neural network deep learning framework implemented in c++.
Stars: ✭ 241 (+32.42%)
Mutual labels:  cnn, mnist
Tensorflow Tutorial
Tensorflow tutorial from basic to hard, 莫烦Python 中文AI教学
Stars: ✭ 4,122 (+2164.84%)
Mutual labels:  cnn, dropout
mnist-challenge
My solution to TUM's Machine Learning MNIST challenge 2016-2017 [winner]
Stars: ✭ 68 (-62.64%)
Mutual labels:  mnist, data-augmentation
Pratik Derin Ogrenme Uygulamalari
Çeşitli kütüphaneler kullanılarak Türkçe kod açıklamalarıyla TEMEL SEVİYEDE pratik derin öğrenme uygulamaları.
Stars: ✭ 200 (+9.89%)
Mutual labels:  cnn, mnist
Deepnet
Implementation of CNNs, RNNs, and many deep learning techniques in plain Numpy.
Stars: ✭ 285 (+56.59%)
Mutual labels:  cnn, dropout
Ailearnnotes
Artificial Intelligence Learning Notes.
Stars: ✭ 195 (+7.14%)
Mutual labels:  cnn, dropout
Pytorch
PyTorch tutorials A to Z
Stars: ✭ 87 (-52.2%)
Mutual labels:  cnn, mnist
Eda nlp
Data augmentation for NLP, presented at EMNLP 2019
Stars: ✭ 902 (+395.6%)
Mutual labels:  data-augmentation, cnn
Torchio
Medical image preprocessing and augmentation toolkit for deep learning
Stars: ✭ 708 (+289.01%)
Mutual labels:  data-augmentation, cnn
Mnist Classification
Pytorch、Scikit-learn实现多种分类方法,包括逻辑回归(Logistic Regression)、多层感知机(MLP)、支持向量机(SVM)、K近邻(KNN)、CNN、RNN,极简代码适合新手小白入门,附英文实验报告(ACM模板)
Stars: ✭ 109 (-40.11%)
Mutual labels:  cnn, mnist
Wb color augmenter
WB color augmenter improves the accuracy of image classification and image semantic segmentation methods by emulating different WB effects (ICCV 2019) [Python & Matlab].
Stars: ✭ 89 (-51.1%)
Mutual labels:  data-augmentation, cnn
Tensorflow Tutorials
텐서플로우를 기초부터 응용까지 단계별로 연습할 수 있는 소스 코드를 제공합니다
Stars: ✭ 2,096 (+1051.65%)
Mutual labels:  cnn, mnist
Autoclint
A specially designed light version of Fast AutoAugment
Stars: ✭ 171 (-6.04%)
Mutual labels:  cnn
Muda
A library for augmenting annotated audio data
Stars: ✭ 177 (-2.75%)
Mutual labels:  data-augmentation
Lenet5 hls
FPGA Accelerator for CNN using Vivado HLS
Stars: ✭ 167 (-8.24%)
Mutual labels:  cnn
Kaggle Competition Favorita
5th place solution for Kaggle competition Favorita Grocery Sales Forecasting
Stars: ✭ 169 (-7.14%)
Mutual labels:  cnn
Tsaug
A Python package for time series augmentation
Stars: ✭ 180 (-1.1%)
Mutual labels:  data-augmentation
Sentence Classification
Sentence Classifications with Neural Networks
Stars: ✭ 177 (-2.75%)
Mutual labels:  cnn

Convolutional Neural-Network for MNIST

An implementation of convolutional neural-network (CNN) for MNIST with various techniques such as data augmentation, dropout, batchnormalization, etc.

Network architecture

CNN with 4 layers has following architecture.

  • input layer : 784 nodes (MNIST images size)
  • first convolution layer : 5x5x32
  • first max-pooling layer
  • second convolution layer : 5x5x64
  • second max-pooling layer
  • third fully-connected layer : 1024 nodes
  • output layer : 10 nodes (number of class for MNIST)

Tools for improving CNN performance

The following techniques are employed to imporve performance of CNN.

Train

1. Data augmentation

The number of train-data is increased to 5 times by means of

  • Random rotation : each image is rotated by random degree in ranging [-15°, +15°].
  • Random shift : each image is randomly shifted by a value ranging [-2pix, +2pix] at both axises.
  • Zero-centered normalization : a pixel value is subtracted by (PIXEL_DEPTH/2) and divided by PIXEL_DEPTH.

2. Parameter initializers

  • Weight initializer : xaiver initializer
  • Bias initializer : constant (zero) initializer

3. Batch normalization

All convolution/fully-connected layers use batch normalization.

4. Dropout

The third fully-connected layer employes dropout technique.

5. Exponentially decayed learning rate

A learning rate is decayed every after one-epoch.

Test

1. Ensemble prediction

Every model makes a prediction (votes) for each test instance and the final output prediction is the one that receives the highest number of votes.

Usage

Train

python mnist_cnn_train.py

Training logs are saved in "logs/train". Trained model is saved as "model/model.ckpt".

Test a single model

python mnist_cnn_test.py --model-dir <model_directory> --batch-size <batch_size> --use-ensemble False

  • <model_directory> is the location where a model to be testes is saved. Please do not specify filename of "model.ckpt".
  • <batch_size> is employed to reduce burden of memory of machine. The number of test data is 10,000 for MNIST. Different batch_size gives the same result, but requiring different memory size.

You may command like python mnist_cnn_test.py --model-dir model/model01_99.61 --batch-size 5000 --use-ensemble False.

Test ensemble prediction

python mnist_cnn_test.py --model-dir <model_directory> --batch-size <batch_size> --use-ensemble True

  • <model_directory> is the location of root directory. The root directory contains the sub-directories containg each model.

You may command like python mnist_cnn_test.py --model-dir model --batch-size 5000 --use-ensemble True.

Simulation results

CNN with the same hyper-parameters has been trained 30 times, and gives the following results.

  • A single model : 99.61% of accuracy.(the model is saved in "model/model01_99.61".)
  • Ensemble prediction : 99.72% of accuracy.(All 5 models under "model/" are used. I found the collection of 5 models by try and error.)

99.72% of accuracy is the 5th rank according to Here.

Acknowledgement

This implementation has been tested on Tensorflow r0.12.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].