This is an Matlab project for recognizing noised digital image. What we want is a programme that could automatically recognize several noised digital image. The inputs are some images like the following picture, the exception is [2, 0, 2].
In this project, we introduced a classification example for number images.
They are similar to Google CAPTCHAs.
There are totally 1200 images in folder 'imagedata', and ground truth in file 'labels.txt'.
The task is to make a function called my_classifier.m that decodes three digits in an image.
Matlab and Image Processing Toolbox are ready for your computer.
- New a folder named ‘labeledImage’ and run ‘DeNoise.m’
- New a folder named ‘SplitLabeledImage’ with 3 sub-folders named ‘0’, ‘1’ and ‘2’, then run ‘Split.m’
- Run ‘trainer.m’ to get trained network ‘net.mat’
- Run ‘evaluate_classifier.m’
-
We firstly use threshold to convert image into binary image.
-
We split the denoised image into three parts. In each part, there is a single number.
-
We do the same thing for each image and save the split images into the sub-folder
0
,1
,2
-
We desgin a CNN like this
layers = [ imageInputLayer([50 35 1]) convolution2dLayer(3,8,'Padding','same') batchNormalizationLayer reluLayer maxPooling2dLayer(2,'Stride',2) convolution2dLayer(3,16,'Padding','same') batchNormalizationLayer reluLayer maxPooling2dLayer(2,'Stride',2) convolution2dLayer(3,32,'Padding','same') batchNormalizationLayer reluLayer fullyConnectedLayer(3) softmaxLayer classificationLayer];
-
We write a script for test images to split them into the size that our clissifer can test. In this project, it is
myclassifier.m
. -
At last, in
evaluate_classifier.m
, we evaluate our classifier. Note, you may see that the code in this file about the test data is our training data, but you can replace them by yourself.