Traditional nondestructive testing technology for wood defects has a series of problems such as low identification accuracy, high cost, and cumbersome operation, and traditional testing methods cannot accurately show the specific location and size of wood internal defects; it is urgent to explore a new nondestructive testing scheme for wood defects. Aiming at this problem, this paper designs and develops an automatic detection method for wood surface defects based on deep learning algorithm and multicriteria framework. By comparing the performance of different deep learning detection methods on the data set, the advantages and disadvantages of the detection method in this paper are proved. After a series of works, such as the development and optimization of the experimental algorithm, the algorithm proposed meets the requirements in both the detection accuracy and training time.

1. Introduction

As a country occupying huge forest resources, China’s vast land has many rare wood and endless ancient trees worth our protection [1]. In recent years, China’s productivity has developed rapidly, the economy has been improving at a high speed, the demand for all kinds of different resources is increasing, the consumption of resources has increased sharply, and the demand for wood resources is growing rapidly. Wood resources play an indispensable role in the development of various fields in China. Therefore, how to improve the effective utilization rate of wood, ensure the sustainable development of forest resources, and reduce the necessity of felling trees is very important [2].

Wood nondestructive testing technology has become more and more popular because of its important research significance and the application potential in the protection of ancient and famous trees and the utilization of wood resources. Compared with the traditional destructive detection technology, its nondeformation advantage breaks through the shackles of the measured wood shape and size, and it can be widely used in ancient buildings, wood detection, ancient and famous tree protection, urban forestry, wood processing, and other fields [3]. These factors will increase the production cost of wood-processing enterprises; reduce the mechanical properties of wood, appearance quality, and wood utilization rate; and consume a lot of wood resources [4]. However, the above works may be affected by the subjective factors, which will eventually affect the detection effect of defects.

Therefore, in order not to be affected by the subjective factors of workers, machine vision and intelligent recognition technology are used to replace artificial vision to detect wood defects, and wood intelligent processing equipment is designed to integrate wood defect feature recognition and intelligent sorting and other functions, which can improve the wood production efficiency and reduce the production cost of enterprises [5]. Ensuring the maximum yield of wood plays a very positive role. For nearly half a century, wood nondestructive testing technology, as a new technology with high value and wide research, has made a qualitative leap in the 21st century. Wood nondestructive testing technology is usually used to detect wood and the internal defects of wood imaging with the aid of the naked eye, ultrasonic, stress wave, ray, infrared, and computer so that the detection personnel can intuitively understand the internal defects of wood. It can be known that there are more than 20,000 ancient and famous trees in Hangzhou alone, among which, 12,000-year-old ginkgo and 1500-year-old osmanthus require nondestructive testing of wood so as to make timely protection and treatment [6]. To sum up, the practical application scenarios of wood nondestructive testing technology are abundant.

Based on the above analysis, at present, the detection and classification of wood defects in China mainly rely on manual selection [7]. This method is susceptible to subjective factors, so it is difficult to meet the needs of high-precision defect detection in the actual generation process. In addition, the human cost is getting higher and higher, resulting in higher cost of wood processing the standard cannot be unified, the actual detection classification is difficult to ensure enough accuracy, and it is urgent to take more ideal solutions to overcome the current problems. Therefore, in order to improve the efficiency of wood defect detection, machine vision and deep learning technology are used to replace artificial vision for wood defect detection. Based on high-tech support, it can not only improve the efficiency of wood processing but also help enterprises save production costs and reduce the input of human resources. Through this research, the purpose is to put forward a fast detection speed, high detection accuracy of solid wood panel defect detection algorithm, reduce the cost of wood-processing enterprises, improve the efficiency of wood defect detection, and improve the degree of automation of wood-processing enterprises [8].

On the other hand, due to the development of computer hardware technology in recent years, especially the upgrade of GPU, the efficiency of computing and image processing has been greatly improved. Among the advanced methods, the convolutional neural network (CNN) represents deep learning. Practical application scenarios are image recognition, natural language processing, and speech recognition. The traditional manual detection is limited to the subjective cognitive of people. When different people detect the same piece of wood and identify the defects of wood, the size and location of the defects will be determined, resulting in different results [3]. And manual detection requires a long time, the detection of manpower and material resources are too large, and this detection method has been slowly eliminated with the development of the era. Image recognition using deep learning does not need to carry out the complex process of manual feature extraction but can completely carry out feature extraction and recognition from the input image end to end, which greatly liberates manpower. Moreover, the feature of autonomous learning is no less than that of manual feature extraction by experience, and the recognition effect is better [9].

2.1. Research Status of Wood Nondestructive Testing Technology

Wood nondestructive testing technology can detect wood defects without destroying the original state of wood, and quickly and correctly identify the required wood defect target information, which can be used as the theoretical basis for intelligent detection of wood defects. Nondestructive testing of wood defects can automatically classify wood raw materials, improve the intelligence and automation of the whole production line of wood-processing enterprises, and bring economic benefits to wood-processing enterprises [10].

Jayne was the first to hypothesize the feasibility of nondestructive testing in wood [11]. The wood industry technology of some developed countries such as Europe and the United States developed rapidly in the 1950s and benefited from the social environment at that time. When some technology can reduce the loss of wood resources and improve production efficiency, it will be paid great attention to by relevant practitioners, and nondestructive testing technology can be used with wood from this. The authors of [12] used a stress wave timer to accurately calculate the propagation speed of stress waves between healthy and decayed trees during the experiment. The calculation results showed that the propagation speed of stress waves between healthy and decayed trees would be greatly reduced if there were certain cavities or decayed trees in the sample. The authors of [13] dissected the propagation path of stress waves over wood faults and found that stress wave technology has very high research significance in the field of wood detection. In response to this discovery, stress wave imaging technology was discussed in 2000. The authors of [14] and other experts focused on analyzing the influence of different number of sensors and different distribution of sensors on experimental samples on stress wave monitoring of wood internal defects.

The authors of [15] used principal component analysis to reduce the dimension of wood spectral data and established a backpropagation (BP) neural network model processing data and classification and identification of wood species. The more the tree species, the higher the identification accuracy. The authors of [16] designed Gabor filter and extracted Gabor feature parameters of wood defect image segmentation based on multidirection filtering results. The segmentation accuracy rate was 98.29%, which was better than the segmentation method based on the gray level co-occurrence matrix. The authors of [17] combined the Gabor filter method with wavelet transform to identify the grayscale images of wood defects and introduced the multichannel Gabor filter, which could identify wood defects under the interference of complex background. The authors of [18] used principal component analysis to reduce the dimension of extracted features which can effectively identify and locate defects of complex inner holes. The authors of [19] input five features including the first three features of local binary mode and Tamura texture together with the entropy feature of gray co-occurrence matrix into the classifier of the support vector machine, and the recognition accuracy is 91.67%, which is better than that of BP neural network classifier, and the recognition accuracy of BP neural network is 82.75%. The authors of [20] used the improved Grab Cuts algorithm for optimization to solve the problems of the image under segmentation and easy interference by regional texture in the traditional algorithm. The authors of [21] proposed a method to detect wood defects based on the gray histogram. The identification of wood defects relies on color mutation, and defect images can be effectively differentiated, but the specific type of wood defects cannot be determined. To solve this problem, the authors of [22] divided the image into subgraphs of the same size. The accuracy of segmentation is 95%. The BP neural network has good convergence, but the training time is slow, the defect recognition rate is low, and the sample demand is large. In terms of training time and recognition rate, SVM is superior to the BP network, and when the number of selected samples is not large, SVM can also achieve high accuracy in defect classification. The authors of [23] used wavelet transform to extract multidimensional feature vectors of wood defect images as vector input of BP and SVM neural network and carried out classification and recognition through these two kinds of classifiers. Because of the high feature dimension of samples, the support vector machine is more advantageous. The accuracy rate reached 93.3%. The authors of [24] proposed an Otsu method, which used the weighted variance threshold method to detect wood surface defects.

Reference [25] used principal component analysis to detect wood defects, and the results showed that this method was applicable and reliable to identify wood defects. Ondrejka et al. [26] developed an algorithm framework based on deep learning, established a convolutional neural network composed of eight layers of networks for feature extraction, and extracted wood surface defect features from a deep learning network model, thus improving the detection efficiency and classification accuracy of wood defects. Reference [27] used histogram threshold method to segment images, extracted wood defect characteristic values by principal component analysis, and improved classifier by extreme learning machine algorithm combined with AdaBoost algorithm to improve the detection accuracy of wood defects and effectively classify wood defects. The authors of [28] were the first to put forward the theoretical formula of log axial stress wave propagation, namely, displacement, velocity, stress, and strain equations. It was found that the stress wave propagation time and velocity were positively correlated with the wood elasticity, modulus, and length. Reference [29] used Arbotom stress wave detection system to detect the internal decay of wood logs of tree species in the northeast forest region, developed a stress wave nondestructive testing device based on a digital signal processor, and carried out practical testing on wood disks. Reference [30] used a method based on stress wave to reconstruct the structure of internal defects of wood, which could analyze the internal mechanism connections of wood and judge the types of internal defects by using the gray model. Reference [31] proposed an image reconstruction method based on the segmental propagation lines of the stress wave. The method uses sensors to capture stress wave velocity data by hanging uniformly around the wood. Thus, the defect images inside the wood can be reconstructed according to the visualization method. The algorithm is based on precisely dividing light to facilitate spatial interpolation. Then, the image simulation and experimental data of reconstructed wood internal defects are used to evaluate the method [32]. Meanwhile, the comparison of the area and shape of the image results shows that the proposed method can produce high-quality reconstruction with clear edges and high precision.

2.2. Research Status of Deep Learning and Multicriteria Framework

As a branch of machine learning, deep learning is gradually transitioning from shallow learning to deep learning. Deep learning is the nature of some deep web by means of nonlinear information processing mechanism, the training mode of combining to implement feature extraction and feature conversion of sample information, and finally with the help of the distributed feature representation to complex data relationship between fitting samples [33]. Deep learning can realize the fitting of observed samples and the continuous approximation of complex functions so as to learn the essential characteristics of conceptualization in data. Its advantages over the shallow learning model lie in its strong generalization performance and effective representation of complex functions when dealing with complex classification problems [34]. However, deep learning is not a new concept. Deep learning theory is the product of neural network development to a certain extent. Since the 1960s and 1970s, researchers in some developed countries have begun to try to use computers to help people understand the world they see and have achieved abundant scientific research results. Therefore, the neural network did not flourish and experienced a cold winter period until the arrival of the 1990s, when LeCun applied the BP algorithm to the neural network, greatly improving the training speed of the traditional neural network. At the same time, the Lenet-5 network structure for handwritten digit recognition proposed by LeCun brought convolutional network into practical application for the first time [35]. Nevertheless, the shallow layer was still the mainstream of neural network at that time.

Based on the above discussions, the contributions of this paper are given as below:(1)This paper is the first to integrate multiframe criteria into deep learning for defect detection of wood quality(2)In this paper, deep learning is used to better extract wood features so as to improve the quality defect detection accuracy of the model.

3. The Proposed Wood Quality Defect Detection Method

Due to the shallow network layer and the use of linear activation units, the early artificial neural network models are often unable to solve complex problems. So, in recent years, the convolutional neural network model is often used to solve complex image recognition problems. On the basis of the traditional full-connection layer neural network, the convolutional neural network adds a convolution layer and pooling layer, and its core ideas mainly include local connection weight sharing and pooling. The model structure of the convolutional neural network is shown in Figure 1, which consists of input layer, convolutional layer, pooling layer, fully connected layer, and output layer. In addition, the depth of the network layer can be increased by increasing the number of convolutional layer, pooling layer, or full connection layer. In general, the convolutional layer and pooling layer can be designed alternately.

The function of the convolution layer lies in the extraction of image features. The essence of the convolution kernel is a filter matrix, which can produce many different effects on the original image. The calculation process of convolution is shown below:

Then, the mathematical expression of sigmoid function is

The mathematical expression of tanh function is

The mathematical expression of ReLu function is

In addition to the above activation functions, another common activation (LeakyReLu) function is as follows:

The pooling layer is the lower sampling layer. After the pooling layer is pooled, the size of the original feature graph will be reduced and too much original feature graph information will not be lost. Therefore, the efficiency of the entire network operation can be improved to a certain extent. In addition, the pooling operation can maintain translation invariance within a certain range. Assuming that the original region size is , the pooling operation is to calculate a value of the four values in the region according to certain rules.

The output layer adopts softmax function to normalize, and the probability value in the corresponding category is shown in the following formula:

In classification tasks, it is a common method to use cross-entropy loss function to evaluate the gap between the predicted value and true value. The cross-entropy formula is as follows:

The error calculated from the cross-entropy function needs to be calculated by backpropagation so as to realize the newer backpropagation of model parameters. The original form of the gradient descent method is shown in the following formula:

In the experiments of the following chapters, this paper also verifies that the use of Adam has faster convergence than SGD. The mathematical expression of a common Adam optimizer is as follows:

Therefore, the updating rule of gradient descent is as follows:

Based on equations (1)–(11), Figure 2 gives wood quality defect detection based on the deep learning and the multicriteria framework proposed in this paper.

4. Experimental Results and Analysis

4.1. Introduction to Experimental Data Set

To ensure the accuracy and effectiveness of the research conclusions, all the experimental wood of this project is strictly selected by the workers of a company, and the fir wood picture with a size of is used. The size of images collected by the image acquisition system is (width, height, and the number of channels), including wood photos and scanning background. In order to improve the quality of the data set and ensure the credibility of the experimental results, the number of images in the wood data set was expanded by rotating and magnifying the images as well as water and vertical mirror processing.

As shown in the figure, 2838 solid wood images were finally obtained, among which 612 were wood images without defects and the rest 2226. Each image contains one or more defects. Among these defect images, 846 are live nodule images, 760 are dead nodule images, and 620 are crack images. LabelMe software is used to annotate the defective wood pictures in the data set. LabelMe is written in Python language and uses Qt as the image annotation tool of its graphical interface. In practical application, LabelMe can perform polygon annotation and output data sets in COCO format, and its segmentation function is helpful to obtain defect masks in data set images from images.

4.2. Experimental Results Analysis

When selecting the void, the two points input by the user are embodied as the points on the center of the defect circle and the circumference of the defect so as to determine the position and size of the defect on the coordinate axis, and the white circle is represented in the painting area so as to distinguish it from the gray background. At the same time, the right display area shows the final feature matrix diagram and can be saved to a preset path to select similar cracks and defects flow.

The function menu in the upper left corner of the program has the function of clearing and saving (Figure 3). Among them, the clear function is mainly used to clean the painting area and the display area of the image, restore the initial state, in order to facilitate the user to work again, and avoid the trouble of repeatedly opening the program. In the save function, the feature matrix image of the display area is saved in PNG format to a preset path by the system. Meanwhile, each feature matrix image is annotated in XML format in the directory.

The detection model in this paper has a certain relationship between the cross ratio of internal defects of wood and the classification of internal defects of wood. The cross ratio of cracks (Figure 4(a)) and decay (Figure 4(b)) is lower than that of voids (Figure 4(c)), which conforms to the classification rules of the classification model. In conclusion, the detection effect of the location and size of internal defects in wood is also good. The ability of the generated recognition model to judge whether there are internal defects in wood is 99.8% on the test data set, the average IOU obtained by the model detection is 74.3%, and the maximum center offset is less than 1%, which has certain application value.

CNN model is used to fine-tune the full connection layer of the model, retain the parameters of the convolution layer, and then conduct training and testing. As the number of iterations of the model gradually increases, the total loss value presents a downward trend on the whole and converges after a certain number of iterations.

In this paper, 100 images of live node, dead node, and worm eye were used for the gravity center positioning test. The specific results of the test are shown in Figure 5. It can be seen from Figure 5 that the algorithm in this paper can accurately locate all kinds of defect types of wood, and the results can meet the actual needs. The average error between the final center of gravity positioning and the manually measured center of gravity extraction is between (−1.10 cm, 0.92 cm).

The first to use the network on a sliding window in figure sliding, feature extraction network using Zeiler and Fergus Net (ZF-Net), the sliding window after the characteristics of each location on the map into a 256-dimensional feature vector, and then each feature vector into two full connection layer, a fully connected output layer contains the possibility and does not include the objectives. After obtaining the coordinates of each sliding window, the reference rectangular box is modified through coordinates, and each reference rectangular box corresponds to 4 coordinates, respectively. Finally, 9 candidate regions are obtained for each sliding window position, and the scoring of candidate regions is represented by the 18 scores mentioned above, and 2 scores correspond to one candidate region. The final test results of solid wood panel passing CNN are shown in Figure 6. It can be seen from the original picture and the comparison picture that the method proposed in this paper has a good detection effect of wood quality defects.

Based on the above illustrations, Figure 7 shows the types and locations of defects. It also shows the possibility of defect categories, which is called confidence in the picture. In the first column of the picture, the confidence of live joints is 86.3% and that of dead joints is 96.2%. In the rest of the images, the confidence of dead joints, live joints, and cracks was 99.8%, 99.2%, and 99.7%, respectively. Based on these results, we conclude that the detection performance of the proposed method is satisfactory.

As shown in Figure 8, these feature maps are extracted by Glance Network and are to be input into CNN’s wood features. By comparison, it is found that some filters extract features from the background, such as feature 1, some filters focus on the details of the input image, such as feature 5, and some filters focus on defects, such as features 4 and 8. Some features are similar, such as features 2 and 3 and features 9 and 10. Therefore, it is a waste of computing resources to input the features of all channels into CNN because the input of many similar features into the subsequent network will not greatly improve the experimental results but may lead to slower detection speed and thus take more time.

5. Conclusion

The shortages of wood resources in our country have hindered the sustainable development of the wood-processing industry, with uneven quality of wood and limitations of artificial ingredients.

In view of the current wood nondestructive testing technique and traditional artificial detection technology for the defects in the related research, based on the CNN, generating wood internal defects recognition and detection models, and exploring the types of wood internal defects and model recognition rate, results show the generated model has an effect on wood internal defects recognition and classification is better, which has verified the practicability of this method.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The author declares no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.