Wednesday, September 24, 2008

..on neural networks

On the two previous activities, we applied pattern recognition to identify the class a given image belongs to. We have used the the minimum distance classification and the linear discriminant analysis. In this activity, we introduce another method: neural networks. Neural networks mimics the way how our brain neurons work. It classifies images by learning the rule of mapping using the training set. Below is a diagram of an artificial neural network. Xi would be the inputs and Z would be the output. The goal is to determine the values of the weights Wi such that the resulting output Z matches our desired output. To do this, we train the network using examples from the training set. After determining the values for the weights Wi, we can now classify the images from the test set.















We use the same set of images form the previous activities. We consider 10 (5 training set, 5 test set) images of leaves of each kind of two different plant: Mango and an ornamental plant (I dont know the name).






Mango Leaves














Ornamental Plant Leaves







We also enhance the images as to make the classification process easier. We used the Gray World Algorithm in white balancing our images. For each class, we divided it into two groups: the training set and the test set. We use the training set to get the characteristic features of the leaves that would easily differentiate it from the other class. In this case, we used the RGB values and the eccentricity of the shape of the leaves as our four distinguishing features. Below is a table showing the four features corresponding to each of the 10 training set. These would be our input X in the neural network.

















From this training set, we determine the desired weights Wi of the network. We now classify the remaining images in the test set. The output would be 0 or 1 corresponding to the two classes (1 or 2). The table below is the summary of the results.













Like the two previous methods, neural networks have successfully classified all the 10 images. The success rate is 100%.

I was able to successfully accomplish the activity. I want to give myself a 10.

Acknowledgment to Jeric for the sample code and the discussion on neural networks.

No comments: