Identification of wood defect using pattern recognition technique

Before introducing AVI in the wood industry, a normal inspection process would require human operators to visually inspect the timber to locate and identify the timber defects. The interpretation of the human operator on the timber defects would then determine how the timber defects are categorized, either as permissible or non-permissible. Nonetheless, human operators in the wood industry are usually tasked with the examination job, but due to tiredness and boredom, in the long run, their performance are usually unsatisfactory. A study had shown that three-quarters of the decision made by human operators are inaccurate, which leads to an absolute yield loss of roughly 16.1% from an overall yield of 63.5% to a lower yield of 47.4% [1]. On the contrary, Automated Vision Inspection (AVI) was being highlighted as one of the solutions to ensure the constant reliability of the product and at the same time cater to the current arising issues which resulted in the loss of the yield due to poor accuracy inspection done by human operators. This study attempts to refine one pattern recognition technique suitable for detecting nine defect types from four wood species, namely Rubberwood, Kembang Semangkuk (KSK), Merbau, and Meranti. Besides that, the study also tries to determine the relevance of using a neural network as a classification model in detecting wood defects. Aside from that, the parameters used for a neural network model could be used as a key reference on other standard classifiers. ARTICLE I NFO ABSTRACT

In addition, research by Kamal et al. [4] using gray level co-occurrence matrix-based features with laws texture energy measures based features by taking contrast, correlation, energy, and homogeneity as input parameters to a feed-forward back propagation neural network to predict wood defects. Their work managed to obtain overall average classification accuracy of 90.5%. Besides that, a similar study was done by comparing neural network training speed and classification accuracy in searching for the best neural network models for identifying defects on the wood surface. The researcher found out that the highest overall accuracy of 80.6% was achieved using the ResNet152 pre-trained model, followed by the AlexNet model, which achieved an average accuracy of 80.2% [5]. On the other hand, [6] suggested a study for detecting wood knots based on a transfer residual neural network TL-RESNet-34 that successfully identified knot defects with a 98.69 percent accuracy on decayed knots, dry knots, and other five kinds of wood knots. Apart from that, a study on neural network training algorithms in detecting wood surface defects done by Thilagavathi et al. [7] found out that Bayesian regularization training algorithms can achieve an f-score of 94.6% in detecting wood surface defects. It compared to other training algorithms such as levenberg-marquardt, scaled conjugate gradient, gradient descent with adaptive learning rate and resilent backpropagation. Aside from that, there is also a study related to Minimum Distance Classifier (MCD) and wrapper-based method with Bees algorithm with at least 10% improvement in its accuracy performance in the training and test set when the proposed wrapper-based method was used in conjunction with the Bees algorithm to select a subset of features [8].
For the non-segmenting approach, a few classifiers were implemented throughout the research, including chi-square classifier, pairwise classifier, decision tree, Bayesian classifier, and Support Vector Machine (SVM) [9]. One research in the non-segmenting approach uses SVM as a classifier to detect a wood defect and compare the result with other classifiers such as J48, random forest, and KNN classifier. The highest classification rate was achieved by combining GLCM and SVM poly with 81.96% for correct classification rate and 82% for true positive rate [10]. Furthermore, an experimented-based study on solid wood board growth defects and biohazard defects using the depth extreme learning machine model by combining the deep learning feature extraction method and extreme learning machine (ELM) classification method shows that the SVM classifier can obtain a 91.55% accuracy rate [11]. Meanwhile, Sandak et al. [12] suggest that the best performance of wood defects discrimination was by using modeling spectra acquired with microNIR spectrometer and SVM classifier. The suggestion had a success rate of 91%. Although the performance of both segmenting and non-segmenting approaches are almost identical, there is a difference of 2.4% accuracy on both classifiers when they were fed with statistics calculated data from amplitude, attenuation, time of flight, and frequency of thermally modified timber (TMT). The result shows that KNN obtained 76% accuracy in detecting crack area of TMT compared to SVM, which only has 73.6% accuracy [13]. In addition, another study showed that the use of Mahalanobis one class classifier (MC), with Fast Minimum Covariance Determinant estimator (MC-FMCD) in wood defect detection across four types of timber species and eight various types of wood defects, had an average detection accuracy of 79% [9]. Table 1 shows previous related research that was done on wood defect classification.
Hence, motivated by the previous finding on wood defect classification using machine-learning approaches, our research focused on developing a classification model for timber defect classification based on the neural network while determining appropriate parameters for the neural network model in optimizing defect identification performance. Additionally, a classification performance comparison between multiple species and other standard classifiers will also be conducted. Substantial evidence in previous researches showed that ANN is widely used and performed well on other wood-based products. Similarly, we anticipated that the neural network model would perform well on our dataset, which consists of nine types of wood defects across multiple wood species.

Method
The cross-industry standard process for data mining (CRISP-DM) would be research methodology used for the proposed timber defect classification approach, which is potent in identifying multiple defects on multiple timber species using a pattern recognition technique. CRISP-DM is usually implemented as it involves the process model for data mining that outlines the commonly used approaches by data mining experts to tackle problems. This section further discusses the operational framework, which provides an overview of classification approaches used in identifying defects across the multiple timber species using a pattern recognition technique.
The operational framework in Fig. 1 shows that the process of identification of timber defect is an extension from the defect detection phase produced using robust Mahalanobis one class classifier (MC) with Fast Minimum Covariance Determinant estimator (MC-FMCD) [33]. The overall process of the operational framework begins with the acquisition of surface images of selected timber, where those images are then converted to greyscale. Then, those greyscale images of the timber surface would be divided into sub-images with 60x60 pixels for the statistical features extraction based on orientation independent GLDM at a later stage. The feature vector would then be used as input for the MC-FMCD classifier, where the classifier would label whether the images are categorized to be a defect or clear wood. The defect images would then require various recognition techniques under the research of this study International Journal of Advances in Intelligent Informatics ISSN 2442-6571 Vol. 7, No. 2, July 2021, pp. 163-176 to identify the nine types of wood defects, namely pocket, knot, split, check, blue stain, brown stain, hole, wane, and rot.

Results and Discussion
This section aims to identify the appropriate parameters for the neural network model in optimizing defect identification performance, beginning with a comparison between multiple hidden layer types with the multiple numbers of epochs in the neural network classifier across the four types of wood species. Next, the comparison was made between the best performing scenario in a neural network with other standard classifiers such as Naïve Bayes, K-Nearest Neighbour (KNN), and J48 Decision Tree (J48). The classifiers were selected based on their classification strategies, whereby Naïve Bayes is based on class conditional independence (eager learner), KNN is based on proximity/distance (lazy learner), and J48 is based on data categorization (eager learner) [38]. In addition, the detailed classification performance for each dataset was analyzed to reveal the best classifier in identifying the wood defects across the multiple timber species. Finally, a T-test was performed on the top three performers based on a hidden layer type in the neural network classifier across the multiple timber species. Subsequently, the same test was conducted across the hidden layer type throughout the Meranti, Merbau, KSK and Rubberwood datasets. Besides that, we also used the Analysis of variance (ANOVA) to test the classifier's performance between multiple species and other standard classifiers. For this classification experiment, we used cross-validation with 10 folds and 20 repetitions, representing 200 runs for each dataset per classifier.

Data Preparation and Normalization
The samples for timber defect images were obtained from UTeM's database [32], which consisted of four types of wood species (Rubberwood, KSK, Meranti, and Merbau). The datasets are made up of 3091 samples across the four different wood species and nine types of defects: Clear Wood, Pocket, Blue Stain, Brown Stain, Hole, Knots, Split, Wane, and Rot. For better data representation, the timber surface images were converted into greyscale images before they were divided into sub-images with the size of 60x60 pixels. These sub-images statistical features were then extracted based on the orientation independent Grey Level Dependence Matrix (GLDM), which consists of several processes such as performing Equal Probability Quantization (EPQ) and selecting the displacement. Based on [39] [32], the feature set with displacement parameter, d<5, and quantization level, q=32 was claimed to be the optimal value as it represents almost similar texture information with other higher quantization values. Finally, the dataset will be going through a normalization process that converts all datasets on the same scale ranging from 0 to 1 to ensure standardized features value weights all implicitly features equally in their representation.

Neural Network Parameters: Hidden Layer Wildcard and Epochs
Artificial Neural Network (ANN) consists of several parameters, such as the number of nodes and epochs. In this study, we manipulated the number of nodes in the neural network classifier followed by the number of epochs searching for the highest F measure across four types of wood species. For the number of nodes in the neural network, we used several types of wildcard values that exist in the machine learning software known as the Waikato Environment for Knowledge Analysis (Weka). In Weka, the wildcard value for the hidden layer types consists of four which are "a", "i", "o", and "t". Each value type represents a different formula to calculate the number of units in the hidden layer. Referring to our Rubberwood, KSK, Meranti, and Merbau datasets, there were a total of 20 attributes with nine classes, which represent nine types of wood defects. Table 2   A total of 128 test cases were tested across the hidden layers "a", "i", "o", and "t" with the different number of training times ranging from 1 to 2000. It is expected that higher training time would provide a better result in term of F-measure. Fig. 2 illustrates the F-measure for hidden layer "a" classifier increased with the number of epochs throughout the experiments, with some fluctuation in performance after epoch 200. The classification shows the highest F-measure recorded at 0.7780 (epoch 200), while the lowest performance for the neural network classifier was recorded at 0.0403 (epoch 1), where it proves the theory that more training time would increase the F-measure of the neural network. The differences between the highest and lowest F-measure were recorded at 94.8%, which shows an improvement in F-measure across the training time. For hidden layer "i", the highest F-measure was recorded at 0.7749 (epoch 300), and the lowest F-measure was recorded at epoch 1 where the score was valued at 0.0457. As we can see, there is a difference of 94.10% between the highest and lowest F-measure recorded during the experiment. On the other hand, we managed to record the highest F-measure during the epoch of 300 with a score of 0.7507 for hidden layer "o". The difference between the highest F-measure and lowest F-measure recorded based on the training time is 94.4% which is slightly better compared to the hidden layer "i". Finally, hidden layer "t" recorded the lowest F-score at the epoch 1 with a score of 0.0483. In contrast, the highest F-measure was recorded at 0.7839 (epoch 200) with a difference of 93.8% between the highest and the lowest recorded F-measure across the training time, which are also the worst differences being recorded among the four types of hidden layers "a", "i", "o", and "t".  Fig. 2. F-measure versus training time across hidden layer "a", "i", "o" and "t" in rubberwood

KSK
For KSK dataset, a line graph was plotted for hidden layer "a" based on the F-measure recorded for each training time as shown in Fig. 3. The highest F-measure was recorded at epoch 500 (F-measure 0.8225) while the lowest F-measure was recorded at epoch 1 (F-measure 0.0430). The F-measure percentage difference recorded by the ANN classifier for the highest and lowest F-measure was at 94.8%. This shows that there is a huge gap between the highest and lowest F-measure recorded. Next, the lowest F-measure was recorded at epoch 1 with the score of 0.0432 for the hidden layer "i". Meanwhile, the highest F-measure was achieved by epoch 400 with the F-measure of 0.8373. There is a massive gap between the highest F-measure and lowest F-measure, with a difference of 94.8% among them. Although there is a huge gap between them, the percentage of difference is identical with the hidden layer "a" which also has a gap of 94.8%. Fig. 3. F-measure versus training time across hidden layer "a", "i", "o" and "t" in KSK In addition, hidden layer "o" shows that epoch 600 managed to score the highest F-measure with a value of 0.7984, followed by the lowest F-measure were recorded at epoch 1 (F-measure 0.0346). The difference between the highest and lowest F-measure is recorded at 95.7%, the highest compared to hidden layer "a" and hidden layer "i" in KSK wood species. Finally, hidden layer "t" recorded the lowest F-measure at epoch 1 with a value of 0.0441. Meanwhile, the highest F-measure was recorded at epoch 400 with a score of 0.8401. For the difference in percentage among the highest and lowest F-measure, the hidden layer "t" managed to obtain a value of 94.8%, which is similar to the percentage difference of hidden layer "a" and hidden layer "i" but lower compared to hidden layer "o" for KSK wood species.

Meranti
Referring to the line graph in Fig. 4, the lowest F-measure for hidden layer "a" was recorded during epoch 1 (F-measure 0.0360), while the highest F-measure was recorded by epoch 400 (F-measure 0.7395. The difference in highest and lowest F-measure recorded throughout the training was at 95.1%, which also shows that training time plays a vital role in ensuring the F-measure of the neural network classifier. Moreover, the training time at epoch 500 for hidden layer "i" managed to achieve the highest F-measure with a score of 0.7431, followed by the lowest F-measure was recorded by epoch 1 with a score of 0.0306. The percentage difference of F-measure among epoch 1, which is the lowest, and epoch 500, which is the highest, is set at 95.9%. In contrast, hidden layer "o" recorded the highest F-measure during epoch 1000 (F-measure 0.7305). Besides that, epoch 1 recorded the lowest F-measure with a score of 0.0295 with a difference of 96.0% between the highest F-measure and lowest F-measure achieved in this hidden layer "o". Lastly, hidden layer "t" achieved the highest F-measure at epoch 400 (F-measure 0.7579), and the lowest F-measure was recorded by epoch 1 (F-measure 0.0317). There is a difference of 95.8% between the highest F-measure and lowest F-measure achieved in this hidden layer "t". . 4. F-measure versus training time across hidden layer "a", "i", "o" and "t" in meranti 3.6. Merbau Fig. 5 shows the neural network classifier performance across multiple epochs in hidden layer "a", "i", "o", and "t". For hidden layer "a", the top highest F-measure were recorded at epoch 2000 (Fmeasure 0.7174), and the lowest F-measure recorded was at epoch 1 (F-measure 0.0466) with a huge gap between the highest F-measure and lowest F-measure at a difference of 93.5%. In hidden layer "i", the lowest F-measure was recorded during epoch 1 (F-measure 0.0520). On the other hand, the highest F-measure was recorded at epoch 2000 (F-measure 0.7329). The highest and lowest F-measure in hidden layer "i" shows a difference of 92.9% where the score of F-measure increased with the number of training time. Nonetheless, the highest F-measure in hidden layer "o" was recorded at epoch 2000 (F-measure 0.6949). Meanwhile, the lowest F-measure was recorded at epoch 1 (F-measure 0.0492). There is a huge gap between the highest and lowest F-measure with the percentage difference of 92.9%, which is similar to the percentage difference of hidden layer "i". Finally, hidden layer "t" recorded highest F-measure at epoch 2000 (F-measure 0.7408), followed by the lowest F-measure was recorded by epoch 1 (F-measure 0.0537). There is a huge gap in F-measure between epoch 2000 and epoch 1 with a 92.8% difference, which proofed that F-measure increased along with the number of training times. In addition, the percentage difference for hidden layer "t" is the lowest among the four hidden layers, with hidden layer "a" scoring the highest percentage of 93.5%. Fig. 5. F-measure versus training time across hidden layer "a", "i", "o" and "t" in merbau

T-Test on Top Three Performers in Hidden Layer "a", "i", "o" and "t" across Timber Species
An independent t-test was conducted to compare the significant difference of classification among the top 3 highest F-measure in four types of hidden layer across the wood species. Thus, the result of the independent t-test across multiple hidden layer and wood species shows that the top three performers in each hidden layer type across the wood species are not statically significant. In other words, this means that to save time and computational cost, the researcher could use the lowest epochs in Table 3 for faster defect detection without compromising on the F-measure. Table 3. T-Test on Top Three Performers in Hidden Layer "a", "i", "o" and "t" across Wood Species

Evaluation of classification performance over hidden layer type across multiple wood species
In this section, we visually and statically analyzed the performance of the neural network classifier in terms of its hidden layers and also the number of epochs across multiple species of timber. We compared the neural network classifier performance on multiple hidden layers across the multiple wood species, beginning with a comparison of F-measure between hidden layers "a", "i", "o" and "t" with Rubberwood species, followed by KSK, Meranti, and Merbau as shown in Fig. 6. The purpose of the hidden layer analysis is to analyze the performance of the neural network classifier performance for each hidden layer by gathering all the F-measure recorded throughout the experiment, consisting of multiple hidden layers and training times across the wood species. For rubberwood, we can see the F-measure for every hidden layer increase along with the number of epochs with hidden layer "t" scored the highest F-measure across all four hidden layers. On the contrary, the hidden layer "o" was the worst-performing hidden layer with the least F-measure across the training time. Although hidden layer "t" was the best performing hidden layer, we notice that the hidden layer "i" outperformed the rest of the hidden layers during the epoch 5 to 17. On the other hand, in KSK hidden layer "t" was the top performer among four hidden layers with the highest F-measure, followed by hidden layer "i", hidden layer "a", and lastly, hidden layer "o". Similar with the Rubberwood species, the hidden layer "i" seemed to outperform other hidden layers during epoch 5 to epoch 11. However, hidden layer "o" was still the worst performer among the hidden layer, similar to the Rubberwood species. Next, a further investigation on the hidden layer analysis was performed on the Meranti wood species where hidden layer "o" scored the lowest compared to other hidden layers, followed by hidden layer "i" and hidden layer "a". Apparently, the hidden layer "t" scored the highest among the other hidden layers along with multiple training times with some exceptions where hidden layer "a" managed to outperform others during the epoch 4 with F-measure 0.2676. Lastly, we conducted a hidden layer analysis on the Merbau wood species to find the best performing hidden layer for the neural network classifier. Results show that hidden layer "t" outperformed the other hidden layers, with the highest Fmeasure recorded at 0.7408. The worst performing hidden layer was the hidden layer "o" with the Fmeasure of 0.6949. However, the F-measure of hidden layer "o" managed to outperform other hidden layers during epochs 7 to 13 with an F-measure of 0.4993.

International Journal of Advances in Intelligent Informatics
ISSN 2442-6571 Vol. 7, No. 2, July 2021, pp. 163-176 Besides that, a comparison was made between the best-performed epochs for each hidden layer across the multiple wood species in search of their significant differences as shown in Table 4. An independent t-test was being performed in Rubberwood species to test the significance of every top performer among the hidden layers with hidden layer "o", which scored the lowest F-measure among the hidden layers, being selected as the baseline schema. The result shows that they are statically similar among all four and we could use hidden layer "a" or "t" with epoch 200 for future research, which consumes less computational power. Similarly, among four hidden layers in the KSK dataset, hidden layer "t" outperformed other hidden layers with an F-measure of 0.8401 with the epoch of 400 and the least performed was hidden layer "o" with an F-measure of 0.7984. An independent t-test for F-measure was performed on the top performer of each hidden layer with hidden layer "o" act as baseline schema. The result shows that the F-measure hidden layer "t" is not statically significant compared to others. While in Meranti, hidden layer "t" scored the highest F-measure with 0.7579 in epoch 400. In order to test the significant difference among the top performers in the hidden layer, we conducted an independent t-test with hidden layer "o", which scored the lowest F-measure, being selected as a baseline. The t-test shows that the baseline F-measure is statically similar to the F-measure of hidden layer "t", which scored 0.7579 at epoch 400. Lastly, for Merbau dataset, hidden layer "t" scored the highest F-measure with 0.7408, with the worst-performing hidden layer was hidden layer "o" scoring an F-measure of 0.6949. The t-test result with hidden layer "o" act as baseline shows that performance improvement in F-measure compared to other hidden layers are not statically significant. Since all four top-performing hidden layers in Merbau achieved their highest F-measure at epoch 2000, we could conclude that selecting either hidden layer would be the same without affecting the defect detection accuracy.

Evaluation of classification performance over hidden layer type across multiple wood species
Hence, this section focused on the comparison between the top performing neural network classifier and other standard classifiers such as Naïve Bayes, KNN and J48 Decision tree across the multiple wood species. In addition, the Naïve Bayes, KNN and J48 Decision tree classifiers would be using the default parameter set by Weka. Fig. 7 shows the classification performance of the proposed classifiers (Multilayer Perceptron, Naïve Bayes, KNN and J48 decision tree). The neural network classifier seems to be outperforming other standard classifiers with a minimum performance increase of approximately 2.72% considering the minor gap between the ANN classifier and J48 classifier in Rubberwood species. Besides that, the highest performance increment in the neural network classifier was noticed in the Merbau wood species where there is approximately 25.19% in difference compared to other standard classifiers. Among the four classifiers compared, the Naïve Bayes classifier was the worst performing classifier in identifying the F-measure across the multiple wood species. Meanwhile, KNN and J48 Decision Tree 173 Vol. 7, No. 2, July 2021, pp. 163-176 classifiers had an average performance, with some having a better F-measure in certain wood species and vice versa.

Fig. 7. Classifiers performance on multiple timber species
An independent analysis of variance (ANOVA) was conducted to compare the significant difference of classification F-measure across the multiple wood species. The one-way ANOVA is usually used to determine if there are statically significant differences between the mean of three or more unrelated groups. Based on Table 5, the neural network classifier was tested with other standard classifiers in a one-way ANOVA test to find the statistically significant F-measure differences between the independent groups. The results prove that F-measure performance of the neural network classifier are statistically significantly better compared with other standard classifiers across the multiple wood species. In addition, it also means that we accept the alternative hypothesis (HA), which proves that there are at least two group means that are statistically significantly different from each other.

Conclusion
This research proposed a classification model for timber defect classification based on neural network, determining appropriate parameters for a neural network model in optimizing defect identification performance and comparing the classification performance between multiple wood species and other standard classifiers. The proposed neural network has outperformed the other standard classifiers in Fmeasure across the multiple timber species. The neural network classifier is better than other standard classifiers with an F-measure of 0.8401. It can be seen that there is an increment in the neural network classifier performance with at least 2.72% to a maximum of 25.19% compared to other standard classifier performances among the multiple timber species. This also proves that the neural network classifier can handle the imbalanced datasets without affecting their performance. Furthermore, we also tested the performance of the neural network by manipulating the number of nodes in a hidden layer using the wildcard values set by the Waikato Environment for Knowledge Analysis (Weka) such as "a", "i", "o" and "t". Each hidden layer wildcard value represents a different number of nodes existing in a hidden layer, with hidden layer "t" showing the best performance in both hidden layer wildcards and also across the multiple timber species. The higher performance in hidden layer "t" is due to the higher number of nodes used in the hidden layer than the other hidden layer wildcards. Thus, it is important to note that the number of nodes in a hidden layer plays an important role in determining the performance of the neural network classifier. In addition, the performance of the neural network classifier was tested with multiple numbers of Epochs (training time) across the multiple hidden layers and timber species. Throughout the experiment, every hidden layer and wood species were tested with a number of epochs ranging from 1 to 2000, and our results show that the neural network classifier performed the best during epochs 200 to 600 by having the highest F-measure across the hidden layer wildcard and multiple timber species except for the Merbau species which had the highest F-measure during epoch 2000.
Although the highest F-measure was achieved during epoch 2000 in the Merbau species, we can conclude that the performance of the neural network classifier (F-measure) is not directly proportional to the number of epochs. To conclude, although the findings of this study are encouraging, there is still a lot of work to be done in the areas of timber defect detection, especially in finding the appropriate parameters for the neural network model to improve the defect detection performance. In this study, the search in optimizing defect identification performance is limited to the number of nodes in a hidden layer and the number of epochs in the neural network classifier. In order to improve the performance across multiple wood species, we suggest extending other parameters such as the number of hidden layers and the neural network classifier's learning rate. Finally, the neural network classifier could potentially identify wood defects in the wood manufacturing industry.