🌚 A Simple MultiDigitsRecognizer based on CNN implemented by Tensorflow
Jupyter Notebook Python HTML CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
deepLearning
static/img
template
README.md
__init__.py
app.py
cross_validation.ipynb
explore_preprocess.ipynb
train_cnn.ipynb

README.md

A simple CNN multi-digits recognizer based on TensorFlow

This is a simple CNN multi-digits recognizer based on TensorFlow, web project on http://goingmyway.cn:5000

Dependencies

  • Python 2.7
  • tensorflow-gpu==0.12.0
  • Flask==0.12
  • h5py==2.6.0
  • numpy==1.11.3
  • matplotlib==1.5.3
  • six==1.10.0
  • pandas==0.18.1
  • scikit-learn==0.18.1
  • scipy==0.18.1

Show the tree map of the project

capstone/
β”œβ”€β”€ app.py  # app file, run it                     
β”œβ”€β”€ deepLearning   # deep learning model
β”‚Β Β  β”œβ”€β”€ ckpt_data  # ckpt data path
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ checkpoint
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ SVHN.ckpt.data-00000-of-00001
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ SVHN.ckpt.index
β”‚Β Β  β”‚Β Β  └── SVHN.ckpt.meta
β”‚Β Β  β”œβ”€β”€ infer_model.py  # infer model call by the app
β”‚Β Β  β”œβ”€β”€ __init__.py
β”‚Β Β  β”œβ”€β”€ multi_digits  # model dir
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ __init__.py
β”‚Β Β  β”‚Β Β  └── muti_digits_model.py  # model file
β”‚Β Β  β”œβ”€β”€ preprocess_data.py
β”‚Β Β  └── train_model.py
β”œβ”€β”€ __init__.py
β”œβ”€β”€ README.md
β”œβ”€β”€ static
β”‚Β Β  └── img
β”‚Β Β      β”œβ”€β”€ 46.png
β”‚Β Β      β”œβ”€β”€ cmd.jpg
β”‚Β Β      β”œβ”€β”€ ico.ico
β”‚Β Β      β”œβ”€β”€ icon.ico
β”‚Β Β      β”œβ”€β”€ meme.png
β”‚Β Β      β”œβ”€β”€ myid.jpg
β”‚Β Β      β”œβ”€β”€ pic.jpg
β”‚Β Β      └── sample
β”‚Β Β          β”œβ”€β”€ 10.png
β”‚Β Β          β”œβ”€β”€ 11.png
β”‚Β Β          β”œβ”€β”€ 1.png
β”‚Β Β          β”œβ”€β”€ 2.png
β”‚Β Β          β”œβ”€β”€ 3.png
β”‚Β Β          β”œβ”€β”€ 4.png
β”‚Β Β          β”œβ”€β”€ 5.png
β”‚Β Β          β”œβ”€β”€ 6.png
β”‚Β Β          β”œβ”€β”€ 7.png
β”‚Β Β          β”œβ”€β”€ 8.png
β”‚Β Β          └── 9.png
└── template
 Β Β  β”œβ”€β”€ index.html
 Β Β  └── result.html

Run the app

To run the app, just go the home directory of the app, and type

python app.py 1>>app.log 2>&1

Attention, to run the app, ckpt data of the CNN model must be in the APP_HOME/deepLearning/ckpt_data directory.

Train the model

Trainning data is from The Street View House Numbers (SVHN) Dataset

Before train the model, you must preprocess the data, in the home directory of the app, type

$ cd deepLearning
$ python preprocess_data.py $train_path $test_path $extra_path

and after that, there is a pickled file named SVHN.pickle in the directory, to train the model, just type

$ python train_model.py pickled_data_path ckpt_data_path

or you can just type the following command to train the model

$ python train_model.py SVHN.pickle ckpt_data/SVHN.ckpt

on GTX 660 graph card with 8G memory, 8 cores cpu, it costs about 35min to train the model.