Automatic Wood Defect Classification Lulu He
[email protected] 1.
INTRODUCTION
Lumber boards often suffer from defects like knots. So before they can be turned into durables, different kinds of wood knots have to be identified and treated accordingly. Identifying wood defects by visual inspection is an open question and even human graders fail to achieve high accuracy. So an interesting question is whether this can be automated using computers. This problem seems to fall in the broad category of image similarity matching or image classification. Considering the nature of the images (see Fig 1), it seems more appropriate to use low level features like color and texture. The work in [2] attempts to detect wood defects in large lumber boards. It uses color features along with SOM clustering for the task. In our work we attempt the more difficult problem of differentiating between defects of different kinds. Specifically we would like to classify a given wood knot image as dry, encased or sound. Section 2 describes our approach and section 3 presents our experimental evaluation.
2.
APPROACH
Our task is to classify a wood defect image into one of the several possible defect classes. We use a bag of words approach framework for the classification task. The following sections describe our approach in detail.
2.1
Descriptors
In this paper we try out three different descriptors: color, shape and texture. Such descriptors have been shown to be useful in tasks like image similarity matching and content based image retrieval.
Neelabh Gupta
[email protected] Each image can now be represented by a histogram of words. Given a global vocabulary of size m, the ith entry of a histogram is the proportion of all descriptors in the image having label i. To compare two histograms
H 1=u1, u 2. .. u m , H 2= w1, w2. .. w m we use the
2
distance defined as:
2
2
H 1 , H 2 =0.5 i u i−wi /ui w i
2.3
Kernel-Based Classification
For classification, we use Support Vector Machines (SVM). To incorporate 2 distance into the SVM framework, we use extended Gaussian kernels[3]: 2
K H i , H j =exp − H i , H j / A The resulting kernel is the
2
kernel.
We use the one versus all approach to build a 3 class SVM.
3.
EXPERIMENTAL EVALUATION
We use an online dataset of wood knot images (http://www.ee.oulu.fi/research/imag/knots/KNOTS/). Our dataset has a total of 90 images of three different classes of defects. The classes are dry_knot, encased_knot and sound_knot. See Fig. 1 for some examples.
The HSV values of each pixel is used as the color feature. Edge orientation histograms are used as the shape descriptor. A given image is divided into overlapping rectangular blocks. After evaluating the edges for each rectangular patch, we build a histogram of edge orientation directions. For instance we quantize the edge orientations into 8 bins, and build a histogram where each bin count is weighted by its edge magnitude. For describing texture we convolve the image with a bank of filters, in our case the LM filter banks[1].
2.2 Comparing distribution of local descriptors After evaluating the descriptors as described in the previous section we need to represent their distributions in the training and testing images. To do this we obtain a global visual vocabulary by clustering descriptors from the training set. We use k-means to form our clusters. The cluster centers now represent the words in our vocabulary.
Fig. 1
Different kinds of wood knots
The dataset is divided into two sets for training and testing using three-fold cross validation. Twenty images from each class for training and ten from each for testing are used. Since it is a three class problem, we use the average class accuracy as our performance measure.
All the three descriptors are evaluated separately. A vocabulary is built for each and then tested separately. Fig. 2 and Fig. 3 show how the results are affected by the vocabulary size. Fig. 4 shows that the non-linear 2 kernel outperforms the linear kernel. We obtain the best accuracy of 67.78% for the texture features. Feature
Class Accuracy
HSV
66.00%
Edge orientations
52.00%
Texture
67.78%
[4] Matlab codes for Leung-Malik filter bank. http://www.robots.ox.ac.uk/~vgg/research/texclass/filters.htm l [5] Matlab Support Vector Machine Toolbox. http://www.isis.ecs.soton.ac.uk/resources/svminfo/
0.53
Table 1 Best Average Class Accuracy obtained for different features vs. a chance rate of 33.33%
4.
[3] Zhang, J., Marszalek, M., Lazebnik, S. and Schmid,C. Local features and kernels for classification of texture and object categories: A comprehensive study. International Journal of Computer Vision, 73(2): 213-238, 2007. http://www.springerlink.com/content/c62x2vr4v1262751/full text.pdf
0.52
0.52 0.51
CONCLUSION
The results are encouraging and in future evaluation with a more extensive dataset can be carried out. Evaluation of the incorrect classification showed that it was more difficult to differentiate between dry and encased knots. This could be resolved by combining several features like texture and shape together. Another issue would be to take the scale changes also into account.
0.5
0.5
0.49
0.49
K = 30 K = 40 K = 50
0.48 0.47 Average Class Accuracy
0.66
Fig. 3
0.66
Effect of vocabulary size(K) on performance
0.66 0.65 0.65
for shape features 0.64
0.64
0.64
0.63
0.64
K=25 K=50 K=100 K=200
0.63
0.6
0.52
0.5
0.63
0.4
0.4
0.62 Average Class Accuracy
Fig. 2
Effect of vocabulary size(K) on performance for HSV features
5.
REFERENCES
[1] Malik, J. , Belongie, S. , Shi, J. and Leung, T .Textons, contours and regions: cue combination in image segmentation. Proceedings of the International Conference on Computer Vision, 1999. http://ieeexplore.ieee.org/stamp/stamp.jsp? arnumber=00790346 [2] Silven, O., Niskanen, M., Kauppinen, H. 2000. Wood Inspection with Non-supervised Clustering. COST action E10 Workshop – Wood properties for industrial use, Espoo, Finland, June 18-22. DOI= http://www.ee.oulu.fi/~olli/Projects/COSTE10.20.6.2000.pdf
0.3
X² Kernel Linear Kernel
0.2 0.1 0 Average Class Accuracy
Fig. 4
2
kernel outperforms the linear kernel.
The results shown are for shape features.