- This project recognizes Chinese characters in a image file and convert them into Arabic numerals
Check demo.ipynb for the whole process
- Now the seperation is done with simple matrix multiplication labeling. To handle rotated input, use Spectral Clustering for number seperation. Define the similarity matrix with gaussian kernal and run the K-mean on the eigenspace.
Pytorch
OpenCV
torchvision
label |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
Chinese Character |
零 |
一 |
二 |
三 |
四 |
五 |
六 |
七 |
八 |
九 |
十 |
百 |
千 |
万 |
亿 |
numeral |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
100 |
1000 |
10000 |
10-e8 |
Chinese MNIST
demo.ipynb
a example to show how the program works.
src/
model.py
Defination of class IntRec
, the model trained to convert chinese character to Arabic numerals.
utils.py
- Implementation of
DataLoader
, which load image files from dataset into tensor of shape
[batch, channel, height, width]
along with groundtruth label
HelperFunc
a class of helper function to extract single characters from each image
train.py
traning loops for the model, aumomatically use cuda if availiable. Tracking training and validation accuracy in train_acc.pickle
and valid_acc.pickle
data/
containing training data images and a csv file chinese_mnist.csv
, which contains paths to images and labels.
pictures/
the program will read image files from this folder and produce prediction