Figure 1. Training sets arranged according to different classes
I incorporated the following steps to each of my training set for every classes.
1. Convert the image to binary.
2. Apply morphological operations to remove unwanted blobs as well as isolate the main blob (that of the coin)
3. Filtered the resulting image by the corresponding sizes, until only the coin remains.
4. Obtained the size of the blob
5. Compute mean and standard deviation of the sizes of each class.
The result of these steps for each class are shown in Figure 2.
Figure 2. Blobs of the coins
For the color feature, I just computed for the mean of the normalized pixel values of red, green, and blue channels. I can opt to choose at least one of the R G and B channels, plus the size feature, thereby giving us at most 4 features to consider. I only used three (size, G and B) to be able to fully visualize the spread of the data in a 3-dimensional plot. Examples of my 3-dimensional scatter plot of the data are shown below:
Figure 3. 3D scatter plot of all classes. Red, blue, black, green, and dark blue colors represent 0.05, 0,10, 0.25, 1.00, and 5.00 respectively.
It can be observed from the plot that the 0.05 class (red colors) are relatively more scattered than the rest. This is due to the difference in size. Sometimes, the result of the thresholding and morphological operations are not enough to isolate the coin alone. This is due to the difference in light exposure. When I captured an image of the individual coins, I made sure that the tripod is fixed and that there must be no shadow casted in the image. If a shadow is present, a bias would be introduced in the size of the coin. In order to accomplish this, I made sure that all light sources are blocked and majority of the light that illuminates the coin comes from secondary sources. I also thought of capturing all the coins as a single image and just crop the images one by one, but I realized that it is more tedious to do especially that the number of classes I need to classify is 5 and the training set is 10 samples each class, giving a total of 50 samples.
Sure enough, the size of the coins give the most accurate result. There are more intersections between classes in the RGB feature space. A 2D image of the feature space is shown in the image below.
Figure 4. 2D scatter plot of features size vs blue, green and red channels.
Based from the plot, the size and the color of the 5 and 10 centavo coins are relatively near each other. Only the 1 peso coin has a color relatively different from the rest of the classes, except in the green channel.
After getting the scatter plot of the data and computing for the mean values of these training set, I tried performing a random test to my program to test if it's effective enough to classify a coin according to its class. From 52 test sets I have, 47 of these have been classified correctly. The problem with the rest of coins that have been misclassified are due to the darkness/brightness of the image. The isolation of the coin itself is where the problem lies. Thus, the feature that corresponded to the size was miscalculated in these cases. Moreover, it so happened that the objects are of relatively the same color, making it difficult for the program to distinguish the classes.
In order to improve this experiment, it would be better if the coins were to be captured at once, so that the lighting, and camera settings are made sure to be the same for all, thereby removing the bias that could be imposed to the images.
For this activity, I give myself a grade of 10/10 for being able to perform pattern recognition. It took me quite a long time to decide what objects to used. At first was thinking of using leaves and flowers, but I didn't have enough number of images for the training and test sets.
Walang komento:
Mag-post ng isang Komento