Laboratory of Computer and Information Science
HANDWRITTEN DIGIT CLASSIFICATION

GENERAL

The main goal of the project work is to implement a widely used classification method and test it with fairly simple data. The work is carried out with Matlab software. In this work, the data consist of handwritten digits.

FILES

As the main purpose of the work is not to learn how to use Matlab but to get more familiar with pattern recognition methods, some of the Matlab code is provided. Your task is to code the recognizer.

Data

The handwritten digit data are stored in Matlab files here. The files contain digits written by two or four writers. Use either one of the data sets in your experiments. The digits are stored as two two matrices: one-stroke digits are in the different matrix than the digits consisting of two strokes. The size of a digit matrix is N*2*n, where the first dimension is the number of digits, the second dimension indicates either x- or y-component of the data point, and the third dimension is the number of the data points. The data points are the positions of the pen point on the writing surface. Each stroke is presented with 50 evenly spaced data points. The labels of the digit samples are given in separate vectors.

You can have a look on some of the unprocessed digit samples at here.

Matlab functions

You can preprocess and normalize the digits with the following functions: Decimate, Centralize, and NormalizeSize. The first function reduces the data by keeping every n:th data point and abandoning the rest of the data points. The second function moves the center of the bounding box drawn around the digit into to the origin of the coordinate system. The third function scales the character so that the height of the bounding box is set to a constant value and the aspect ratio remains unchanged. With function DivideSetsLottery you can divide the digits into two sets. Function DtwDistance calculates the Dynamic Time Warping (DTW) distance between two digits. It also returns the difference between the digits which you can use in the Learning Vector Quantization algorithm. DTW is a nonlinear curve matching method commonly used in handwriting and speech recognition. You can find more information on the DTW-algorithm from the comments of the function's Matlab code.

You can get the functions from here: Decimate.m, Centralize.m, NormalizeSize.m, DivideSetsLottery.m, DtwDistance.m.

EXERCISES

Preprocessing methods

If you reduce the number of data points you can decrease the time consumed in the evaluation of the DTW-distance significantly. However, you will lose some valuable information. How many data points can represent a stroke with a sufficient accuracy?

Normalization methods

The digits have been written without any specific constrains on the writing style. The variations caused by different personal styles of writing can be covered, in some extent, by the DTW-algorithm used for comparison of the digits. However, the size and location variations of the digits have to be normalized before they can be matched. How do personal writing styles differ from each other?

Feature selection

The data point sequences are compared as such and there is no need for a specific feature extraction.

Recognition methods

Implement one of the following recognition methods: 1) the k Nearest Neighbors (knn) classifier, 2) Learning Vector Quantization (LVQ) classifier. For both methods, use DTW-algorithm for comparing the digits. Experiment with different values of k and prototype set sizes. Use linearly decaying learning coefficient for LVQ.

Do not use same digit samples for learning and testing the recognition system.

Reporting

In the report, give a brief description of the recognition method applied, justify all the selection you have made, and give the recognition results of the best recognizer (calculate the total error rate and occurrences of all error types). Also, include your Matlab code with comments.


This page is maintained by elia.liitiainen@hut.fi.