Artificial board surface defect detection method and device, medium and equipment
By introducing multi-axis frequency domain weighting module and adaptive dynamic convolution module in the YOLOv5 network, the problem of low recognition accuracy of small defects on the surface of artificial boards is solved, and more efficient feature extraction and robustness detection are achieved, which enhances the The ability to identify small defects.
Patent Information
- Application Number
- CN202411152796.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, the identification accuracy of the surface of artificial boards is not high, especially due to the ambiguity and dimensional differences between the defects and the background, it is difficult for the YOLOv5 network to effectively identify the micro defects.
By replacing the C3 module in the backbone network of the YOLOv5 network with a multi-axis frequency domain weighting module, and building an improved YOLOv5 network, using frequency domain and airspace feature extraction branches for feature extraction and fusion, combined with the adaptive dynamic convolution module, dynamic Adjust the weight of the convolution kernel to adapt to defects of different sizes, and enhance the model's ability to detect small defects.
It improves the accuracy of surface defect detection of artificial boards, can capture micro defect characteristics in more detail, enhances the robustness and efficiency of detection, reduces noise interference, and improves the discrimination ability of targets at different scales.
Smart Images

Figure CN119130939A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of surface defect detection, and in particular to a method, device, medium and equipment for detecting surface defects of artificial boards. Background Art
[0002] Artificial board is one of the commonly used materials in the manufacturing industry and has been widely used in many fields such as construction, furniture manufacturing and decoration. Surface defect detection of artificial boards is a key step in the production process of artificial boards. By detecting and removing surface defects, unqualified products can be avoided for subsequent processing, which not only reduces the waste of raw materials, but also ensures that the appearance and quality of artificial boards meet customers' demand for high-quality products. At present, defect detection methods based on machine vision and deep learning are gradually replacing traditional defect detection methods, bringing higher detection efficiency and lower operating costs to artificial board manufacturers.
[0003] YOLOv5 network (You Only Look Once version 5) is an efficient target detection algorithm, which is carefully designed to quickly and accurately identify different targets in images. The network structure is mainly divided into three parts: backbone network (Backbone), neck network (Neck) and head network (Head). The backbone network is responsible for extracting rich feature information from the input image, the neck network further processes and fuses the extracted features, and the head network is responsible for the final bounding box prediction and category judgment.
[0004] However, since tiny defects on the surface of artificial boards usually have a low grayscale value contrast, the defect features are not prominent enough in the image and are difficult to separate from the background; this will cause the features of tiny defects to be easily ignored or lost during the feature extraction process of the YOLOv5 network, making it difficult to identify tiny defects on the surface of artificial boards. Summary of the invention
[0005] Based on this, in order to solve the technical problem of low accuracy in identifying tiny defects on the surface of artificial boards in the prior art, the present invention provides a method, device, medium and equipment for detecting defects on the surface of artificial boards.
[0006] The present invention provides a method for detecting surface defects of artificial boards, comprising:
[0007] The C3 module of the backbone network in the original YOLOv5 network is replaced with a multi-axis frequency domain weighted module to form an improved backbone network, wherein the multi-axis frequency domain weighted module includes a segmentation layer, a spatial frequency domain feature extraction layer and a fusion layer connected in sequence, wherein the spatial frequency domain feature extraction layer includes three parallel frequency domain feature extraction branches and one spatial domain feature extraction branch; and an improved YOLOv5 network is constructed including the improved backbone network, the neck network in the original YOLOv5 network and the head network in the original YOLOv5 network;
[0008] Collect images of artificial boards with surface defects to construct a data set; use the data set to train the improved YOLOv5 network to obtain a defect detection model for detecting surface defects of artificial boards;
[0009] The image of the artificial board to be inspected is input into the defect detection model, and the image of the artificial board to be inspected is convolved through the input layer of the backbone network to obtain a multi-channel feature map; the multi-channel feature map is segmented through the segmentation layer of the multi-axis frequency domain weighting module to obtain four segmentation feature maps; three of the four segmentation feature maps are converted to the frequency domain along the feature map height dimension, width dimension and channel dimension respectively through the three frequency domain feature extraction branches of the multi-axis frequency domain weighting module, so as to separate the frequency domain signals corresponding to the surface defect features of the artificial board and the frequency domain signals corresponding to the surface non-defect features of the artificial board along different dimensions in the frequency domain; the spatial domain feature extraction branch of the multi-axis frequency domain weighting module is used to extract features of the remaining segmentation feature map in the spatial domain; the output of the frequency domain feature extraction branch and the output of the spatial domain feature extraction branch are fused through the fusion layer of the multi-axis frequency domain weighting module to obtain a spatial-frequency domain defect feature map; the spatial-frequency domain defect feature map is enhanced through the neck network to obtain an enhanced defect feature map; the enhanced defect feature map is identified through the head network, and the surface defect type and surface defect position in the image of the artificial board to be inspected are output.
[0010] Furthermore, the improved YOLOv5 network further includes:
[0011] The CBS module of the backbone network in the original YOLOv5 network is replaced with an adaptive dynamic convolution module; the adaptive dynamic convolution module includes a convolution kernel dynamic weighting layer and an adaptive convolution layer connected in sequence; the convolution kernel dynamic weighting layer dynamically adjusts the weight of the convolution kernel in the adaptive convolution layer through the extracted features of the artificial board image to be detected, so as to adapt to defects of different sizes in the artificial board image to be detected, and obtain an adaptive dynamic convolution kernel; the adaptive convolution layer convolves the adaptive dynamic convolution kernel with the input features of the adaptive dynamic convolution module to obtain a feature map that retains the defect features in the artificial board image to be detected;
[0012] The C3 module and Conv module of the neck network in the original YOLOv5 network are replaced by the ELAN module and the adaptive dynamic convolution module respectively; the ELAN module divides the feature map output by the backbone network into different paths to learn different feature patterns of surface defects of artificial boards in each path; and the outputs of each path are reintegrated to enhance the defect features in the feature map output by the backbone network.
[0013] Furthermore, the convolution kernel dynamic weighting layer specifically includes:
[0014] Global average pooling layer, used to aggregate input features into a vector;
[0015] A fully connected layer and activation function with short connections to the output of the global average pooling layer to generate dynamic coefficients;
[0016] The weighted layer connected to the output of the activation function is used to multiply the dynamic coefficients by the convolution kernel weights element-wise.
[0017] Furthermore, the frequency domain feature extraction branch specifically includes:
[0018] The frequency domain conversion layer is used to convert the feature map of the input frequency domain feature extraction branch from spatial domain pixel features to frequency domain signal features through 2D Fourier transform;
[0019] The weighted denoising layer is used to perform a weighted transformation on the frequency domain signal features to expand the difference between the frequency domain signal features corresponding to defects and the frequency domain signal features corresponding to non-defects; and use Gaussian filtering to suppress the noise of the weighted frequency domain signal features;
[0020] The spatial domain conversion layer is used to convert the frequency domain signal features into spatial domain pixel features using a two-dimensional inverse discrete Fourier transform.
[0021] Furthermore, the spatial feature extraction branch includes a depthwise separable convolutional layer.
[0022] The present invention provides a device for detecting surface defects of artificial boards, comprising:
[0023] A model building module is used to replace the C3 module of the backbone network in the original YOLOv5 network with a multi-axis frequency domain weighting module to form an improved backbone network, wherein the multi-axis frequency domain weighting module includes a segmentation layer, a spatial frequency domain feature extraction layer and a fusion layer connected in sequence, wherein the spatial frequency domain feature extraction layer includes three parallel frequency domain feature extraction branches and one spatial domain feature extraction branch; and construct an improved YOLOv5 network including the improved backbone network, the neck network in the original YOLOv5 network and the head network in the original YOLOv5 network;
[0024] The model training module is used to collect images of artificial boards with surface defects to construct a data set; the data set is used to train the improved YOLOv5 network to obtain a defect detection model for detecting surface defects of artificial boards;
[0025] The defect detection module is used to input the image of the artificial board to be detected into the defect detection model, perform convolution operation on the image of the artificial board to be detected through the input layer of the backbone network to obtain a multi-channel feature map; segment the multi-channel feature map through the segmentation layer of the multi-axis frequency domain weighting module to obtain four segmentation feature maps; and transform three of the four segmentation feature maps into the frequency domain along the feature map height dimension, width dimension and channel dimension respectively through the three frequency domain feature extraction branches of the multi-axis frequency domain weighting module, so as to separate the frequency domains corresponding to the surface defect features of the artificial board along different dimensions in the frequency domain. The output of the frequency domain feature extraction branch and the output of the spatial domain feature extraction branch are fused with the output of the spatial domain feature extraction branch through the fusion layer of the multi-axis frequency domain weighted module to obtain a spatial-frequency domain defect feature map; the spatial-frequency domain defect feature map is enhanced through the neck network to obtain an enhanced defect feature map; the enhanced defect feature map is identified through the head network, and the surface defect type and surface defect position in the image of the artificial board to be detected are output.
[0026] The present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned method for detecting surface defects of artificial boards is implemented.
[0027] The present invention provides a computer device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for detecting surface defects of artificial boards when executing the program.
[0028] At least one of the above technical solutions adopted by the present invention can achieve the following beneficial effects:
[0029] In the surface defect detection method of artificial board provided by the present invention, the original YOLOv5 network is improved by replacing the C3 module of the backbone network in the original YOLOv5 network with a multi-axis frequency domain weighted module to enhance its ability to detect tiny defects on the surface of artificial board. Specifically: the multi-axis frequency domain weighted module deeply extracts the features of tiny defects in the two dimensions of spatial domain and frequency domain; since the frequency domain has a stronger signal separation ability than the spatial domain, the feature map of the spatial domain is converted from three different dimensions to the frequency domain for feature extraction using the frequency domain feature extraction branch, which can amplify the ability to separate defect features and non-defect features and obtain more detailed defect detail information; at the same time, the spatial domain feature extraction branch performs feature extraction in the spatial domain, retaining the spatial information of the defect; the spatial domain features and the frequency domain features are fused, and this dual-domain feature extraction method ensures that the features of tiny defects on the surface of the artificial board can be fully captured, thereby improving the detection accuracy of surface defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0031] Figure 1 A schematic diagram of the network structure of FDADNet provided by the present invention;
[0032] Figure 2 A schematic diagram of the structure of the Stem provided by the present invention;
[0033] Figure 3 A schematic diagram of ADConv provided by the present invention; Figure 3 (a) is a schematic diagram of the structure of ADConv; Figure 3 (b) is a schematic diagram of the ADConv workflow;
[0034] Figure 4 A schematic diagram of the network structure of the MFDW Block provided by the present invention; Figure 4 (a) is a schematic diagram of the overall structure of MFDWBlock; Figure 4 (b) is a schematic diagram of the Conv structure; Figure 4 (c) is a schematic diagram of the SEM structure; Figure 4 (d) is a schematic diagram of the AFF structure;
[0035] Figure 5 A frequency domain filtering comparison diagram provided by the present invention; Figure 5 (a1) is the grayscale image of the original artificial board with glue spots and oil stains; Figure 5 (a2) in is Figure 5The spectrum image corresponding to (a1) in ; Figure 5 (b1) is the Gaussian filter used to Figure 5 The image after processing (a1) in the figure; Figure 5 (b2) in Figure 5 The spectrum image corresponding to (b1) in ;
[0036] Figure 6 This is a schematic diagram of the structure of the ELAN module provided by the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in combination with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] There are several challenges in using the YOLOv5 network to detect surface defects on artificial boards, including: (1) Ambiguity between defects and background: In complex industrial production environments, the grayscale values of surface defects on artificial boards are often very close to the surrounding background areas. It is difficult for the detector to effectively separate defects from the background during the recognition process, resulting in ambiguity between defects and background during the recognition process. (2) Differences in defect size: The sizes of various defects vary significantly, and the detector often has difficulty in striking a balance between large and small objects, causing feature confusion between multi-scale objects and affecting the overall performance of detection. (3) Significance of inter-class variance: Defects of the same category may have completely different appearances. This large inter-class variance makes it challenging for the detector to extract and distinguish defect features, reducing the accuracy of detection.
[0039] Based on this, the present invention provides a method for detecting surface defects of artificial boards, which proposes a FDADNet (Frequency Domain Adaptive Dynamic Downsampling Network). Specifically, a MFDWBlock (Multi-axis Frequency Domain Weighted Block) is designed to extract features. The MFDW Block effectively decouples and expresses the difficult-to-distinguish low-contrast defect targets and backgrounds in the transform domain, and then uses Gaussian filtering to eliminate the noise blur between the defects and the background. In addition, in order to solve the scale gap problem between different objects in the defects, ADConv (Adaptive Dynamic Convolutional) is constructed for downsampling, which flexibly compresses and enhances the features, effectively widening the distinction between the features of different objects in the transform space.
[0040] The following is a detailed description of the process of the method for detecting surface defects of artificial boards provided in this embodiment, which specifically includes the following steps:
[0041] S1: Build FDADNet.
[0042] Figure 1 : is a schematic diagram of the network structure of FDADNet constructed in this embodiment. The FDADNet is an improved YOLOv5 network based on the original YOLOv5 network. The improvements to the original YOLOv5 network include: 1. Replacing the C3 module of the backbone network in the original YOLOv5 network with the MFDW module. 2. Replacing the CBS module of the backbone network in the original YOLOv5 network with the ADConv module. 3. Replacing the C3 module of the neck network in the original YOLOv5 network with the ELAN module. 4. Replacing the Conv module of the neck network in the original YOLOv5 network with the ADConv module.
[0043] The whole network consists of three parts: the backbone network, the neck network and the head network. In the backbone part, MFDWBlock is introduced as an efficient feature aggregation module to extract multi-scale image features, so as to realize the extraction and refinement of frequency domain information and spatial domain information. Next, the features (P3, P4, P5) output by the backbone network are passed to the neck network for multi-scale feature fusion and information response, and the global semantic information is enhanced through the top-down feature pyramid, and the local texture information is fused through the bottom-up path. Finally, the three detection heads in the head network perform target category classification and bounding box regression on the fused features. This multi-level detection method can enhance the model's ability to distinguish objects of different scales. In the backbone network, a combination of an ADConv and an MFDWBlock is used as a stage to extract features progressively. After four stages, the spatial scale (H×W) of the feature is gradually reduced to 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the original image, while the number of channels is gradually increased to 2C1, 4C1, 8C1 and 16C1. In the feature fusion stage, the high-level feature map is aligned with the low-level feature map by 2 times upsampling; correspondingly, the low-level feature map is fused with the high-level feature map by 2 times downsampling. This design helps to make full use of feature information at multiple scales, thereby improving the accuracy and robustness of detection. The two modules are combined in series to form a powerful feature extraction module. It is believed that the two modules achieve information complementarity and functional synergy in many aspects. First, the convolution transform based on the spatial domain can effectively process local spatial features, while the signal transform based on the frequency domain is good at capturing global frequency domain features. The two complement each other and enhance the representation ability of the model in different dimensions. Secondly, the adaptive dynamic convolution enables the model to flexibly respond to different inputs, while the multi-axis frequency domain weighting strengthens the expression ability of specific features. This combination improves the detection accuracy and robustness of the model in complex scenes. Then, the multi-axis frequency domain weighting module eliminates the ambiguity between low-contrast features and backgrounds and effectively suppresses noise, while the dynamic convolution can adaptively increase the feature spacing, enhance the semantic feature representation of small targets and maintain the integrity of their local detail information. This enables the model to effectively suppress background interference, thereby obtaining a more accurate and complete feature representation. Finally, since adaptive dynamic convolution requires the introduction of additional parameters, MFDWBlock divides the feature map into four blocks and performs feature transformations in different domains and axes respectively, thereby maintaining a low number of parameters and computational requirements. This design achieves a good trade-off between efficiency and accuracy.
[0044] The FDADNet structure is described in detail below with reference to the accompanying drawings.
[0045] Figure 2 yes Figure 1 The structural diagram of Stem in Figure 2 As shown, Figure 1The Stem in the example includes the Input layer, Conv2d (2D convolution layer, convolution kernel size k=3, convolution step size stride=2), BatchNorm (batch normalization layer) and Activation (activation function) connected in sequence.
[0046] Figure 3 (a) in the equation is Figure 1 The structural diagram of ADConv is as follows: Figure 3 As shown in (a), Figure 1 The ADConv in the method includes a convolution kernel dynamic weighting layer and an adaptive convolution layer, wherein the convolution kernel dynamic weighting layer includes an AvgPool (Average Pooling, global average pooling layer) and an FCL (Fully Connected Layer) and a Sigmoid activation function connected in sequence.
[0047] In traditional convolutional neural networks, static convolution kernels share weights for all samples and positions. This fixed weight approach can capture local features in the input. However, it may not be flexible enough when dealing with diverse and complex input data, which may lead to suboptimal features extracted by the model. Dynamic convolution, on the other hand, has higher flexibility and adaptability and is more adaptable to the diversity of input features. Usually, large and small targets may coexist in a defect image, and detectors often face the challenge of performance balance when dealing with targets of different scales. This is mainly because as the image undergoes layer-by-layer feature extraction and spatial transformation, the spatial resolution of the feature map gradually decreases, making it easier for the features of small targets to be lost. At the same time, large targets usually have stronger responses in images, and these strong response areas may drown out or fuse the subtle semantic information of small targets, thereby reducing the discrimination ability of small targets. To this end, ADConv is proposed as a downsampling module of the network to alleviate feature confusion between multi-scale targets.
[0048] Figure 3 (b) shows the workflow of ADConv. and the weight tensor Among them, C in , H and W represent the number of channels, height and width of the input feature map. The traditional convolution operation is:
[0049] Y=X*W
[0050] in, is the output, C out, H' and W' represent the number of channels, height and width of the output feature map, and * represents the convolution operation. For simplicity, the bias operation is omitted. However, the traditional convolution operation uses a fixed convolution kernel, which limits its adaptability to input features. In order to enable the convolution kernel weights to be dynamically adjusted according to the characteristics of a specific input, a mapping is created to change the weights of the convolution kernel:
[0051] Y=X*W'
[0052] W'=αW
[0053] α=softmax(FCL(Pool(X)))
[0054] Among them, α is the dynamic coefficient, and FCL(·) represents the fully connected layer. It is hoped that ADConv can enhance the expressive power of small objects, thereby increasing the semantic gap between features of different scales, so as to achieve the balanced attention of the model to multi-scale objects. To this end, the dynamic coefficient is associated with the input feature, and the dynamic weighting layer of the convolution kernel dynamically adjusts the weight of the convolution kernel in the adaptive convolution layer through the extracted features of the artificial board image to be detected, so as to adapt to the defects of different sizes in the artificial board image to be detected, and obtain an adaptive dynamic convolution kernel; the adaptive dynamic convolution kernel is convolved with the input features of the adaptive dynamic convolution module to obtain a feature map that retains the characteristics of small defects in the artificial board image to be detected. Specifically, the input feature map X is firstly globally averaged pooled in the channel dimension to aggregate the global information into a vector. Then, the dynamic coefficient is generated using FCL and the activation function, and this dynamic coefficient is element-wise multiplied with the convolution kernel weight, and then the weighted convolution kernel is used to convolve the input feature map.
[0055] ADConv dynamically adjusts the convolution kernel to adapt to targets of different scales, effectively improving the downsampling module's ability to enhance and retain small target features while avoiding excessive dominance of large target features. This method introduces more learnable parameters while maintaining low FLOPs, which not only maintains the integrity of large target information, but also significantly improves the feature expression of small targets, thereby enhancing overall detection performance.
[0056] Figure 4 (a) Figure 1 The figure below is the overall structure diagram of MFDWBlock. Figure 4 As shown in (a), Figure 1 In MFDWBlock, Conv, Split (segmentation layer), SEM (Signal Extraction Module), Concatenate (fusion layer) and Conv are composed of splicing operations. Figure 4 As shown in (b), Figure 4The Conv in (a) is composed of Conv2d, BatchNorm and SiLU activation functions connected in sequence. Figure 4 As shown in (c), Figure 4 The SEM in (a) is composed of Split, spatial-frequency domain feature extraction layer and Concatenate. The spatial-frequency domain feature extraction layer includes three parallel frequency domain feature extraction branches and one spatial domain feature extraction branch. Each frequency domain feature extraction branch is composed of an AFF (Adaptive Frequency Filters) module; the spatial domain feature extraction branch is composed of a DWConv (Depthwise Separable Convolution). Figure 4 As shown in (d) in Figure 4 The AFF in (c) is composed of a frequency domain conversion layer, a weighted denoising layer and a spatial domain conversion layer, wherein the frequency domain conversion layer converts the feature map of the input frequency domain feature extraction branch from spatial domain pixel features to frequency domain signal features through 2D Fourier transform; the weighted denoising layer performs a weighted transformation on the frequency domain signal features to expand the difference between the frequency domain signal features corresponding to defects and the frequency domain signal features corresponding to non-defects; and uses Gaussian filtering to suppress the noise of the weighted frequency domain signal features; the spatial domain conversion layer uses a two-dimensional discrete inverse Fourier transform to convert the frequency domain signal features into spatial domain pixel features.
[0057] In the surface images of artificial boards, these deep learning methods still face challenges due to the ambiguity between defects and backgrounds and the difference in defect sizes. They often misclassify when dealing with fuzzy defects and small target defects, and it is difficult to strike a good balance between efficiency and accuracy. Re-examining the problem of low separability between low-contrast defects and backgrounds, it is found that the root of these problems is that when the grayscale values of defects and backgrounds are very close, deep learning methods based on spatial domain processing often have difficulty in effectively separating foreground and background in the feature extraction module, resulting in blurred target feature boundaries, especially under the interference of complex noise, the network has difficulty distinguishing between targets and backgrounds. The detector cannot accurately extract the true defect features, resulting in false detections and missed detections. However, when processing images in the frequency domain, the sensitivity to contrast changes is low, and the frequency domain has significant advantages over spatial domain processing in noise suppression and global feature extraction.
[0058] However, although some studies have attempted to utilize frequency domain information in deep learning, if effective denoising is not performed in the frequency domain, a large amount of noise will still remain in the subsequent feature extraction process based on the spatial domain, causing noise accumulation and thus affecting the detection effect.
[0059] Based on this, this embodiment proposes a new method for feature decoupling and denoising in feature extraction through multi-axis frequency domain weighting, which can not only extract multi-axis frequency domain information, but also effectively suppress noise. By performing denoising in the frequency domain, the backbone can extract more complete object features, thereby reducing false detections and missed detections caused by blurred boundaries and noise interference. The low-contrast defects and background are transformed into the frequency domain through 2D DFT (2-Dimensional Discrete Fourier Transform) to observe their signal intensity differences. Figure 5 As shown in (a1) to (b2) in the figure, there is a large difference in signal intensity between the target and the background, which indicates that low-contrast defects that are difficult to distinguish in the spatial domain have high separability in the frequency domain, and the frequency domain is easier to remove image noise, enhance features of interest, and suppress background information. Taking advantage of this feature, the frequency domain signal transform, which is well-known for global feature extraction and noise suppression, is used to separate the target from the background while suppressing background noise, and the convolutional neural network CNN, which is good at local perception and texture feature extraction, is used to extract detailed feature information. By combining the transformation of the spatial domain and the frequency domain, it helps to enhance the feature extraction ability and spatial discrimination ability of the backbone network, enabling the model to effectively distinguish the subtle differences between the target and the background.
[0060] For a given input feature map X is first resized to output channels C through a convolution operation. out . Then, the feature map is split into two parts in the channel dimension, one of which is used to extract the frequency domain signal features through SEM. After the processing is completed, the two parts of the feature map are spliced with the output of SEM, and the number of channels is adjusted through convolution. The purpose of this design is to ensure that important spatial domain information is not lost during the conversion process, and to maximize the retention and utilization of all useful information of the input image.
[0061] Assume that the feature map input to SEM is X'∈R C×H×W In order to obtain the multi-axis frequency domain information of the feature map, X' is divided into four equal parts along the channel dimension and input into four different branches respectively. The specific process is:
[0062] x1, x2, x3, x4 = Split(X')
[0063] Among them, Split(·) represents the splitting operation along the channel dimension. x1, x2, x3 correspond to the first three branches, and each branch will be passed to AFF along the HW axis, CW axis, and CH axis for feature weighting and noise suppression. Multi-branch processing not only improves the signal perception ability of the module by parallel calculation of the frequency domain features of each branch, but also significantly improves the computational efficiency. Next, the feature map is converted to the frequency domain through 2D DFT, and the pixel features in the spatial domain are converted into signal features in the frequency domain. In the frequency domain, a learnable multi-axis weight is used to perform a weighted transformation on the signal information. Through weighted processing, the difference between the target signal and the background signal is enhanced in the frequency domain, thereby achieving feature optimization and enhancement. Subsequently, Gaussian filtering is applied in the frequency domain to suppress background noise, thereby improving the signal-to-noise ratio and making the target features clearer and more realistic. Finally, the frequency domain information is converted back to the spatial domain through 2D IDFT (2-Dimensional Inverse Discrete Fourier Transform) for subsequent processing. The AFF process is:
[0064]
[0065] Among them, W (I,J) and Represents the learnable weights and 2D DFT of the corresponding axis. ⊙ is the element product, and Gauss represents Gaussian filtering denoising. For the fourth branch, DWConv is used to obtain local features. Finally, the feature maps of the four branches are concatenated along the channel dimension, restored to the same size as the input feature map, and the final output is generated through the residual connection with the input feature map:
[0066] x4'=DW(x4)
[0067] Y=Concat(x1',x2',x3',x4)+X'
[0068] Among them, DW represents DWConv, and Concat means concatenating the feature maps along the channel dimension.
[0069] MFDWBlock can efficiently extract and enhance the multi-axis frequency domain signal of the target, while effectively suppressing background noise. Compared with traditional convolution operations, it requires fewer parameters and computation.
[0070] Figure 6 yes Figure 1 The structural diagram of ELAN is as follows: Figure 6 As shown, Figure 1The ELAN includes a Conv, a Split, two stacked Conv, a sum layer and a concat layer connected in sequence, wherein the output of the Split is connected to the input of the sum layer and the concat layer respectively.
[0071] S2: Collect images of artificial boards with tiny defects on the surface and construct a data set; use the data set to train the improved YOLOv5 network to obtain a defect detection model for detecting surface defects of artificial boards.
[0072] S201: Build a data set.
[0073] A surface defect detection dataset for artificial boards is constructed, called the AB-DET dataset. The collected data is infrared thermal imaging images with a resolution of 2048×4300. The AB-DET dataset contains five common surface defects of artificial boards, including GS (Glue Spot), OS (Oil Stains), Ch (Chalk), Sc (Scratch), and OD (Other Defects). Among them, GS is generally a black circle, with a small defect and similar grayscale value to the background; OS is generally a black irregular shape with large scale variation and uneven feature distribution; Ch defects are more obvious, generally white arcs; Sc is generally a black oblique line with a large length and width difference and low contrast; OD defects have no obvious characteristics. Since the original image obtained has a high resolution, it is cropped to 512×512 size for the sake of research.
[0074] After cropping, we get an AB-DET dataset containing 1793 images, namely the surface defect detection dataset of artificial boards. These images are divided into training set, validation set and test set with a ratio of 8:1:1. The constructed AB-DET dataset is: https: / / github.com / LazyShark2001 / FDADNet. Considering that there are a large number of small targets in the artificial board image samples, in order to balance the accuracy and computational complexity of model detection, the image size is normalized to 640×640, which makes it easier to deploy the model to edge devices.
[0075] S202: Setting training parameters.
[0076] All experiments were performed on a 16G Nvidia RTX 4060Ti GPU and Pytorch2.0.1. For each dataset, the ratio of training set, validation set, and test set was set to 8:1:1. To ensure fairness in model comparison, pre-trained weights were not used in the model training process in all ablation experiments and comparative experiments unless otherwise specified. The parameter settings during training are shown in Table 1:
[0077] Table 1 Parameter settings during training
[0078] Parameters Setup Epochs 400 NMSIoU 0.5 BatchSize 16 Standard Deviation(σ) 60 Optimizer AdamW InitialLearningRate 1.111×10-3 FinalLearningRate 1.111×10-5 Weight-Decay 5×10-4 Momentum 0.9 Mosaic 1.0 CloseMosaic Last10epochs
[0079] S203: Setting loss function and evaluation index.
[0080] The network's loss function consists of two main parts: target category loss and bounding box:
[0081] L total =λ1L class +λ2L bbox
[0082] Among them, λ1 and λ2 are coefficients used to adjust the weights of these two parts of the loss. The target category loss is calculated using binary cross entropy loss, while the bounding box loss combines CIOU (Complete Intersection over Union Loss) and distribution focus loss.
[0083] This embodiment uses the most commonly used indicators for defect detection to evaluate the test method, including precision P, recall rate R, and mAP (meanAverage Precision). In addition, in order to evaluate the complexity and size of the model, the number of floating-point operations FLOPs and the number of parameters Params are considered to evaluate the computational efficiency and complexity of the model, which must be considered for the network to be deployed on the terminal device.
[0084] S3: Input the image of the artificial board to be detected into the defect detection model, dynamically adjust the weight of the convolution kernel through the dynamic weighting layer of the convolution kernel of the adaptive dynamic convolution module in the backbone network to adapt to the defects of different sizes in the artificial board image to be detected, and obtain an adaptive dynamic convolution kernel; convolve the adaptive dynamic convolution kernel with the input feature through the adaptive convolution layer to obtain a feature map that retains the characteristics of small defects; segment the feature map that retains the characteristics of small defects through the segmentation layer in the multi-axis frequency domain weighting module to obtain 4 segmentation feature maps; extract the 3 segmentation feature maps from the three frequency domain feature extraction branches The feature map channel dimension, feature map height dimension and feature map width dimension are transformed into the frequency domain, and feature extraction is performed in the frequency domain; feature extraction is performed on the remaining segmented feature map in the spatial domain through the spatial domain feature extraction branch; the outputs of the three frequency domain feature extraction branches and one spatial domain feature extraction branch are fused through the fusion layer to obtain a spatial-frequency domain defect feature map; feature extraction and fusion are performed on the spatial-frequency domain defect feature map through the neck network to obtain an enhanced defect feature map; the enhanced defect feature map is input into the head network to output the surface defect type and surface defect position in the image of the artificial board to be detected.
[0085] This embodiment proposes a method for defect detection of artificial panels, FDADNet, based on frequency domain transformation and adaptive dynamic downsampling. Specifically, the MFDWBlock module is designed to deal with the problems of noise accumulation and boundary blur in feature extraction. MFDWBlock extracts and enhances the signal information of the target and the background from the frequency domain, making the two more separable in the frequency domain. At the same time, Gaussian filtering is used to suppress noise and reduce the impact of noise on feature expression, thereby further enhancing the expressiveness of target features. Then, ADConv is constructed for image downsampling to deal with the differences in defect size. ADConv can flexibly enhance targets of different scales by adaptively compressing and strengthening feature maps. This mechanism enables large target features and small target features to be adaptively enhanced in the transformation space, reduces feature confusion between multi-scale objects, and improves the discrimination ability of small targets, thereby achieving more balanced detection performance. The main contributions of this work include:
[0086] 1) Introducing frequency domain signal transformation into the defect detection task, a surface defect detection method for artificial panels based on frequency domain transformation and adaptive dynamic downsampling is proposed. This method uses frequency domain signal transformation to process the target and background in the feature extraction stage, so that the model exhibits strong anti-noise and discrimination capabilities.
[0087] 2) An MFDW Block is constructed for feature extraction. MFDW Block can focus on global frequency domain features, perform weighted transformation on different frequency domain signal features, and enhance the separability of the target and background. Gaussian filtering can suppress background noise, reduce noise accumulation, and enhance the feature representation ability of the object.
[0088] 3) ADConv is designed as a downsampling of feature maps, which can flexibly compress and enhance features of different categories and increase the semantic gap between features, thereby reducing feature confusion between multi-scale objects.
[0089] The above is a method for detecting surface defects of artificial boards provided by one or more embodiments of the present invention. Based on the same idea, the present invention also provides a corresponding device for detecting surface defects of artificial boards, including:
[0090] A model building module is provided, which is used to replace the C3 module of the backbone network in the original YOLOv5 network with a multi-axis frequency domain weighting module to form an improved backbone network, wherein the multi-axis frequency domain weighting module includes a segmentation layer, a spatial frequency domain feature extraction layer and a fusion layer connected in sequence, wherein the spatial frequency domain feature extraction layer includes three parallel frequency domain feature extraction branches and one spatial domain feature extraction branch; and to construct an improved YOLOv5 network including the improved backbone network, the neck network in the original YOLOv5 network and the head network in the original YOLOv5 network.
[0091] The model training module is used to collect images of artificial boards with surface defects to construct a data set; the data set is used to train the improved YOLOv5 network to obtain a defect detection model for detecting surface defects of artificial boards.
[0092] The defect detection module is used to input the image of the artificial board to be detected into the defect detection model, perform convolution operation on the image of the artificial board to be detected through the input layer of the backbone network to obtain a multi-channel feature map; segment the multi-channel feature map through the segmentation layer of the multi-axis frequency domain weighting module to obtain four segmentation feature maps; and transform three of the four segmentation feature maps into the frequency domain along the feature map height dimension, width dimension and channel dimension respectively through the three frequency domain feature extraction branches of the multi-axis frequency domain weighting module, so as to separate the frequency domains corresponding to the surface defect features of the artificial board along different dimensions in the frequency domain. The output of the frequency domain feature extraction branch and the output of the spatial domain feature extraction branch are fused with the output of the spatial domain feature extraction branch through the fusion layer of the multi-axis frequency domain weighted module to obtain a spatial-frequency domain defect feature map; the spatial-frequency domain defect feature map is enhanced through the neck network to obtain an enhanced defect feature map; the enhanced defect feature map is identified through the head network, and the surface defect type and surface defect position in the image of the artificial board to be detected are output.
[0093] The specific definition of the artificial board surface defect detection device can be found in the definition of the artificial board surface defect detection method mentioned above, which will not be repeated here. Each module in the above-mentioned artificial board surface defect detection device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0094] The present invention also provides a computer-readable storage medium, which stores a computer program. The computer program can be used to execute the above-mentioned method for detecting surface defects of artificial boards.
[0095] The present invention also provides a structure of a computer device. At the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-mentioned artificial board surface defect detection method.
[0096] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0097] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.
Claims
1. A method for detecting surface defects of artificial boards, It is characterized in that include: The C3 module of the backbone network in the original YOLOv5 network is replaced with a multi-axis frequency domain weighted module to form an improved backbone network, wherein the multi-axis frequency domain weighted module includes a segmentation layer, a space-frequency domain feature extraction layer and a fusion layer connected in sequence, and the space-frequency domain feature extraction layer includes three parallel frequency domain feature extraction branches and one space domain feature extraction branch; And construct an improved YOLOv5 network including an improved backbone network, a neck network in the original YOLOv5 network, and a head network in the original YOLOv5 network; Collect images of artificial boards with surface defects to construct a data set; use the data set to train the improved YOLOv5 network to obtain a defect detection model for detecting surface defects of artificial boards; The image of the artificial board to be detected is input into the defect detection model, and a convolution operation is performed on the image of the artificial board to be detected through the input layer of the backbone network to obtain a multi-channel feature map; the multi-channel feature map is segmented through the segmentation layer of the multi-axis frequency domain weighting module to obtain four segmentation feature maps; three of the four segmentation feature maps are converted to the frequency domain along the feature map height dimension, width dimension and channel dimension respectively through the three frequency domain feature extraction branches of the multi-axis frequency domain weighting module, so as to separate the frequency domain signals corresponding to the surface defect features of the artificial board and the frequency domain signals corresponding to the surface non-defect features of the artificial board along different dimensions in the frequency domain; the spatial domain feature extraction branch of the multi-axis frequency domain weighting module is used to extract features of the remaining segmentation feature map in the spatial domain; the output of the frequency domain feature extraction branch and the output of the spatial domain feature extraction branch are fused through the fusion layer of the multi-axis frequency domain weighting module to obtain a spatial-frequency domain defect feature map; The spatial-frequency domain defect feature map is enhanced by the neck network to obtain an enhanced defect feature map; The enhanced defect feature map is identified through the head network, and the surface defect type and surface defect position in the image of the artificial board to be detected are output.
2. The method for detecting surface defects of artificial boards according to claim 1, It is characterized in that The improved YOLOv5 network also includes: The CBS module of the backbone network in the original YOLOv5 network is replaced with an adaptive dynamic convolution module; the adaptive dynamic convolution module includes a convolution kernel dynamic weighting layer and an adaptive convolution layer connected in sequence; the convolution kernel dynamic weighting layer dynamically adjusts the weight of the convolution kernel in the adaptive convolution layer through the extracted features of the artificial board image to be detected, so as to adapt to defects of different sizes in the artificial board image to be detected, and obtain an adaptive dynamic convolution kernel; the adaptive convolution layer convolves the adaptive dynamic convolution kernel with the input features of the adaptive dynamic convolution module to obtain a feature map that retains the defect features in the artificial board image to be detected; The C3 module and Conv module of the neck network in the original YOLOv5 network are replaced by the ELAN module and the adaptive dynamic convolution module respectively; the ELAN module divides the feature map output by the backbone network into different paths to learn different feature patterns of surface defects of artificial boards in each path; and the outputs of each path are reintegrated to enhance the defect features in the feature map output by the backbone network.
3. The method for detecting surface defects of artificial boards according to claim 2, It is characterized in that The convolution kernel dynamic weighting layer specifically includes: Global average pooling layer, used to aggregate input features into a vector; A fully connected layer and activation function with short connections to the output of the global average pooling layer to generate dynamic coefficients; The weighted layer connected to the output of the activation function is used to multiply the dynamic coefficients by the convolution kernel weights element-wise.
4. The method for detecting surface defects of artificial boards according to claim 1, It is characterized in that The frequency domain feature extraction branch specifically includes: The frequency domain conversion layer is used to convert the feature map of the input frequency domain feature extraction branch from spatial domain pixel features to frequency domain signal features through 2D Fourier transform; The weighted denoising layer is used to perform a weighted transformation on the frequency domain signal features to expand the difference between the frequency domain signal features corresponding to defects and the frequency domain signal features corresponding to non-defects; and use Gaussian filtering to suppress the noise of the weighted frequency domain signal features; The spatial domain conversion layer is used to convert the frequency domain signal features into spatial domain pixel features using a two-dimensional inverse discrete Fourier transform.
5. The method for detecting surface defects of artificial boards according to claim 1, It is characterized in that The spatial feature extraction branch includes a depthwise separable convolutional layer.
6. A device for detecting surface defects of artificial boards, It is characterized in that include: A model building module, used for replacing the C3 module of the backbone network in the original YOLOv5 network with a multi-axis frequency domain weighting module to form an improved backbone network, wherein the multi-axis frequency domain weighting module includes a segmentation layer, a space-frequency domain feature extraction layer and a fusion layer connected in sequence, and the space-frequency domain feature extraction layer includes three parallel frequency domain feature extraction branches and one space domain feature extraction branch; And construct an improved YOLOv5 network including an improved backbone network, a neck network in the original YOLOv5 network, and a head network in the original YOLOv5 network; The model training module is used to collect images of artificial boards with surface defects to construct a data set; the data set is used to train the improved YOLOv5 network to obtain a defect detection model for detecting surface defects of artificial boards; The defect detection module is used to input the image of the artificial board to be detected into the defect detection model, perform convolution operation on the image of the artificial board to be detected through the input layer of the backbone network, and obtain a multi-channel feature map; segment the multi-channel feature map through the segmentation layer of the multi-axis frequency domain weighting module to obtain four segmentation feature maps; transform three of the four segmentation feature maps into the frequency domain along the feature map height dimension, width dimension and channel dimension respectively through the three frequency domain feature extraction branches of the multi-axis frequency domain weighting module, so as to separate the frequency domain signals corresponding to the surface defect features of the artificial board and the frequency domain signals corresponding to the surface non-defect features of the artificial board along different dimensions in the frequency domain; perform feature extraction on the remaining segmentation feature map in the spatial domain through the spatial domain feature extraction branch of the multi-axis frequency domain weighting module; fuse the output of the frequency domain feature extraction branch and the output of the spatial domain feature extraction branch through the fusion layer of the multi-axis frequency domain weighting module to obtain a spatial-frequency domain defect feature map; The spatial-frequency domain defect feature map is enhanced by the neck network to obtain an enhanced defect feature map; The enhanced defect feature map is identified through the head network, and the surface defect type and surface defect position in the image of the artificial board to be detected are output.
7. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
8. A computer device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of claims 1 to 5 is implemented.
Citation Information
Cited By
Defect detection method and system for glass fiber gridding cloth
CN119688699A
Method for detecting internal defects of carbon fiber honeycomb material
CN119963920A
Method for detecting internal defects in carbon fiber honeycomb material
CN119963920B
Cross-gate operation identification method and device based on deep learning, electronic equipment and program product
CN120182720A
Artificial board surface defect intelligent detection method and system based on machine vision
CN120355688A
