Monday, September 15, 2008

A18 - Pattern Recognition

Pattern recognition, as a subtopic of machine learning, aims to classify data according to a statistical information extracted from its patterns.

A pattern is usually a group of measurements or observations extracted from the data set. In essence, a pattern is a set of quantifiable features. These features are then arranged into an ordered set to define a feature vector. Feature vectors, then, define the grouping of the data into classes.

In pattern recognition, the specific goal is to decide if a given feature vector belongs to one of the several classes.

In this activity, we aim to classify a set of images into one of the four classes - kwek-kwek (orange, flour-coated quail egg), squid balls, piatos potato chips, pillows (chocolate coated snack).

Images of the four samples were taken using Olympus Stylus 770SW. The images are then white balanced using reference white algorithm with the white tissue as the reference. This is to maintain uniform tissue color in each of the images. The images are then cut such that a single image contains a single sample.




FEATURE VECTOR
For each of the individual sample, the features extracted are as follows:
1. pixel area
2. length-to-width ratio
3. average red component (NCC)
4. average green component (NCC)

To get the pixel area, the sample images were first binarized to separate ROI from the background. Closing operation is then performed on the binarized images to reduce effect of poor thresholding. The pixel area is then equal to the sum of the (binarized then closed) image.

Length-to-width ratio is computed as the maximum filled pixel coordinate along the x-axis minus the minimum filled pixel coordinate along x-axis divided by its y-axis counterpart.

The average red component and green component is obtained from the ROI only using Normalized Chromaticity Coordinates.

The following table summarizes the features extracted for all the sample images.



MINIMUM DISTANCE CLASSIFICATION
The data set is divided into two - training and test sets. The training set is composed of the first four images from each classes while the test set are the last four images for each sample.
(Note: Pixel Area was first normalized before subjecting to minimum distance classification.)

To facilitate classification of the test images into one of the four classes, we use minimum distance classification.

This is done by getting the mean feature vector from the training set for each class. Therefore, we get the mean of the training set by getting the mean pixel area, mean L/W, mean r, mean g for each of the four classes.



Classification is done by getting the Euclidean distance of an unknown feature vector from the mean feature vector of each class. The unknown feature vector then belongs to the class with which it has the smallest distance.

In this activity, we use the test set to check for the validity of minimum distance classification as a pattern recognition algorithm. The following results were obtained.



From the matrix above, it is shown that among the 16 samples of the test set, only 1 was misclassified as belonging to another class.

---
Thanks Benj for the discussions with regards to this activity and Cole for the sample images.

---
Rating: 8.5/10 since I implemented the task correctly but was late in posting this blog entry.

No comments: