Classification of wood defect images using local binary pattern variants

As Malaysia is known to be a megadiverse country that is richly endowed with biological diversity in its forests and marine ecosystems, it is no wonder that the wood industry had contributed to about 2.8% (or RM 22.11 billion) of the country’s total world export in 2016. With the wood quality being an influencing factor of the country’s wood exports, a proper detection method for uncovering the quantity and distribution of the natural wood defects [1] such as knots, blue and brown stains, split, bark pocket, borer holes, wane and rot would then be seen as a particularly important inspection process in the wood industry [2]. However, the visual defect inspection that is being manually practiced in the wood industry is not only known to be unreliable because of its susceptibility to human errors. But, the laborious task [3] had also been found to contribute to the acute symptoms of headaches and eye fatigue [4].


Introduction
As Malaysia is known to be a megadiverse country that is richly endowed with biological diversity in its forests and marine ecosystems, it is no wonder that the wood industry had contributed to about 2.8% (or RM 22.11 billion) of the country's total world export in 2016. With the wood quality being an influencing factor of the country's wood exports, a proper detection method for uncovering the quantity and distribution of the natural wood defects [1] such as knots, blue and brown stains, split, bark pocket, borer holes, wane and rot would then be seen as a particularly important inspection process in the wood industry [2]. However, the visual defect inspection that is being manually practiced in the wood industry is not only known to be unreliable because of its susceptibility to human errors. But, the laborious task [3] had also been found to contribute to the acute symptoms of headaches and eye fatigue [4].
Since the quality of wood products had depended heavily on the results of the detection processes [5], this would mean that any of the missed or defective products can have a negative impact on the wood industry. Not only compromising the safety aspects but also in contributing to the loss of revenue from addressing the failures or liability claims. For this reason, the control of product quality would play an important role in preventing the mistakes and defects in manufactured products before they are being passed to the shipping stage. With the increasing rate of production and sales, the use of an Automated Visual Inspection (AVI) that is consisted of the automated image acquisition and enhancement, segmentation, feature extraction and classification features [4] will not only help to improve the inspection process, but will also lead to a reduction in the labour costs. Since, the features from the images that had been divided into areas of interest and background in the AVI would have been subjected to a fully automated extraction and classification process. This paper presents an analysis of the statistical texture representation of the Local Binary Pattern (LBP) variants in the classification of wood defect images. The basic and variants of the LBP feature set that was constructed from a stage of feature extraction processes with the Basic LBP, Rotation Invariant LBP, Uniform LBP, and Rotation Invariant Uniform LBP. For significantly discriminating, the wood defect classes were further evaluated with the use of different classifiers. By comparing the results of the classification performances that had been conducted across the multiple wood species, the Uniform LBP was found to have demonstrated the highest accuracy level in the classification of the wood defects. As shown in Fig. 1, the AVI is made up of various hardware and software sub-components such as those of material handling, image acquisition, defect detection, defect identification, timber cutting optimization, and timber grading. Since the material handling would involve the development of hardware such as the conveyor line for material logistics purpose, a proper material handling would then be seen as vital for ensuring the stability of material movement with minimum vibration, and the conservation of the image acquisition quality from the use of appropriate speed.
With each of the manufacturing unit having different and often unique data (images) from its image acquisition subsystem, the inspection process will normally begin with the detection of the defective locations and providing the appropriate cutting guideline that is required in the timber cutting optimization subsystem. This is then followed by the identification of the types of defects in the defect type identification subsystem before progressing on to the wood grading. The substantial research effort made on automating the inspection process in the wood industries such as the detection of defects, defects characterization, identification of defects, wood grading, cutting optimization and the application of sensor fusion. The studies were conducted on timber boards [6]- [20] had not only to be costly but would also involve a long-term process. Some of these examples had included the use of wood structural components (beams and ties) in the construction field because of their high tensile and flexural strengths [21]. An automated optical method in the detection and measurement of decorative plywood panels [22] and the function of a wood dowel in the rotation welding process, where its effectiveness is still being investigated at this point in time [23].
This study had evaluated the wood defect class discrimination from the four variations of the Local Binary Pattern (LBP), namely the Basic LBP, Rotation Invariant LBP, Uniform LBP, and the Rotation Invariant Uniform LBP by way of classification accuracy of a measure comparison method. Although the LBP is widely applied in other research areas, the effectiveness of the LBP technique for accurately detecting the defective wood areas was found to have spurred its use in the timber industry [8][24] [25]. Apart from its better extraction feature [26], the incorporation of a GelSight sensor in the LBP was also found to have increased its defect detection rate on highly detailed surface textures [27]. Its efficacy had been proven by the transverse cross-section images as well as the extracted texture feature vectors that were observed under a microscopy test [9]. bark pocket, rot, split and wane) were thus extracted from each of the wood species. A comparative study method, as suggested by previous research [28] was then conducted between the Basic LBP and the respective Rotation Invariant LBP, Uniform LBP, and Rotation Invariant Uniform LBP under a single resolution condition with a radius R=1 and sampling point sp=8. As shown in Fig. 2, the classification accuracy levels of the constructed feature set would commence with a comparison from those of standard classifiers and follow by the multiple wood species, where the generalization of effectiveness will then be finally evaluated against those of the LBP types.

Basic Local Binary Pattern
The Basic or Fundamental LBP that was used in this research [29] had only utilized two possible values (0,1) rather than the three that had been stated in the previous study [30]. By employing 2 8 = 256 instead of the 6561 texture units, this had therefore implied a more effective use of the basic computing difference measure, where each of the neighborhood grey-level pixels would have respective values of 1 and 0. By using a previous method as mentioned in [29], the RGB image, which had consisted of the red, green, and blue colors with a 24-bit pixel was then converted into a grey image with only 8 bits of the pixel.
At this juncture, the original LBP operator is used to replace the value of the pixels of an image with decimal numbers, which are called LBPs or LBP codes that encode the local structure around each pixel. In a 3 × 3 neighborhood, the comparison of each pixel with its eight neighborhood is then performed by subtracting the center pixel value, where a binary of 1 would denote a positive result and a binary 0 as stating otherwise. Mathematically, the LBP equation can thus be expressed as (1).
where the notation (P, R) refers to the P sampling points of a circle radius, R; the ( , ) being the fixed pixels of the center coordinates; is the grey-value of the center pixel; (i=0,1,…,P-1) as the corresponding neighborhood grey-value of the P sampling points and the − as denoting the P-bit binary number with a 2 distinct values. Hence, the function ( ) or the thresholding function can be defined as (2).

Rotation Invariant Local Binary Pattern
The value of the rotation image is then explored and calculated with the Rotation Invariant LBP [31]. Since the image rotation will induce the movement of the grey values along the perimeter of the circle around with different LBP values being produced from the clockwise rotation of the binary pattern, the lowest value that is derived from the maximum rotation direction of the binary pattern is thus chosen for the calculation purpose. With the patterns also similarly exhibited by those of a cluster form, the rotation invariant of the LBP with the lowest value of the circular bitwise clockwise direction of the x bit sequence by i steps or the ( , ) can thus be identified as (3).

Uniform Local Binary Pattern
As the LBP uniformity is measured by the bit pattern circular rotation with 0-1 or 1-0 transitions [25], the uniformity can, therefore, be identified from the maximum two transitions that had existed in a single binary pattern. I would be considered as otherwise if the number of transitions had exceeded this maximum amount. The calculation of the number of transitions is then obtained to be as such (4).

Rotation Invariant Uniform Local Binary Pattern
Then again, previous research [32] had discovered the rotation invariant LBP (LBPROT) as being constrained by the various 36 patterns frequencies that had been incorporated into the LBPROT and the crude quantization from an angular space that was obtained at a 45° interval.
From the maximum uniform value of 2 that is used in the rotation-invariant uniform patterns and denoted by the superscript 2 , the above equation had thus determined the presence of 9 uniform patterns and 27 as being non-uniformed patterns.

Results and Discussion
In this paper, we have investigated the classification performance of the feature sets by conducting an analysis of its classification accuracy measures. With the accuracy representing the measure of true defects over the predicted defects, this study had therefore aimed to highlight the classification performance of the proposed feature set by first comparing with those of the three standard classifiers, namely the Artificial Neural Network (ANN), K-Nearest Neighbour (KNN) and the J48 Decision Tree (J48). The selection of these standard classifiers had been based on their diverse classification strategies, where the ANN is known to be a function-based classifier and the respective KNN and J48 as focusing on proximity/distance and data categorization.
The detailed classification performance of the proposed feature was again compared with those of the multiple wood species. By using a radius R=1 and a sampling point of sp=8, nine classes (1 clear wood and eight types of wood defects) from the 100 samples of each wood species were thus obtained from the Rubberwood, KSK, Meranti and Merbau dataset that had been extracted from the four LBP types. It is also important to note that the classification experiment had utilized 70% of the training data for each of the datasets per classifier.

Classification performance across feature sets and standard classifiers
The nine classes that had been obtained from the 100 texture images on each of the wood species in the UTeM database, as shown in Table 1 were then converted to a greyscale image of a 60 x 60 resolution. From the four feature sets of the Rubberwood, KSK, Merbau and Meranti that had been extracted with the Basic LBP, Rotation Invariant LBP, Uniform LBP and Rotation Invariant Uniform LBP, 70% of the total images were then randomly chosen from each of the feature set and used as training images, while the remaining 270 images had been employed as the testing data. The average classification accuracy on each of the LBP types that had been obtained from the three standard classifiers, namely the ANN, KNN, and J48, would then be used as the final experimental results.
The classification accuracy results of the different LBP that are shown in Fig. 3, Fig. 4, Fig. 5 and Fig. 6 were found to have similar findings as those seen in the UTeM database. While a significant improvement of the classification accuracy had been observed in both the ANN and KNN. However, the ANN was discovered to have exhibited a better performance at the Basic LBP, Rotation Invariant LBP, and Uniform LBP. Hence, suggesting the 65.4% classification rate from the Uniform LBP as showing the highest accuracy rate as compared to the other LBP groups.

Classification performance across LBP variants
The proposed work is evaluated using F-measure. The samples in the data are divided into 70% for training, and 30% for testing. F-measure is a benchmark metric. It measures the image classification and segmentation accuracy by combining the values of both Precision and Recall.
In Table 2, for ANN classifier provides good results compared to KNN and J48 Decision Tree.

Conclusion
The paper had presented a classification approach to wood defects. The Basic LBP, Rotation Invariant LBP, Uniform LBP, and Rotation Invariant Uniform LBP would be first extracted from 900 samples of different wood defects and categorized with the use of the ANN, KNN and J48 classifiers. Apart from showing the Uniform LBP as consistently achieving the highest level of classification accuracy, the ANN classifier was also found to have successfully classified 65.4% of the wood defects. Since this research had only used a small number of parameters, the incorporation of additional parameters for improving the efficiency of wood defect classification can thus be considered as part of the future work in this study.