This repository contains code that trains a convolutional neural network (CNN) to recognize handwritten Chinese characters. The network is trained on the CASIA dataset, which can be found at http://www.nlpr.ia.ac.cn/databases/handwriting/Home.html.
Clone this repository to your computer. From the Downloads Section of the CASIA page, Download HWDB1.0train_gnt (2741MB) and HWDB1.0test_gnt (681MB) and extract the folder so that you end up with two folders with GNT files. Store them in a folder labeled data.
Change your directory to this repository. Modify lines 12 and 13 in in convert.py to correspond to the relative locations of your train and test folders. Call these folders train and test.
train_data_dir = os.path.join(data_dir, 'your_path_here')
test_data_dir = os.path.join(data_dir, 'your_path_here')
Uncomment lines 60-79 of preprocess.py and run. The compressed dataset will new be stored in data/compressed.
Modify train.py to reflect the number of classes you choose to train the network on.
model.add(Dense(number_of_classes, activation='softmax'))
Run the program.
Save an image labelled test.png you would like to have the network predict to data. Comment out lines 60-79 of preprocess.py, then run predict.py
I'd like to thank the following people/pages for providing resources that have especially helped me.