Skip to content
项目

关于

A tensorflow model trained using the svhn dataset to detect digit sequences in the real world.

人工智能与机器学习

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Decoding Digit Sequences in Real-World Photos (TensorFlow, SVHN)

A TensorFlow implementation of a convolutional neural network that reads multi-digit sequences, such as house numbers, from real-world photos. It is trained on the SVHN dataset.

Built in 2016 as the capstone project for the Udacity Machine Learning Nanodegree. The code targets Python 2.7 and early TensorFlow 1.x APIs and is kept here as-is for reference. The full write-up is in capstone report final.pdf.

Installation

git clone https://github.com/bdiesel/tensorflow-svhn.git
cd tensorflow-svhn

Libraries and dependencies

The project needs these Python 2.7 libraries:

  • h5py
  • matplotlib
  • numpy
  • PIL
  • tensorflow
  • scipy
  • six
  • sklearn

Step 1: Download and preprocess the SVHN data

Download and preprocess the SVHN data with the svhn_data.py utility:

python svhn_data.py

This creates a data/svhn folder with two subdirectories, cropped and full.

The cropped directory contains 2 downloaded .mat files and 6 NumPy files for each dataset, which are used for training.

The full directory contains two subdirectories, test and full, with PNG images of various sizes. It also contains 6 NumPy files and 3 tar.gz files. You can delete the tar.gz files to free up disk space.

Step 2: Train your own models

First train the classifier. The weights it produces are reused to train the multi-digit reader. This step can take a while, depending on your hardware. Pre-trained weights are available for the single-digit reader and the multi-digit reader.

python train_classifier.py

This produces a TensorFlow checkpoint file:

classifier.ckpt

Next, train the multi-digit reader:

python train_regressor.py

This produces a TensorFlow checkpoint file:

regression.ckpt

Step 3: Check model performance

The training scripts write logs that you can open in TensorBoard to inspect the models' performance over time.

To view single-digit performance after running train_classifier.py:

tensorboard --logdir="/tmp/svhn_classifier_logs"

To view multi-digit performance after running train_regressor.py:

tensorboard --logdir="/tmp/svhn_regression_logs"

Usage

Single-digit reader, for an image file 1.png: python single_digit_reader.py 1.png

Multi-digit reader, for an image file 123.png: python multi_digit_reader.py 123.png

探索相关项目

加载中…