A non-destructive method and system for detecting the density of balsa wood strips
By constructing a surface defect and density detection model for balsa wood and utilizing image feature extraction and classification regression techniques, the problem of low-cost and rapid detection of surface defects and density in balsa wood strips was solved, improving detection accuracy and balsa wood board production efficiency.
Patent Information
- Application Number
- CN202311115321.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2043-08-31
AI Technical Summary
Existing technologies are insufficient for low-cost, large-scale detection of surface defects in balsa wood strips and rapid density testing; traditional methods are complex and time-consuming.
A balsa wood surface defect and density detection model is constructed using a backbone network, a surface defect classification head, and a density detection regression head. The model predicts balsa wood surface defects and density through image feature extraction and classification regression. Convolutional layers and fully connected layers are used for feature learning, and the model is trained by combining backpropagation and Adam gradient descent algorithms.
This technology enables rapid and cost-effective combined detection of surface defects and density in balsa wood strips, improving detection accuracy and balsa wood board production speed.
Smart Images

Figure CN117314831B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of batten detection, and particularly relates to a non-destructive defect batten density detection method and system. BACKGROUND
[0002] At present, the market size of wind power continues to expand, and the blades in the wind turbine directly affect the wind energy utilization rate, and then affect the annual power generation. At present, due to the unique cell structure and light weight, high strength characteristics of batten, it has become one of the core raw materials of wind turbine blades. With the gradual popularization of batten composite sandwich structure application, the market demand for batten is increasing. In practical application, batten not only requires a defect-free surface, but also requires stable density distribution.
[0003] Wood surface defects refer to the physical or appearance defects of the local area of the wood surface due to growth environment or production process and other factors during the growth or production and processing of the wood. Common wood surface defects include knots, discoloration, decay, insect damage, cracks, scars, wood processing defects, deformation, etc. Surface defects are the key points of weak structure, and often become the reason for the fracture of wood under stress, which can reduce the mechanical properties and fatigue strength of wood. Therefore, it is necessary to detect the surface defects of wood without damaging the performance. Traditional non-destructive defect detection of wood surface mainly uses X-ray, ultrasonic, microwave, nuclear magnetic resonance and other physical equipment for detection, but these methods are too high in cost and are not suitable for large-scale wood defect identification.
[0004] Wood density is a key indicator for testing wood quality, which can be used to evaluate the mechanical properties of wood, such as moisture expansion, hardness and strength. Traditional wood density detection methods include drainage method, weighing method, near-infrared spectroscopy technology and density detection method based on mechanical force. However, the above methods are complex and time-consuming, and are not suitable for detection of a large number of wood. SUMMARY
[0005] In order to realize low-cost non-destructive defect detection of batten surface, and at the same time, to quickly detect the density of the detected defect-free batten, the present application provides a non-destructive defect batten density detection method, which comprises the following steps:
[0006] S1: a plurality of balsa surface images with defects and without defects are collected to obtain an image set, the image set is preprocessed to obtain a sample set, each balsa surface image in the sample set is set with a corresponding sample label, and the sample set is randomly divided at a preset ratio to obtain a defect detection training set and a test set, the sample label is a defect annotation or a defect-free annotation; the density of the balsa sample corresponding to each balsa surface image in the test set is measured, and the corresponding balsa surface image is labeled with the density value as a label value to obtain a target test set; the density of the balsa sample corresponding to the to-be-measured balsa surface image in the defect detection training set is measured, and the to-be-measured balsa surface image is labeled with the density value as a label value to obtain a density detection training set; the to-be-measured balsa surface image is a balsa surface image with a defect-free annotation as a training label;
[0007] S2: a balsa surface defect and density detection model is constructed through a backbone network, a surface defect classification head, and a density detection regression head, a target loss function is constructed through a loss function corresponding to the surface defect classification head and the density detection regression head, the balsa surface defect and density detection model is trained and tested through the defect detection training set, the density detection training set, the target test set, and the target loss function, and a target detection model is obtained;
[0008] S3: a to-be-detected balsa surface image is input to the target detection model, wherein:
[0009] The backbone network is configured to receive the input balsa surface image and extract image features.
[0010] The surface defect classification head is configured to fine-tune the image features extracted by the backbone network, obtain a classification result according to the fine-tuned image features, and input the classification result to the density detection regression head when the classification result belongs to a defect-free category.
[0011] The density detection regression head is configured to fine-tune the image features extracted by the backbone network, and predict a density value corresponding to the current balsa surface image according to the fine-tuned image features and the classification result input by the surface defect classification head.
[0012] Further, the balsa surface defect and density detection model is trained and tested through the defect detection training set, the density detection training set, the target test set, and the target loss function, and specifically includes:
[0013] The balsa surface defect and density detection model is trained through the defect detection training set and the density detection training set by using a back propagation and adam gradient descent algorithm until a maximum iteration number is reached or a loss curve corresponding to the target loss function reaches convergence, and a first detection model is obtained.
[0014] The first detection model is tested by a target test set, and the model accuracy is calculated according to the test result, whether the model accuracy is greater than or equal to a preset value is judged, if yes, the first detection model is exported as a target detection model, if not, the first detection model is continuously trained until the model accuracy after testing is greater than or equal to the preset value.
[0015] Further, the surface defect classification head and the density detection regression head each include:
[0016] A first convolutional layer is configured to perform a first convolution operation on the image features to obtain first convolutional features.
[0017] A second convolutional layer is configured to perform a second convolution operation on the first convolutional features to obtain second convolutional features.
[0018] A fully connected layer is configured to perform a nonlinear transformation on the second convolutional features.
[0019] The surface defect classification head further includes:
[0020] A softmax classifier is configured to obtain a classification result according to a result value output by the fully connected layer after nonlinear transformation and input the density detection regression head.
[0021] Further, a formula expression of the surface defect classification head corresponding to a loss function is:
[0022]
[0023] A formula expression of the density detection regression head corresponding to a loss function is:
[0024]
[0025] Wherein:
[0026] A formula expression of the target loss function is:
[0027] Ls = Ls1 + Ls2.
[0028] In the formula, sigma() is a sigmoid function, log is a natural logarithm, y i is a true label of the i-th sample, is a predicted value of the i-th sample, N in the loss function corresponding to the surface defect classification head represents a total number of samples in a defect detection training set, Ls1 represents a loss value corresponding to the surface defect classification head; N in the loss function corresponding to the density detection regression head represents a total number of samples in a density detection training set, smooth L1 () represents a SmoothL1Loss function, Ls2 represents a loss value corresponding to the density detection regression head; Ls represents a loss value corresponding to the target loss function.
[0029] Further, in the S1 step, the image set is preprocessed, specifically including:
[0030] The collected balsa surface images are scaled and center cropped to a preset size of pixels, and the cropped balsa surface images are normalized by the mean and standard deviation std of the imagenet dataset, wherein:
[0031] mean = [0.485, 0.456, 0.406];
[0032] std = [0.229, 0.224, 0.225];
[0033] In the formula, img represents the cropped balsa surface image, and norm_img represents the normalized balsa surface image.
[0034] The application also provides a non-destructive defect balsa strip density detection system, including the steps of:
[0035] The data set acquisition module is used to collect multiple balsa surface images with defects and without defects, obtain an image set, preprocess the image set to obtain a sample set, set a sample label corresponding to each balsa surface image in the sample set, and randomly divide the sample set at a preset proportion to obtain a defect detection training set and a test set. The sample label is a defect annotation or a non-defect annotation; the density of the balsa sample corresponding to each balsa surface image in the test set is measured, and the corresponding balsa surface image is labeled with the density value as a label value to obtain a target test set; the density of the balsa sample corresponding to the to-be-measured balsa surface image in the defect detection training set is measured, and the to-be-measured balsa surface image is labeled with the density value as a label value to obtain a density detection training set; the to-be-measured balsa surface image is a balsa surface image with a non-defect annotation as a training label;
[0036] The target detection model acquisition module is used to construct a balsa surface defect and density detection model through a backbone network, a surface defect classification head and a density detection regression head, construct a target loss function through a loss function corresponding to the surface defect classification head and the density detection regression head, train and test the balsa surface defect and density detection model through the defect detection training set, the density detection training set, the target test set and the target loss function, and obtain the target detection model;
[0037] The detection module is used to input the to-be-detected balsa surface image to the target detection model, wherein:
[0038] The backbone network is used to receive the input balsa surface image and extract image features;
[0039] The surface defect classification head is configured to fine-tune the image features extracted by the backbone network, obtain a classification result according to the fine-tuned image features, and input the classification result into the density detection regression head when the classification result belongs to the defect-free category.
[0040] The density detection regression head is configured to fine-tune the image features extracted by the backbone network, and predict a density value corresponding to the current balsa wood surface image according to the fine-tuned image features and the classification result input by the surface defect classification head.
[0041] Further, the balsa wood surface defect and density detection model is trained and tested through the defect detection training set, the density detection training set, the target test set and the target loss function, and specifically includes:
[0042] The balsa wood surface defect and density detection model is trained through the defect detection training set and the density detection training set by using the back propagation and adam gradient descent algorithm until the maximum iteration number is reached or the loss curve corresponding to the target loss function reaches convergence, and a first detection model is obtained.
[0043] The first detection model is tested through the target test set, and the model accuracy is calculated according to the test result to determine whether the model accuracy is greater than or equal to a preset value. If yes, the first detection model is exported as a target detection model. If no, the first detection model is continuously trained until the model accuracy after testing is greater than or equal to the preset value.
[0044] Further, the surface defect classification head and the density detection regression head each include:
[0045] The first convolutional layer is configured to perform a first convolution operation on the image features to obtain first convolution features.
[0046] The second convolutional layer is configured to perform a second convolution operation on the first convolution features to obtain second convolution features.
[0047] The fully connected layer is configured to nonlinearly transform the second convolution features.
[0048] The surface defect classification head further includes:
[0049] The softmax classifier is configured to obtain a classification result according to the result value output by the fully connected layer after nonlinear transformation and input the classification result into the density detection regression head.
[0050] Further, the formula expression of the loss function corresponding to the surface defect classification head is:
[0051]
[0052] The formula expression of the loss function corresponding to the density detection regression head is:
[0053]
[0054] Wherein:
[0055] The formula expression of the target loss function is:
[0056] Ls=Ls1+Ls2;
[0057] In the formula, sigma() is a sigmoid function, log is a natural logarithm, y i is the true label of the i-th sample, is the predicted value of the i-th sample, N in the surface defect classification head corresponding loss function represents the total number of samples of the defect detection training set, Ls1 represents the loss value corresponding to the surface defect classification head, N in the density detection regression head corresponding loss function represents the total number of samples of the density detection training set, smooth L1 () represents a SmoothL1Loss function, and Ls2 represents the loss value corresponding to the density detection regression head; Ls represents the loss value corresponding to the target loss function.
[0058] Further, in the data set acquisition module, the preprocessed image set specifically includes:
[0059] The collected balsa surface image is scaled and center cropped to a preset size pixel, and the cropped balsa surface image is normalized by the mean and variance std of the imagenet data set, wherein:
[0060] mean=[0.485, 0.456, 0.406];
[0061] std=[0.229, 0.224, 0.225];
[0062] In the formula, img represents the cropped balsa surface image, and norm_img represents the normalized balsa surface image.
[0063] Compared with the prior art, the present application has at least the following beneficial effects:
[0064] (1) The present application sets the corresponding sample label for each balsa surface image in the sample set, and randomly divides the sample set by a predetermined proportion to obtain a defect detection training set and a test set; the density of the balsa sample corresponding to each balsa surface image in the test set is measured, and the corresponding balsa surface image is labeled with the density value as the label value to obtain a target test set; the density of the balsa sample corresponding to the balsa surface image to be measured in the defect detection training set is measured, and the balsa surface image to be measured is labeled with the density value as the label value to obtain a density detection training set; the balsa surface defect and density detection model constructed by the backbone network, the surface defect classification head and the density detection regression head is trained and tested through the above training set and test set, the target detection model is obtained, and the density value is predicted after detecting the balsa strip without defects through the target detection model, realizing low-cost balsa strip surface defect detection and density detection, and simultaneously, the present application realizes rapid joint detection of balsa strip surface defects and density through the same model, greatly improving the speed of balsa board preparation.
[0065] (2) The surface defect classification head and the density detection regression head in the present application both include a first convolutional layer, a second convolutional layer and a fully connected layer for fine-tuning image features, realizing automatic feature learning and deep feature extraction, and in the surface defect classification head, the softmax classifier obtains a classification result according to the result value output after nonlinear transformation of the fully connected layer, improving the accuracy of classification. BRIEF DESCRIPTION OF DRAWINGS
[0066] Figure 1 It is a non-destructive defect balsa strip density detection method flow chart;
[0067] Figure 2 It is a target detection model structure diagram;
[0068] Figure 3 It is a density detection regression head structure diagram;
[0069] Figure 4 It is a non-destructive defect balsa strip density detection system module diagram. DETAILED DESCRIPTION
[0070] The following is a specific embodiment of the present application and further describes the technical solutions of the present application in combination with the drawings, but the present application is not limited to these embodiments.
[0071] Example one
[0072] In order to realize rapid joint detection of balsa strip surface defects and density, and reduce the detection cost, as shown in the figure, Figure 1 The present application proposes a non-destructive defect balsa strip density detection method, including the following steps:
[0073] S1: a plurality of balsa surface images with defects and without defects are collected to obtain an image set, the image set is preprocessed to obtain a sample set, a sample label corresponding to each balsa surface image in the sample set is set, and the sample set is randomly divided into a defect detection training set and a test set in a preset ratio (8:2), the sample label is a defect annotation or a defect-free annotation; the density of the balsa sample corresponding to each balsa surface image in the test set is measured by a weighing method, and the corresponding balsa surface image is labeled with the density value as a label value to obtain a target test set; the density of the balsa sample corresponding to the to-be-measured balsa surface image in the defect detection training set is measured by a weighing method, and the to-be-measured balsa surface image is labeled with the density value as a label value to obtain a density detection training set; the to-be-measured balsa surface image is a balsa surface image with a defect-free annotation as a training label.
[0074] In the present application, each balsa surface image in the target test set includes two labels: a sample label and a density value label; each balsa surface image in the defect detection training set includes a sample label; and each balsa surface image in the density detection training set includes a density value label.
[0075] It should be noted that the specific method for obtaining the image set is as follows: a plurality of balsa samples with defects and without defects are collected, and are placed in turn on a table with a consistent background, a camera is used to collect surface texture images of four surfaces of each balsa, and the balsa surface images are spliced in a fixed order to obtain a balsa surface image, and a plurality of spliced balsa surface images constitute the image set.
[0076] In the S1 step, the image set is preprocessed, specifically including:
[0077] The collected balsa surface images are scaled and center cropped to a preset size pixel (32*32), and the cropped balsa surface images are normalized by the mean and std of the imagenet data set, wherein:
[0078] mean=[0.485,0.456,0.406];
[0079] std=[0.229,0.224,0.225];
[0080] In the formula, img represents the cropped balsa surface image, and norm_img represents the normalized balsa surface image.
[0081] S2: constructing a balsa wood surface defect and density detection model through the backbone network, the surface defect classification head and the density detection regression head, constructing a target loss function through a loss function corresponding to the surface defect classification head and the density detection regression head, training and testing the balsa wood surface defect and density detection model through a defect detection training set, a density detection training set, a target test set and the target loss function, and obtaining a target detection model;
[0082] The backbone network can select a mainstream neural network, such as VggNet, MobileNet, ResNet and the like. In the embodiment, ResNet-18 is selected as the backbone network, ResNet-18 represents a residual network with a depth of 18 layers, and ResNet-18 has 8 residual blocks, each of which includes two layers of convolution, and the convolution kernel sizes are 3*3 and 3*3 in turn.
[0083] The formula expression of the loss function corresponding to the surface defect classification head is:
[0084]
[0085] The formula expression of the loss function corresponding to the density detection regression head is:
[0086]
[0087] Wherein:
[0088] The formula expression of the target loss function is:
[0089] Ls = Ls1 + Ls2;
[0090] In the formula, sigma() is a sigmoid function, log is a natural logarithm, y i is a real label of the i-th sample, is a predicted value of the i-th sample, N in the loss function corresponding to the surface defect classification head represents a total number of samples in the defect detection training set, and Ls1 represents a loss value corresponding to the surface defect classification head; N in the loss function corresponding to the density detection regression head represents a total number of samples in the density detection training set, and smooth L1 () represents a SmoothL1Loss function, and Ls2 represents a loss value corresponding to the density detection regression head; Ls represents a loss value corresponding to the target loss function.
[0091] The balsa wood surface defect and density detection model is trained and tested through the defect detection training set, the density detection training set, the target test set and the target loss function, and specifically includes:
[0092] The light wood surface defect and density detection model is trained by the defect detection training set and the density detection training set by using back propagation and adam gradient descent algorithm (wherein the learning rate is set to 0.001) until the maximum iteration number is reached or the loss curve corresponding to the target loss function reaches convergence, and a first detection model is obtained;
[0093] The first detection model is tested by the target test set, and the model accuracy is calculated according to the test result to determine whether the model accuracy is greater than or equal to a preset value (99%). If yes, the first detection model is exported as a target detection model. If not, the first detection model is continuously trained until the model accuracy after testing is greater than or equal to the preset value.
[0094] The calculation formula corresponding to the model accuracy is:
[0095] The accuracy Precision = TP / (TP+FP).
[0096] In the formula, TP and FP are respectively the number of true positives (indicating that the defect category and density value are both detected correctly) and the number of false positives (indicating that the defect category or density value is detected incorrectly).
[0097] S3: inputting the light wood surface image to be detected into the target detection model, as shown in Figure 2
[0098] The backbone network is used to receive the input light wood surface image and extract image features. In this embodiment, the image features extracted by the backbone network are 512-dimensional light wood image features, and the output of the last fully connected layer is not required.
[0099] The surface defect classification head is used to fine-tune the image features extracted by the backbone network, obtain a classification result according to the fine-tuned image features, and input the classification result into the density detection regression head when the classification result belongs to the defect-free category.
[0100] The density detection regression head is used to fine-tune the image features extracted by the backbone network, and predict the density value corresponding to the current light wood surface image according to the fine-tuned image features and the classification result input by the surface defect classification head.
[0101] The surface defect classification head and the density detection regression head both include, as shown in Figure 3
[0102] The first convolutional layer is used to perform a first convolution operation on the image features to obtain first convolutional features.
[0103] The second convolutional layer is used to perform a second convolution operation on the first convolutional features to obtain second convolutional features.
[0104] The fully connected layer is used to nonlinearly transform the second convolutional features.
[0105] The surface defect classification head further comprises:
[0106] a softmax classifier configured to obtain a classification result according to a result value output after nonlinear transformation of the full connection layer and input the density detection regression head.
[0107] The surface defect classification head and the density detection regression head both comprise a first convolutional layer, a second convolutional layer and a full connection layer for fine-tuning image features, thereby achieving automatic feature learning and deep feature extraction.
[0108] Specifically, the target detection model is used to jointly detect surface defects and density of the batten, and the method specifically comprises:
[0109] When the battens are conveyed to the batten board preparation device, the camera is used to acquire a surface image of the batten and input the image into the target detection model to determine whether the surface has defects, i.e., when the classification result belongs to the defect category, the defective batten is automatically removed by the mechanical arm, when the classification result belongs to the non-defect category, the density of the non-defective batten is predicted and a density value is output, and finally, the battens are cut, glued, compressed and bonded based on the normal distribution according to the predicted density of the battens, and then the battens are cut into batten boards.
[0110] The present application can real-time and intelligently determine the surface defects of the battens and detect the density of the non-defective battens, thereby meeting the quality and density distribution requirements of the batten board preparation.
[0111] The present application sets a corresponding sample label for each balsa surface image in the sample set, and randomly divides the sample set at a preset ratio to obtain a defect detection training set and a test set; the density of the balsa sample corresponding to each balsa surface image in the test set is measured, and the corresponding balsa surface image is labeled with the density value as a label value to obtain a target test set; the density of the balsa sample corresponding to the to-be-measured balsa surface image in the defect detection training set is measured, and the to-be-measured balsa surface image is labeled with the density value as a label value to obtain a density detection training set; the balsa surface defect and density detection model constructed by the backbone network, the surface defect classification head and the density detection regression head is trained and tested through the above training set and test set, and the target detection model is obtained, and the density value is predicted through the target detection model after detecting the balsa strip without defects, so that the low-cost balsa strip surface defect detection and density detection are realized, and at the same time, the present application realizes the rapid joint detection of the balsa strip surface defect and the density through the same model, greatly improving the speed of balsa board preparation.
[0112] Embodiment two
[0113] As Figure 4 shown, the present application also provides a non-destructive defect balsa strip density detection system, comprising the following steps:
[0114] The data set acquisition module is used to collect multiple balsa surface images with defects and without defects to obtain an image set, pre-process the image set to obtain a sample set, set a corresponding sample label for each balsa surface image in the sample set, and randomly divide the sample set at a preset ratio to obtain a defect detection training set and a test set, wherein the sample label is a defect annotation or a non-defect annotation; the density of the balsa sample corresponding to each balsa surface image in the test set is measured, and the corresponding balsa surface image is labeled with the density value as a label value to obtain a target test set; the density of the balsa sample corresponding to the to-be-measured balsa surface image in the defect detection training set is measured, and the to-be-measured balsa surface image is labeled with the density value as a label value to obtain a density detection training set; the to-be-measured balsa surface image is a balsa surface image with a non-defect annotation in the training label;
[0115] In the data set acquisition module, the pre-processed image set specifically includes:
[0116] The collected balsa surface image is scaled and center cropped to a preset size pixel, and the cropped balsa surface image is normalized by the mean and std of the imagenet data set, wherein:
[0117] mean = [0.485, 0.456, 0.406];
[0118] std = [0.229, 0.224, 0.225];
[0119] In the formula, img represents the balsa surface image after cropping, and norm_img represents the normalized balsa surface image.
[0120] The target detection model acquisition module is configured to construct a balsa surface defect and density detection model through the backbone network, the surface defect classification head, and the density detection regression head, construct a target loss function through a loss function corresponding to the surface defect classification head and the density detection regression head, train and test the balsa surface defect and density detection model through a defect detection training set, a density detection training set, a target test set, and the target loss function, and obtain a target detection model.
[0121] The formula expression of the loss function corresponding to the surface defect classification head is as follows:
[0122]
[0123] The formula expression of the loss function corresponding to the density detection regression head is as follows:
[0124]
[0125] Among them:
[0126] The formula expression of the target loss function is as follows:
[0127] Ls = Ls1 + Ls2.
[0128] In the formula, sigma() is a sigmoid function, log is a natural logarithm, y i is a real label of the i-th sample, is a predicted value of the i-th sample, N in the loss function corresponding to the surface defect classification head represents a total number of samples in the defect detection training set, and Ls1 represents a loss value corresponding to the surface defect classification head; N in the loss function corresponding to the density detection regression head represents a total number of samples in the density detection training set, and smooth L1 () represents a SmoothL1Loss function, and Ls2 represents a loss value corresponding to the density detection regression head; and Ls represents a loss value corresponding to the target loss function.
[0129] The balsa surface defect and density detection model is trained and tested through the defect detection training set, the density detection training set, the target test set, and the target loss function, and specifically includes the following steps:
[0130] The balsa surface defect and density detection model is trained through the defect detection training set and the density detection training set by using a back propagation and an adam gradient descent algorithm until a maximum iteration number is reached or a loss curve corresponding to the target loss function reaches convergence, and a first detection model is obtained.
[0131] The first detection model is tested by a target test set, and a model accuracy is calculated according to a test result, whether the model accuracy is greater than or equal to a preset value is judged, if yes, the first detection model is exported as a target detection model, if not, the first detection model is continuously trained until the model accuracy after testing is greater than or equal to the preset value.
[0132] The detection module is configured to input the balsa wood surface image to be detected into the target detection model, wherein:
[0133] The backbone network is configured to receive the input balsa wood surface image and extract image features;
[0134] The surface defect classification head is configured to fine-tune the image features extracted by the backbone network, obtain a classification result according to the fine-tuned image features, and input the classification result into the density detection regression head when the classification result belongs to a defect-free category.
[0135] The density detection regression head is configured to fine-tune the image features extracted by the backbone network, and predict a density value corresponding to the current balsa wood surface image according to the fine-tuned image features and the classification result input by the surface defect classification head.
[0136] The surface defect classification head and the density detection regression head both include:
[0137] The first convolutional layer is configured to perform a first convolution operation on the image features to obtain first convolution features;
[0138] The second convolutional layer is configured to perform a second convolution operation on the first convolution features to obtain second convolution features;
[0139] The fully connected layer is configured to nonlinearly transform the second convolution features;
[0140] The surface defect classification head further includes:
[0141] The softmax classifier is configured to obtain a classification result according to a result value output by the fully connected layer after nonlinear transformation and input the classification result into the density detection regression head.
[0142] It should be noted that all directionality indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present application are only used to explain the relative positional relationship, motion condition, etc. between components in a certain specific posture (as shown in the drawings), and if the specific posture changes, the directionality indications will also change accordingly.
[0143] In addition, in the present application, the description such as "first", "second", "one" and the like are only for the purpose of description, and cannot be understood as indicating or implying the relative importance of the technical features or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "a plurality of" is at least two, for example, two, three, etc., unless otherwise explicitly specified and limited.
[0144] In the present application, unless otherwise explicitly specified and limited, the terms "connection", "fixing" and the like should be understood broadly, for example, "fixing" can be fixed connection, or detachable connection, or integral; can be mechanical connection, or electrical connection; can be directly connected, or indirectly connected through intermediate medium, can be the internal communication of two elements or the interaction relationship between two elements, unless otherwise explicitly limited. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0145] In addition, the technical solutions of various embodiments of the present application can be combined with each other, but it must be based on the realization of the ordinary skilled in the art, when the combination of technical solutions appears contradictory or cannot be realized, it should be considered that the combination of technical solutions does not exist, nor within the scope of protection required by the present application.
Claims
1. A non-destructive method for detecting the density of defective balsa wood strips, characterized in that, Including the following steps: S1: Collect multiple images of balsa wood surfaces with and without defects to obtain an image set. Preprocess the image set to obtain a sample set. Assign a corresponding sample label to each balsa wood surface image in the sample set. Randomly divide the sample set according to a preset ratio to obtain a defect detection training set and a test set. The sample label is either a defect label or a defect-free label. Measure the density of the balsa wood sample corresponding to each balsa wood surface image in the test set, and label the corresponding balsa wood surface image with the density value to obtain the target test set. Measure the density of the balsa wood sample corresponding to the balsa wood surface image to be tested in the defect detection training set, and label the balsa wood surface image to be tested with the density value to obtain the density detection training set. The balsa wood surface image to be tested is the balsa wood surface image with the training label being a defect-free label. S2: Construct a balsa wood surface defect and density detection model through a backbone network, a surface defect classification head, and a density detection regression head. Construct a target loss function through the loss functions corresponding to the surface defect classification head and the density detection regression head. Train and test the balsa wood surface defect and density detection model through the defect detection training set, the density detection training set, the target test set, and the target loss function to obtain the target detection model. S3: Input the image of the balsa wood surface to be detected into the object detection model, where: The backbone network is used to receive the input image of the balsa wood surface and extract image features; The surface defect classification head is used to fine-tune the image features extracted by the backbone network, obtain the classification result based on the fine-tuned image features, and input the classification result into the density detection regression head when the classification result belongs to the defect-free category. The density detection regression head is used to fine-tune the image features extracted by the backbone network and predict the density value corresponding to the current balsa wood surface image based on the fine-tuned image features and the classification results input from the surface defect classification head.
2. The method for non-destructive testing of the density of balsa wood strips according to claim 1, characterized in that, The surface defect and density detection model for balsa wood was trained and tested using a defect detection training set, a density detection training set, a target test set, and a target loss function. Specifically, this included: The surface defect and density detection models of balsa wood are trained using backpropagation and Adam gradient descent algorithms through the defect detection training set and the density detection training set until the maximum number of iterations is reached or the loss curve corresponding to the target loss function converges, thus obtaining the first detection model. The first detection model is tested using the target test set, and the model accuracy is calculated based on the test results. It is then determined whether the model accuracy is greater than or equal to a preset value. If yes, the first detection model is exported as the target detection model. If not, the first detection model is trained until the accuracy of the tested model is greater than or equal to the preset value.
3. The method for non-destructive testing of the density of balsa wood strips according to claim 2, characterized in that, Both the surface defect classification head and the density detection regression head include: The first convolutional layer is used to perform the first convolution operation on the image features to obtain the first convolutional features; The second convolutional layer is used to perform a second convolution operation on the first convolutional features to obtain the second convolutional features; Fully connected layers are used for non-linear transformation of the second convolutional features; The surface defect classification head also includes: The softmax classifier is used to obtain the classification result based on the output value after the nonlinear transformation of the fully connected layer and input it into the density detection regression head.
4. The method for non-destructive testing of the density of balsa wood strips according to claim 3, characterized in that, The formula for the loss function corresponding to the surface defect classification head is as follows: The formula for the loss function corresponding to the density detection regression head is as follows: in: The formula for the target loss function is as follows: Ls = Ls1 + Ls2; In the formula, σ() is the sigmoid function, log is the natural logarithm, and y i Let i be the true label of the i-th sample. For the predicted values of i samples, N in the loss function corresponding to the surface defect classification head represents the total number of samples in the defect detection training set, and Ls1 represents the loss value corresponding to the surface defect classification head; N in the loss function corresponding to the density detection regression head represents the total number of samples in the density detection training set, and smoothness... L1 () represents the SmoothL1Loss function, Ls2 represents the loss value corresponding to the density detection regression head, and Ls represents the loss value corresponding to the target loss function.
5. The method for non-destructive testing of the density of balsa wood strips according to claim 4, characterized in that, In step S1, the image set is preprocessed, specifically including: The acquired balsa wood surface images were scaled and centered to a preset pixel size. The cropped balsa wood surface images were then normalized using the mean and standard deviation (std) of the ImageNet dataset, where: mean = [0.485, 0.456, 0.406]; std = [0.229, 0.224, 0.225]; In the formula, img represents the cropped balsa wood surface image, and norm_img represents the normalized balsa wood surface image.
6. A non-destructive balsa wood strip density detection system, characterized in that, Including the following steps: The dataset acquisition module is used to collect multiple images of balsa wood surfaces with and without defects to obtain an image set. The image set is preprocessed to obtain a sample set. Each balsa wood surface image in the sample set is assigned a corresponding sample label, and the sample set is randomly divided into a defect detection training set and a test set according to a preset ratio. The sample labels are either defective or defect-free. The density of the balsa wood sample corresponding to each balsa wood surface image in the test set is measured, and the corresponding balsa wood surface image is labeled with the density value to obtain the target test set. The density of the balsa wood surface image to be tested corresponding to the balsa wood sample in the defect detection training set is measured, and the balsa wood surface image to be tested is labeled with the density value to obtain the density detection training set. The balsa wood surface image to be tested is the balsa wood surface image with the training label being defect-free. The target detection model acquisition module is used to construct a balsa wood surface defect and density detection model through a backbone network, a surface defect classification head, and a density detection regression head; to construct a target loss function through the loss functions corresponding to the surface defect classification head and the density detection regression head; and to train and test the balsa wood surface defect and density detection model through the defect detection training set, the density detection training set, the target test set, and the target loss function to obtain the target detection model. The detection module is used to input the image of the balsa wood surface to be detected into the target detection model, wherein: The backbone network is used to receive the input image of the balsa wood surface and extract image features; The surface defect classification head is used to fine-tune the image features extracted by the backbone network, obtain the classification result based on the fine-tuned image features, and input the classification result into the density detection regression head when the classification result belongs to the defect-free category. The density detection regression head is used to fine-tune the image features extracted by the backbone network and predict the density value corresponding to the current balsa wood surface image based on the fine-tuned image features and the classification results input from the surface defect classification head.
7. The non-destructive balsa wood strip density detection system according to claim 6, characterized in that, The surface defect and density detection model for balsa wood was trained and tested using a defect detection training set, a density detection training set, a target test set, and a target loss function. Specifically, this included: The surface defect and density detection models of balsa wood are trained using backpropagation and Adam gradient descent algorithms through the defect detection training set and the density detection training set until the maximum number of iterations is reached or the loss curve corresponding to the target loss function converges, thus obtaining the first detection model. The first detection model is tested using the target test set, and the model accuracy is calculated based on the test results. It is then determined whether the model accuracy is greater than or equal to a preset value. If yes, the first detection model is exported as the target detection model. If not, the first detection model is trained until the accuracy of the tested model is greater than or equal to the preset value.
8. The non-destructive balsa wood strip density detection system according to claim 7, characterized in that, Both the surface defect classification head and the density detection regression head include: The first convolutional layer is used to perform the first convolution operation on the image features to obtain the first convolutional features; The second convolutional layer is used to perform a second convolution operation on the first convolutional features to obtain the second convolutional features; Fully connected layers are used for non-linear transformation of the second convolutional features; The surface defect classification head also includes: The softmax classifier is used to obtain the classification result based on the output value after the nonlinear transformation of the fully connected layer and input it into the density detection regression head.
9. The non-destructive balsa wood strip density detection system according to claim 8, characterized in that, The formula for the loss function corresponding to the surface defect classification head is as follows: The formula for the loss function corresponding to the density detection regression head is as follows: in: The formula for the target loss function is as follows: Ls = Ls1 + Ls2; In the formula, σ() is the sigmoid function, log is the natural logarithm, and y i Let i be the true label of the i-th sample. For the predicted values of i samples, N in the loss function corresponding to the surface defect classification head represents the total number of samples in the defect detection training set, and Ls1 represents the loss value corresponding to the surface defect classification head; N in the loss function corresponding to the density detection regression head represents the total number of samples in the density detection training set, and smoothness... L1 () represents the SmoothL1Loss function, Ls2 represents the loss value corresponding to the density detection regression head, and Ls represents the loss value corresponding to the target loss function.
10. The non-destructive balsa wood strip density detection system according to claim 9, characterized in that, The dataset acquisition module includes preprocessing the image set, specifically: The acquired balsa wood surface images were scaled and centered to a preset pixel size. The cropped balsa wood surface images were then normalized using the mean and standard deviation (std) of the ImageNet dataset, where: mean = [0.485, 0.456, 0.406]; std = [0.229, 0.224, 0.225]; In the formula, img represents the cropped balsa wood surface image, and norm_img represents the normalized balsa wood surface image.
Citation Information
Patent Citations
Wood surface defect detection method based on improved YOLOv5l network
CN114359235A
Composite material defect detection system and method
CN115561280A