Code Monkey home page Code Monkey logo

svhnclassifier's Introduction

SVHNClassifier

A TensorFlow implementation of Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks

Graph

Graph

Results

Accuracy

Accuracy

Accuracy 93.45% on test dataset after about 14 hours

Loss

Loss

Samples

Training Test
Train1 Test1
Train2 Test2

Inference of outside image

digit "10" means no digits

Requirements

  • Python 2.7

  • Tensorflow

  • h5py

    In Ubuntu:
    $ sudo apt-get install libhdf5-dev
    $ sudo pip install h5py
    

Setup

  1. Clone the source code

    $ git clone https://github.com/potterhsu/SVHNClassifier
    $ cd SVHNClassifier
    
  2. Download SVHN Dataset format 1

  3. Extract to data folder, now your folder structure should be like below:

    SVHNClassifier
        - data
            - extra
                - 1.png 
                - 2.png
                - ...
                - digitStruct.mat
            - test
                - 1.png 
                - 2.png
                - ...
                - digitStruct.mat
            - train
                - 1.png 
                - 2.png
                - ...
                - digitStruct.mat
    

Usage

  1. (Optional) Take a glance at original images with bounding boxes

    Open `draw_bbox.ipynb` in Jupyter
    
  2. Convert to TFRecords format

    $ python convert_to_tfrecords.py --data_dir ./data
    
  3. (Optional) Test for reading TFRecords files

    Open `read_tfrecords_sample.ipynb` in Jupyter
    Open `donkey_sample.ipynb` in Jupyter
    
  4. Train

    $ python train.py --data_dir ./data --train_logdir ./logs/train
    
  5. Retrain if you need

    $ python train.py --data_dir ./data --train_logdir ./logs/train2 --restore_checkpoint ./logs/train/latest.ckpt
    
  6. Evaluate

    $ python eval.py --data_dir ./data --checkpoint_dir ./logs/train --eval_logdir ./logs/eval
    
  7. Visualize

    $ tensorboard --logdir ./logs
    
  8. (Optional) Try to make an inference

    Open `inference_sample.ipynb` in Jupyter
    Open `inference_outside_sample.ipynb` in Jupyter
    $ python inference.py --image /path/to/image.jpg --restore_checkpoint ./logs/train/latest.ckpt
    
  9. Clean

    $ rm -rf ./logs
    or
    $ rm -rf ./logs/train2
    or
    $ rm -rf ./logs/eval
    

svhnclassifier's People

Contributors

potterhsu avatar

Watchers

James Cloos 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.