Skip to content

jiongjiongli/CASIA-HWDB1.1-cnn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CASIA-HWDB1.1-cnn

This repository is based on CASIA-HWDB1.1-cnn. Most works focus on compat with latest python (3.4) and keras (2.1.6), image preprocessing and test report generation.

This code was last testd in a virtual machine with i7-5557U CPU @ 3.10GHz × 2 (no GPU), and 4GB memory. The training stage took 22 hours. Test accuracy is 95.7%.

Requisites

Prepare environment following README-ENV.md

Usage

In the releases section we uploaded a (zipped) subset of the CASIA-HWDB1.1 data set, the network model, network weights and some classifications, all generated following the steps below. If you use our subset, start from step 3.

  1. Download the CASIA-HWDB1.1 data set from the official locations (HWDB1.1trn_gnt_P1.zip (901 MB), (HWDB1.1trn_gnt_P2.zip (947 MB) and HWDB1.1tst_gnt.zip (471 MB)) and unzip it (it is required to decompress an archive in ALZ format):
$ unzip HWDB1.1trn_gnt_P1.zip
[...]
$ unzip HWDB1.1trn_gnt_P2.zip
[...]
$ mkdir HWDB1.1trn_gnt
$ mv *.gnt HWDB1.1trn_gnt/
$ unzip HWDB1.1tst_gnt.zip
Archive:  HWDB1.1tst_gnt.zip
  inflating: 1289-c.gnt
  inflating: 1290-c.gnt
  [...]
$ mkdir HWDB1.1tst_gnt
$ mv *.gnt HWDB1.1tst_gnt/
  1. Convert the data set into the HDF5 binary data format:
$ python 1-gnt_to_dataset.py HWDB1.1trn_gnt/ HWDB1.1tst_gnt/
Converting 'trn'...
Converting 'tst'...
  1. Extract from the HDF5 data set a subset of 200 classes of characters:
$ python 2-dataset_to_subset.py HWDB1.1.hdf5
Subsetting 'trn'...
Subsetting 'tst'...
  1. Train the network on the subset:
$ python 3-train_subset.py HWDB1.1subset.hdf5
[...]
Using Tensorflow backend.
Test score: 0.20873856527750181
Test accuracy: 0.9578136770737423
--- 79944.11841607094 seconds ---
  1. (Optional) Generate a report of some classifications:
$ python 4-draw_results.py HWDB1.1subset.hdf5 model.json weights.hdf5
Using TensorFlow backend.
2018-05-17 23:49:04.103902: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Evaluating the network on the test set...
Test score: 0.20873856527750181
Test accuracy: 0.9578136770737423
Extracting some results...
Sample number: 11947
--- 101.42111706733704 seconds ---
  1. (Optional) View test report results.html:

Results

About

Convolutional neural networks with Python 3 and Keras

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 72.1%
  • Python 27.9%