Code Monkey home page Code Monkey logo

handwritten_digit_recognition's Introduction

Handwritten digit recognition with MNIST and Keras

This repository is for practice of implementing well-known network architectures and ensembling methods, including the followings:

Architectures

Ensembling methods

Others

  • Channel-wise normalization of input images: substracted by mean and divided by std
  • Data augmentation: rotation, width shift, height shift, shearing, zooming

Environment

  • MacOS High Sierra 10.13.1 for implementation / Ubuntu 14.04 for training
  • Python 3.6.3
  • Keras 2.1.2 (Tensorflow backend)

Evaluation

The best single model and the best ensemble method achieve 99.76% and 99.77% on the test set respectively.

Model On the validation set On the test set
Mobilenet 99.63% 99.68%
 VGG16 99.61% 99.68%
Resnet164 99.72% 99.70%
WideResnet28-10 99.72% 99.76%
Ensemble (all) On the validation set On the test set
Unweighted average 99.70% 99.75%
Majority voting         99.71%                 99.76%      
Super Learner 99.73% 99.77%

In order to run the evaluation, it requires pre-trained weights for each model, which can be downloaded here.

*All pre-trained weights should be stored in './models'.

How to run

python evaluate.py [options]

Options

$ python evaluate.py --help
usage: evaluate.py [-h] [--dataset DATASET]

optional arguments:
  -h, --help         show this help message and exit
  --dataset DATASET  training set: 0, validation set: 1, test set: 2

Training

The training can be executed by the following command. Every model has the same options.

How to run

$ python vgg16.py [options]

Options

$ python vgg16.py --help
usage: vgg16.py [-h] [--epochs EPOCHS] [--batch_size BATCH_SIZE]
                [--path_for_weights PATH_FOR_WEIGHTS]
                [--path_for_image PATH_FOR_IMAGE]
                [--path_for_plot PATH_FOR_PLOT]
                [--data_augmentation DATA_AUGMENTATION]
                [--save_model_and_weights SAVE_MODEL_AND_WEIGHTS]
                [--load_weights LOAD_WEIGHTS]
                [--plot_training_progress PLOT_TRAINING_PROGRESS]
                [--save_model_to_image SAVE_MODEL_TO_IMAGE]

optional arguments:
  -h, --help            show this help message and exit
  --epochs EPOCHS       How many epochs you need to run (default: 10)
  --batch_size BATCH_SIZE
                        The number of images in a batch (default: 64)
  --path_for_weights PATH_FOR_WEIGHTS
                        The path from where the weights will be saved or
                        loaded (default: ./models/VGG16.h5)
  --path_for_image PATH_FOR_IMAGE
                        The path from where the model image will be saved
                        (default: ./images/VGG16.png)
  --path_for_plot PATH_FOR_PLOT
                        The path from where the training progress will be
                        plotted (default: ./images/VGG16_plot.png)
  --data_augmentation DATA_AUGMENTATION
                        0: No, 1: Yes (default: 1)
  --save_model_and_weights SAVE_MODEL_AND_WEIGHTS
                        0: No, 1: Yes (default: 1)
  --load_weights LOAD_WEIGHTS
                        0: No, 1: Yes (default: 0)
  --plot_training_progress PLOT_TRAINING_PROGRESS
                        0: No, 1: Yes (default: 1)
  --save_model_to_image SAVE_MODEL_TO_IMAGE
                        0: No, 1: Yes (default: 1)

File descriptions

├── images/ # model architectures and training progresses
├── predictions/ # prediction results to be used for fast inference
├── models/ # model weights (not included in this repo)
├── README.md
├── base_model.py # base model interface
├── evaluate.py # for evaluation
├── utils.py # helper functions
├── mobilenet.py
├── vgg16.py
├── resnet164.py
├── wide_resnet_28_10.py
└── super_learner.py

References

Papers

Implementation

Others

handwritten_digit_recognition's People

Contributors

curt-park avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

handwritten_digit_recognition's Issues

공부하다가 문의드립니다.

https://tykimos.github.io/2017/06/10/Model_Save_Load/ 를 참고하여서

공유해주신 Resnet164 을 load 하고

1만개의 테스트셋 (x_test, y_test) 에 대하여 평가해보려고 했는데

다음과 같은 에러를 만났습니다.

입력데이터의 shape 이 다르기 때문일 것 같습니다.

혹시 공유해주신 Resnet164를 위의 1만개의 테스트셋으로 평가하는 방법을 알려주실 수 있나요 ?

2018-01-09 18 44 52

cifar10으로 성능 확인시

안녕하세요. 코드 보고 논문으로 확인하면서 공부를 하고 있습니다.

우선 결과물을 공유해주셔서 감사합니다.

다름이 아니라, Cifar10으로 학습 시켜서 'Identity Mapping ~(Kaiming He)' 결과를 확인하려고 하는데요.

그럴 경우 제공해 주신 기본 모델 (.h5) 은 사용하면 안되는 것이지요?...
error
다음과 같은 에러가 떠서 문의 드립니다.

감사합니다.

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.