Wood water paint surface defect detection method based on computer vision

By introducing wavelet convolution module and multi-scale feature fusion network into the wood water-based paint defect detection model, the shortcomings of existing models in multi-scale defect detection and data diversity are solved, and more efficient feature capture and detection accuracy is achieved.

CN119831958APending Publication Date: 2025-04-15NORTHEAST FORESTRY UNIV +1
View PDF 0 Cites 10 Cited by

Patent Information

Application Number
CN202411902212.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The existing deep learning models have large parameters, high computational complexity, feature extraction methods can only capture single-scale features, poor detection of multi-scale defects, small data set size and lack diversity and representativeness, resulting in poor generalization ability of the model in practical applications.

Method used

By introducing wavelet convolution module (WTConv) and multi-scale feature fusion network (such as BIFPN), the model's ability to capture multi-scale features is enhanced. The WTConv module enhances the multi-scale feature representation of the image through wavelet transformation, reducing the computational complexity. The AIFI module optimizes feature expression through a multi-head self-attention mechanism.

Benefits of technology

The model's detection accuracy of defects of different types and sizes is improved, the parameter quantity and calculation burden are reduced, the feature fusion effect is enhanced, and the model's ability to identify multi-scale targets is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119831958A_ABST
    Figure CN119831958A_ABST
Patent Text Reader

Abstract

The invention discloses a wood water-based paint surface defect detection method based on computer vision, and belongs to the technical field of wood paint surface detection, and the method comprises the following steps: S1, constructing a wood paint surface defect data set including four typical defects of bubbles, cracks, holes and scratches; s2, introducing a wavelet convolution module to improve the Backbone network, enhancing the image feature capture capability, and avoiding the excessive parameterization problem of a traditional method; s2.1, a wavelet convolution module (WTConv) is added into a Basic Block of the ResNet network, and a feature extraction unit is improved, so that the capability of the network for capturing paint surface defect features is enhanced, and meanwhile, the calculation complexity is reduced; and S2.2, the wavelet convolution module enhances the multi-scale feature representation of the image through wavelet transform. And S3, designing an AIFI module, and optimizing a feature fusion effect through a multi-scale capture mechanism based on K and V feature information. According to the method, the multi-scale feature capturing capability of the model is enhanced, and the detection precision of defects of different types and sizes is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of wood paint surface detection, in particular to a method for detecting wood water-based paint surface defects based on computer vision. Background Art

[0002] With the increasingly stringent environmental regulations and the advancement of sustainable development goals, water-based paint has attracted widespread attention due to its low volatile organic compound (VOC) emission characteristics, and has gradually replaced traditional oil-based paint and become the mainstream choice in the wood coating industry. After spraying water-based paint on the wood surface, defect detection is a key link to ensure product quality. Effective defect detection methods can detect and repair defects in a timely manner, improving the product's pass rate and market competitiveness.

[0003] Traditional defect detection methods mainly rely on manual visual inspection, which has problems such as low efficiency, strong subjectivity and easy fatigue. In recent years, with the development of computer vision and deep learning technology, image-based automatic defect detection methods have gradually become a research hotspot. These methods collect and analyze images of wood surfaces, automatically identify and classify various defects, and greatly improve the efficiency and accuracy of detection.

[0004] Existing deep learning models usually have a large number of parameters and high computational complexity, making it difficult to achieve real-time detection on resource-limited embedded devices. At the same time, feature extraction methods can often only capture features at a single scale and are not effective for multi-scale defect detection. The data sets are usually small in scale and lack diversity and representativeness, resulting in poor generalization ability of the model in practical applications. Summary of the invention

[0005] The purpose of the present invention is to provide a method for detecting wood water-based paint surface defects based on computer vision to solve the problems raised in the background technology.

[0006] To achieve the above object, the present invention provides the following technical solution: a method for detecting wood water-based paint defects based on computer vision, comprising the following steps:

[0007] S1: Construct a wood paint defect dataset, including four typical defects: bubbles, cracks, holes and scratches, each of which contains at least 1,000 images;

[0008] S2: Introduce the wavelet convolution module (WTConv) to improve the Backbone network, enhance the image feature capture capability, and avoid the over-parameterization problem of traditional methods;

[0009] S2.1: Add a wavelet convolution module (WTConv) to the BasicBlock of the ResNet network to enhance the network’s ability to capture paint defect features and reduce computational complexity by improving the feature extraction unit;

[0010] S2.2: The wavelet convolution module (WTConv) enhances the multi-scale feature representation of the image through wavelet transform. The formula is as follows:

[0011] W conv (f) = ∫f(x)ψ(xy)dx

[0012] Where f(x) is the input image and ψ(xy) is the wavelet basis function.

[0013] S3: Design the AIFI module to optimize the feature fusion effect through a multi-scale capture mechanism based on K and V feature information;

[0014] S3.1: Introduce a combination of AIFI module and multi-head self-attention mechanism (M2SA) in the encoder part to optimize the expressive power of input K and V features

[0015] S3.2: The AIFI module retains and strengthens feature information of different scales through a multi-scale feature capture mechanism, thereby enhancing the ability to recognize multi-scale targets.

[0016] Preferably, in this solution, S3 also includes a multi-head self-attention mechanism, and its formula is as follows:

[0017]

[0018] Where Q is the query vector, K is the key vector, V is the value vector, and d k is the dimension of the key vector.

[0019] Preferably, the detection method of the present invention further comprises using a multi-scale weighted fusion feature pyramid network (BIFPN) and a global heterogeneous kernel selection module (CMSCB) to further enhance the feature fusion effect.

[0020] Preferably, the fusion of the multi-scale weighted fusion feature pyramid network and the global heterogeneous kernel selection module of this scheme includes: adopting the multi-scale feature weighted fusion strategy in the BIFPN network structure, replacing the traditional additive connection with channel splicing to reduce the number of parameters and the computational burden, and combining the global heterogeneous kernel selection mechanism (MSDC), according to the requirements of different scale feature layers, adaptively selecting and weightedly fusing suitable convolution kernels, gradually accumulating multi-scale features, and avoiding the loss of small-size target information.

[0021] In this solution, the formula for combining the global heterogeneous nuclear selection mechanism is as follows:

[0022]

[0023] Among them, F i is the feature map of the i-th layer, wj is the weight coefficient, Conv(F j ,k j ) is the convolution operation, k j is the convolution kernel.

[0024] In this solution, the detection method further includes introducing an efficient upsampling module (EUCB) and a parallel downsampling module (AtDown) combined with a gating mechanism to optimize detail feature retention and improve the detection accuracy of the model for small target defects, specifically including: designing an efficient upsampling module EUCB, combining deep separable convolution with batch normalization technology, retaining detail information of small target features on the paint surface during the upsampling process, so as to ensure sensitivity and recognition accuracy for small defect targets, and the upsampling module formula is as follows:

[0025] U(F)=DepthwiseConv(F)+BatchNorm(F)

[0026] Among them, F is the input feature map, DepthwiseConv(F) is the depthwise separable convolution operation, and BatchNorm(F) is the batch normalization operation.

[0027] The preferred solution of this invention is to design a parallel branch downsampling module, enrich the diversity of feature expression through multiple feature extraction paths, select the extracted features in combination with the Gate mechanism, screen out key features to suppress redundant information, and improve the quality of feature expression. The formula of the parallel downsampling module combined with the gate mechanism is as follows: D(F)=Gate(Conv 1 (F),Conv 2 (F),…,Conv n (F)

[0028] Among them, F is the input feature map, Conv i (F) is the i-th convolution operation, and Gate is the gating mechanism.

[0029] The preferred method of this scheme is to apply water-based paint on a homemade sprayable wooden board, collect paint surface images, and ensure that the images are clear and unobstructed; obtain paint surface images of actual wooden products from the production workshop, covering defects under different materials and process conditions; screen and annotate the collected images, and finally construct a wood paint surface defect dataset containing four types of defects: bubbles, cracks, holes, and scratches, with each type of defect containing at least 1,000 images; perform data enhancement processing on the dataset, including image darkening, brightening, adding Gaussian noise, adding salt and pepper noise, rotating, horizontally flipping, and vertically flipping, and expand the dataset to 12,400 images to improve the generalization ability of the model; and uniformly adjust the image resolution to 640×640 pixels to improve training efficiency.

[0030] Preferably, the detection method also includes: developing an adaptive threshold segmentation algorithm, dynamically adjusting the threshold according to local image features to improve the segmentation accuracy of defective areas, using a generative adversarial network (GAN) to generate more high-quality defect samples, enhancing the diversity and representativeness of the data set, using a pre-trained deep learning model for transfer learning to quickly adapt to wood paint defect detection tasks, and designing a real-time online learning mechanism, so that the model continuously learns new samples during the detection process and gradually optimizes its own performance.

[0031] Preferably, the detection method of this scheme also includes: constructing a multi-task learning framework to perform defect classification and positioning tasks simultaneously, sharing the feature extraction layer to improve the overall performance of the model, developing adaptive data enhancement technology to dynamically adjust the data enhancement strategy according to the characteristics of the defect type, improving the diversity and quality of the data set, and using self-supervised learning methods to perform pre-training through unlabeled data to improve the feature extraction capability of the model.

[0032] Compared with the prior art, the technical effects and advantages of the present invention are as follows:

[0033] This computer vision-based wood water-based paint defect detection method enhances the model's ability to capture multi-scale features and improves the detection accuracy of defects of different types and sizes by introducing a wavelet convolution module (WTConv) and a multi-scale feature fusion network (such as BIFPN). The WTConv module enhances the multi-scale feature representation of the image through wavelet transform, while reducing the computational complexity and avoiding the over-parameterization problem of traditional methods. The AIFI module optimizes feature expression through a multi-head self-attention mechanism to improve the model's ability to capture complex features.

[0034] The WTConv module is added to the BasicBlock of the ResNet network. The input image is decomposed into multiple scales by discrete wavelet transform (DWT), and features of different scales are extracted. Then, the multi-scale feature map is formed by channel splicing. This step significantly enhances the model's ability to capture multi-scale features and improves the detection accuracy of defects of different types and sizes. A multi-scale weighted fusion strategy is adopted to fuse feature maps of different scales through channel splicing and weighted fusion to form a multi-scale feature map. This step reduces the number of parameters and the computational burden, while improving the effect of feature fusion and enhancing the model's ability to recognize multi-scale targets. The combination of the AIFI module and the multi-head self-attention mechanism is introduced in the encoder part to optimize the expression ability of the input K and V features. By calculating the similarity matrix between Q and K and normalizing it through the softmax function, the attention weight matrix is ​​obtained, and then multiplied by the value vector to obtain the weighted feature map. This step improves the quality of feature expression and enhances the model's ability to capture complex features.

[0035] The dataset is constructed by using images of homemade and actually produced wood products, covering defects under different materials and process conditions, and improving the diversity and representativeness of the dataset. By performing various data enhancement processing on the dataset, the diversity and generalization ability of the dataset are increased, and the robustness and adaptability of the model are improved. Water-based paint is applied to homemade sprayable wood boards, and paint surface images are collected. Paint surface images of actual wood products are obtained from the production workshop to ensure that the images are clear and unobstructed. The collected images are screened and annotated, and finally a wood paint surface defect dataset containing four types of defects: bubbles, cracks, holes, and scratches is constructed, with each type of defect containing at least 1,000 images.

[0036] By combining the data collected by optical cameras and infrared cameras and using multimodal data fusion technology, information about the wood surface can be obtained from multiple angles and dimensions. The optical camera captures surface texture information, and the infrared camera captures temperature distribution information. The combination of the two can more comprehensively reflect the state of the wood surface, especially for the detection of hidden defects such as internal cracks. Multimodal data fusion technology can reduce the uncertainty and noise impact brought by single-modal data and improve the robustness and stability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 This is an example image of paint surface defects of the present invention;

[0039] Figure 2 It is a data set analysis diagram of the present invention;

[0040] Figure 3 This is the MFWL-DETR network model diagram of the present invention;

[0041] Figure 4 The WTConv module network structure of the present invention;

[0042] Figure 5 Generate a structural module diagram for K and V of the present invention;

[0043] Figure 6 The improved KVG-AIFI module structure diagram of the present invention;

[0044] Figure 7 It is the structural diagram of BIFPN of the present invention;

[0045] Figure 8 The improved CMSCB network structure diagram of the present invention;

[0046] Fig. 9 It is a structural diagram of the EUCB module of the present invention;

[0047] Fig.10 It is the structural diagram of the AtDown module of the present invention;

[0048] Fig.11 This is the improved backbone position diagram of the present invention;

[0049] Fig.12 It is a visual detection comparison diagram of the present invention;

[0050] Fig.13 This is a comparison diagram of thermal detection of the present invention;

[0051] Fig.14 It is the training curve diagram of the model Precision and mAP50 of the present invention;

[0052] Fig.15 The present invention is a flow chart of a method for detecting wood water-based paint defects based on computer vision. DETAILED DESCRIPTION

[0053] In the following description, a large number of specific details are provided to provide a more thorough understanding of the present invention. However, it is apparent to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present invention, some technical features well known in the art are not described.

[0054] Unless otherwise defined, the up, down, left, right, front, back, inside and outside directions involved in this document are based on the up, down, left, right, front, back, inside and outside directions in the figures shown in the present invention, and are explained here together.

[0055] This embodiment provides Figures 1 to 15 A method for detecting wood water-based paint defects based on computer vision is shown, comprising the following steps:

[0056] S1: Construct a wood paint defect dataset, including four typical defects: bubbles, cracks, holes and scratches, each of which contains at least 1,000 images;

[0057] S2: Introduce the wavelet convolution module (WTConv) to improve the Backbone network, enhance the image feature capture capability, and avoid the over-parameterization problem of traditional methods;

[0058] S2.1: Add a wavelet convolution module (WTConv) to the BasicBlock of the ResNet network to enhance the network’s ability to capture paint defect features and reduce computational complexity by improving the feature extraction unit;

[0059] S2.2: The wavelet convolution module (WTConv) enhances the multi-scale feature representation of the image through wavelet transform. The formula is as follows:

[0060] W conv (f) = ∫f(x)ψ(xy)dx

[0061] Where f(x) is the input image and ψ(xy) is the wavelet basis function.

[0062] S3: Design the AIFI module to optimize the feature fusion effect through a multi-scale capture mechanism based on K and V feature information;

[0063] S3.1: Introduce a combination of AIFI module and multi-head self-attention mechanism (M2SA) in the encoder part to optimize the expressiveness of the input K and V features;

[0064] The specific steps include: using linear transformation to convert the input feature map into a query vector (Q), a key vector (K), and a value vector (V); calculating the similarity matrix between Q and K, and normalizing it through the softmax function to obtain the attention weight matrix; multiplying the attention weight matrix with the value vector to obtain a weighted feature map; using the multi-head self-attention mechanism, the input feature map is divided into multiple subspaces, the attention weights are calculated separately, and then the results of multiple subspaces are spliced ​​together to form a multi-scale feature map. The formula of the AIFI module is as follows:

[0065]

[0066] Where Q is the query vector, K is the key vector, V is the value vector, and d k is the dimension of the key vector.

[0067] S3.2: The AIFI module retains and strengthens feature information of different scales through a multi-scale feature capture mechanism, thereby enhancing the ability to recognize multi-scale targets.

[0068] In this embodiment, S3 also includes a multi-head self-attention mechanism, and its formula is as follows:

[0069]

[0070] Where Q is the query vector, K is the key vector, V is the value vector, and d k is the dimension of the key vector.

[0071] In this embodiment, the detection method also includes using a multi-scale weighted fusion feature pyramid network (BIFPN) and a global heterogeneous kernel selection module (CMSCB) to further enhance the feature fusion effect.

[0072] In this embodiment, by introducing a wavelet convolution module (WTConv) and a multi-scale feature fusion network (such as BIFPN), the model's ability to capture multi-scale features is enhanced, and the detection accuracy of defects of different types and sizes is improved. The WTConv module enhances the multi-scale feature representation of the image through wavelet transform, while reducing the computational complexity and avoiding the over-parameterization problem of traditional methods. The AIFI module optimizes feature expression through a multi-head self-attention mechanism and improves the model's ability to capture complex features.

[0073] In this embodiment, a WTConv module is added to the BasicBlock of the ResNet network, and the input image is decomposed at multiple scales by discrete wavelet transform (DWT), and features of different scales are extracted, and then a multi-scale feature map is formed by channel splicing. This step significantly enhances the model's ability to capture multi-scale features and improves the detection accuracy of defects of different types and sizes. A multi-scale weighted fusion strategy is adopted, and feature maps of different scales are fused through channel splicing and weighted fusion to form a multi-scale feature map. This step reduces the number of parameters and the computational burden, while improving the effect of feature fusion and enhancing the model's ability to recognize multi-scale targets. A combination of the AIFI module and the multi-head self-attention mechanism is introduced in the encoder part to optimize the expression ability of the input K and V features. By calculating the similarity matrix between Q and K and normalizing it through the softmax function, the attention weight matrix is ​​obtained, and then multiplied by the value vector to obtain a weighted feature map. This step improves the quality of feature expression and enhances the model's ability to capture complex features.

[0074] In this embodiment, the input image is decomposed into multiple scales by discrete wavelet transform (DWT), and features of different scales are extracted to enhance the model's ability to represent multi-scale features. Redundant features are reduced by low-frequency filters, parameter expansion problems caused by using larger convolution kernels are avoided, and computational complexity is reduced.

[0075] In this embodiment, discrete wavelet transform (DWT): the input image is decomposed into multiple scales to obtain sub-band images of different frequencies. Each sub-band image is convolved to extract features of different scales, and then a multi-scale feature map is formed through channel splicing. This step significantly enhances the model's ability to represent multi-scale features.

[0076] In this embodiment, low-frequency filter: The low-frequency filter is used to reduce redundant features, avoid the parameter expansion problem caused by using a larger convolution kernel, and reduce the computational complexity. This step improves the computational efficiency of the model and reduces the number of parameters.

[0077] In this embodiment, the fusion of the multi-scale weighted fusion feature pyramid network and the global heterogeneous kernel selection module includes: adopting the multi-scale feature weighted fusion strategy in the BIFPN network structure, replacing the traditional additive connection with channel splicing to reduce the number of parameters and the computational burden, and combining the global heterogeneous kernel selection mechanism (MSDC), according to the requirements of different scale feature layers, adaptively selecting and weightedly fusing suitable convolution kernels, gradually accumulating multi-scale features, and avoiding the loss of small-size target information.

[0078] In this embodiment, the multi-scale feature weighted fusion strategy in the BIFPN network structure specifically includes: performing upsampling and downsampling operations between feature maps of different scales so that feature maps of different scales have the same resolution; fusing feature maps of different scales by channel splicing to form a multi-scale feature map; and assigning different weights according to the importance of each feature map through a weighted fusion strategy to avoid interference from redundant information. The formula of the BIFPN network structure is as follows:

[0079]

[0080] Among them, F i is the feature map of the i-th layer, w j is the weight coefficient, Conv(F j ,k j ) is the convolution operation, k j is the convolution kernel.

[0081] In this embodiment, the feature expression is optimized by a multi-head self-attention mechanism to improve the model's ability to capture complex features. Through the multi-scale feature capture mechanism, feature information of different scales is retained and strengthened, and the ability to recognize multi-scale targets is enhanced. The input feature map is converted into a query vector (Q), a key vector (K), and a value vector (V) using a linear transformation. The similarity matrix between Q and K is calculated and normalized by a softmax function to obtain an attention weight matrix. The attention weight matrix is ​​multiplied by the value vector to obtain a weighted feature map. This step optimizes the feature expression and improves the model's ability to capture complex features. Through the multi-scale feature capture mechanism, feature information of different scales is retained and strengthened, and the ability to recognize multi-scale targets is enhanced. This step improves the generalization and robustness of the model.

[0082] In this embodiment, the traditional addition connection is replaced by channel splicing through a multi-scale weighted fusion strategy to reduce the number of parameters and the computational burden. Through the weighted fusion strategy, different weights are assigned according to the importance of each feature map to avoid the interference of redundant information and enhance the feature fusion effect.

[0083] In this embodiment, multi-scale weighted fusion: upsampling and downsampling operations are performed between feature maps of different scales so that feature maps of different scales have the same resolution. Feature maps of different scales are fused using channel splicing to form a multi-scale feature map. This step reduces the number of parameters and the computational burden, while improving the effect of feature fusion.

[0084] In this embodiment, weighted fusion strategy: through the weighted fusion strategy, different weights are assigned according to the importance of each feature map to avoid the interference of redundant information. This step enhances the effect of feature fusion and improves the detection accuracy and robustness of the model.

[0085] In this embodiment, the global heterogeneous core selection mechanism formula is as follows:

[0086]

[0087] Among them, F i is the feature map of the i-th layer, w j is the weight coefficient, Conv(F j ,k j ) is the convolution operation, k j is the convolution kernel.

[0088] In this embodiment, the detection method also includes introducing an efficient upsampling module (EUCB) and a parallel downsampling module (AtDown) combined with a gating mechanism to optimize detail feature retention and improve the detection accuracy of the model for small target defects. Specifically, it includes: designing an efficient upsampling module EUCB, combining deep separable convolution with batch normalization technology, and retaining the detail information of small target features on the paint surface during the upsampling process to ensure sensitivity and recognition accuracy for small defect targets. The upsampling module formula is as follows:

[0089] U(F)=DepthwiseConv(F)+BatchNorm(F)

[0090] Among them, F is the input feature map, DepthwiseConv(F) is the depthwise separable convolution operation, and BatchNorm(F) is the batch normalization operation.

[0091] In this embodiment, the specific implementation method of the efficient upsampling module (EUCB) is as follows: an efficient upsampling module EUCB is designed, and the detailed information of the small target features of the paint surface is retained during the upsampling process in combination with the deep separable convolution and batch normalization technology to ensure the sensitivity and recognition accuracy of small defect targets. The specific steps include: using the deep separable convolution to perform a convolution operation on the input feature map to reduce the amount of calculation and the amount of parameters; using the batch normalization technology to normalize the feature map after convolution to improve the stability and generalization ability of the feature map; upsampling the feature map by bilinear interpolation or nearest neighbor interpolation to restore the resolution of the feature map; the formula of the EUCB module is as follows:

[0092] U(F)=DepthwiseConv(F)+BatchNorm(F)

[0093] Among them, F is the input feature map, DepthwiseConv(F) is the depthwise separable convolution operation, and BatchNorm(F) is the batch normalization operation.

[0094] In this embodiment, the detailed information of the features of small targets on the paint surface is retained during the upsampling process through the deep separable convolution and batch normalization technology, thereby improving the sensitivity and recognition accuracy of targets with small defects. The deep separable convolution reduces the amount of calculation and the amount of parameters, thereby improving the computational efficiency of the model. The deep separable convolution is used to perform convolution operations on the input feature map to reduce the amount of calculation and the amount of parameters. This step improves the computational efficiency of the model and reduces the amount of parameters. The batch normalization technology is used to normalize the feature map after convolution to improve the stability and generalization ability of the feature map. This step improves the robustness and generalization ability of the model. The feature map is upsampled through bilinear interpolation or nearest neighbor interpolation to restore the resolution of the feature map. This step retains the detailed information of the features of small targets on the paint surface and improves the sensitivity and recognition accuracy of targets with small defects.

[0095] In this embodiment, a parallel branch downsampling module is designed to enrich the diversity of feature expression through multiple feature extraction paths, and the extracted features are selected in combination with the Gate mechanism to screen out key features to suppress redundant information and improve the quality of feature expression. The formula of the parallel downsampling module combined with the gate mechanism is as follows: D(F)=Gate(Conv 1 (F),Conv 2 (F),…,Conv n (F)

[0096] Among them, F is the input feature map, Conv i(F) is the i-th convolution operation, and Gate is the gating mechanism. The specific implementation of the parallel downsampling module (AtDown) is as follows: design a parallel branch downsampling module to enrich the diversity of feature expression through multiple feature extraction paths. The specific steps include: using multiple parallel convolution paths to perform convolution operations on the input feature map, and each path uses a convolution kernel of different sizes; downsampling the convolved feature map through maximum pooling or average pooling operations to reduce the resolution of the feature map; using the Gate mechanism to select the feature maps of multiple paths, filter out key features, and suppress redundant information; the formula of the AtDown module is as follows:

[0097] D(F)=Gate(Conv 1 (F),Conv 2 (F),…,Conv n (F)

[0098] Among them, F is the input feature map, Conv i (F) is the i-th convolution operation, and Gate is the gating mechanism.

[0099] In this embodiment, multiple feature extraction paths are used to enrich the diversity of feature expression and improve the model's ability to capture features of different scales. The feature graphs of multiple paths are selected through the Gate mechanism to screen out key features, suppress redundant information, and improve the quality of feature expression.

[0100] In this embodiment, multiple feature extraction paths: use multiple parallel convolution paths to perform convolution operations on the input feature map, and each path uses convolution kernels of different sizes. The convolved feature map is downsampled through maximum pooling or average pooling operations to reduce the resolution of the feature map. This step enriches the diversity of feature expression and improves the model's ability to capture features of different scales.

[0101] In this embodiment, the Gate mechanism: The Gate mechanism is used to select feature graphs of multiple paths, filter out key features, and suppress redundant information. This step improves the quality of feature expression and enhances the robustness and generalization ability of the model.

[0102] In this embodiment, water-based paint is applied to a homemade sprayable wooden board, and paint surface images are collected to ensure that the images are clear and unobstructed; paint surface images of actual wooden products are obtained from the production workshop, covering defects under different materials and process conditions; the collected images are screened and annotated, and finally a wood paint surface defect dataset containing four types of defects, namely bubbles, cracks, holes and scratches, is constructed, and each type of defect contains at least 1,000 images; data enhancement processing is performed on the dataset, including image darkening, brightening, adding Gaussian noise, adding salt and pepper noise, rotation, horizontal flipping, and vertical flipping, and the dataset is expanded to 12,400 images to improve the generalization ability of the model; the image resolution is uniformly adjusted to 640×640 pixels to improve training efficiency.

[0103] In this embodiment, the specific implementation method of the wavelet convolution module (WTConv) is as follows: adding the WTConv module to the BasicBlock of the ResNet network, improving the feature extraction unit, enhancing the network's ability to capture paint surface defect features, and reducing the computational complexity. The WTConv module enhances the multi-scale feature representation of the image through wavelet transform. The specific steps include: using discrete wavelet transform (DWT) to perform multi-scale decomposition on the input image to obtain sub-band images of different frequencies, performing convolution operations on each sub-band image to extract features of different scales, channel splicing the extracted features to form a multi-scale feature map, and reducing redundant features through low-frequency filters to avoid the parameter expansion problem caused by using larger convolution kernels. The wavelet convolution module formula is as follows: W conv (f) = ∫f(x)ψ(xy)dx

[0104] Where f(x) is the input image and ψ(xy) is the wavelet basis function.

[0105] In this embodiment, the model uses a variety of data enhancement techniques during the training process, including image darkening, brightening, adding Gaussian noise, adding salt and pepper noise, rotation, horizontal flipping, vertical flipping, etc., to improve the generalization ability and adaptability of the model. The specific steps include:

[0106] Use random brightness and contrast adjustments to simulate images under different lighting conditions;

[0107] Add Gaussian noise and salt and pepper noise to simulate the noise interference in actual shooting;

[0108] Perform random rotation and translation operations to increase the model's robustness to different viewpoints and positions;

[0109] Perform horizontal and vertical flip operations to increase the model's ability to recognize symmetrical features;

[0110] Use cropping and scaling operations to simulate images of different resolutions and ratios.

[0111] The model uses a custom loss function during training, including the MPDIoU loss function, to optimize the detection performance of the model. The specific steps include:

[0112] Use the cross-extraction loss function to calculate the classification loss between the predicted box and the true box;

[0113] Use the bounding box regression loss function to calculate the position loss between the predicted box and the true box;

[0114] The MPDIoU loss function is used to calculate the overlap loss between the predicted box and the true box. The formula is as follows:

[0115]

[0116] Among them, P i is the i-th prediction box, T i is the i-th true box, and N is the number of predicted boxes.

[0117] The classification loss, position loss and overlap loss are combined into a total loss function by weighted summation to optimize the overall performance of the model.

[0118] In this embodiment, the model achieved high detection accuracy and computational efficiency during the test process, with the number of parameters reduced by 40.2%, the amount of computation reduced by 40.5%, and the weight size reduced by 36.1%, meeting the needs of real-time detection. The specific steps include:

[0119] Evaluate the detection accuracy of the model on the test set, including indicators such as precision, recall, and mean average precision (mAP);

[0120] Calculate the model's processing frames per second (FPS) to evaluate the model's real-time processing capabilities;

[0121] Calculate the number of floating point operations (GFLOPs) of the model to evaluate the computational complexity of the model;

[0122] Calculate the model weights and assess the model storage requirements;

[0123] Experimental results show that the improved model significantly reduces the number of parameters and computation while maintaining detection accuracy. It is suitable for deployment in embedded devices and shows good versatility and deployment flexibility.

[0124] In this embodiment, water-based paint is applied to a homemade sprayable wooden board, the paint surface image is collected, and the paint surface image of the actual wood product is obtained from the production workshop to ensure that the image is clear and unobstructed. The collected images are screened and annotated, and finally a wood paint surface defect dataset containing four types of defects: bubbles, cracks, holes, and scratches is constructed, and each type of defect contains at least 1,000 images. The dataset is enhanced, including image darkening, brightening, adding Gaussian noise, adding salt and pepper noise, rotation, horizontal flipping, vertical flipping, etc., to expand the dataset to 12,400 images. This step significantly increases the diversity and generalization ability of the dataset, and improves the robustness and adaptability of the model.

[0125] In this embodiment, multiple data enhancement techniques are used to increase the diversity and generalization ability of the data set, and improve the robustness and adaptability of the model. Random brightness and contrast adjustment, addition of Gaussian noise and salt and pepper noise, random rotation and translation operations, horizontal and vertical flip operations, cropping and scaling operations, etc. are used to simulate different conditions and interferences in actual shooting, and improve the robustness and adaptability of the model.

[0126] In this embodiment, the data enhancement operations are as follows: random brightness and contrast adjustments are used to simulate images under different lighting conditions. Gaussian noise and salt and pepper noise are added to simulate noise interference in actual shooting. Random rotation and translation operations are performed to increase the robustness of the model to different viewing angles and positions. Horizontal and vertical flip operations are performed to increase the model's ability to recognize symmetrical features. Cropping and scaling operations are used to simulate images of different resolutions and scales. This step significantly increases the diversity and generalization ability of the dataset, and improves the robustness and adaptability of the model.

[0127] In this embodiment, the detection performance of the model is optimized and the overall performance of the model is improved by using a custom loss function, including the MPDIoU loss function. The classification loss, position loss and overlap loss are combined into a total loss function by weighted summation to optimize the overall performance of the model.

[0128] In this embodiment, classification loss: the classification loss between the predicted box and the true box is calculated using the cross entropy loss function. This step optimizes the classification performance of the model. Position loss: the position loss between the predicted box and the true box is calculated using the bounding box regression loss function. This step optimizes the position regression performance of the model. Overlap loss: the overlap loss between the predicted box and the true box is calculated using the MPDIoU loss function. The classification loss, position loss, and overlap loss are combined into a total loss function by weighted summation to optimize the overall performance of the model. This step improves the detection accuracy and robustness of the model.

[0129] In this embodiment, the detection performance of the model is optimized by evaluating the detection accuracy of the model on the test set, including indicators such as precision, recall, and mean average precision (mAP). The computational efficiency and storage requirements of the model are evaluated by calculating the model's frames per second (FPS), number of floating-point operations (GFLOPs), and weight size, and the computational efficiency and deployment flexibility of the model are optimized.

[0130] In this embodiment, detection accuracy evaluation: the detection accuracy of the model is evaluated on the test set, including indicators such as precision, recall, and mean average precision (mAP). This step optimizes the detection performance of the model and improves the detection accuracy of the model. The number of frames per second (FPS) processed by the model is calculated to evaluate the real-time processing capability of the model. The number of floating-point operations (GFLOPs) of the model is calculated to evaluate the computational complexity of the model. The weight of the model is calculated to evaluate the storage requirements of the model. Experimental results show that the improved model significantly reduces the number of parameters and calculations while maintaining detection accuracy. It is suitable for deployment in embedded devices and shows good versatility and deployment flexibility.

[0131] In this embodiment, the detection method also includes: constructing a multimodal data fusion system, combining the data collected by the optical camera and the infrared camera, using multimodal data fusion technology to improve the accuracy and robustness of defect detection, developing an adaptive threshold segmentation algorithm, dynamically adjusting the threshold according to the local features of the image, improving the segmentation accuracy of the defect area, using a generative adversarial network (GAN) to generate more high-quality defect samples, enhancing the diversity and representativeness of the data set, using a pre-trained deep learning model for transfer learning, quickly adapting to the task of wood paint defect detection, and designing a real-time online learning mechanism. The model continuously learns new samples during the detection process and gradually optimizes its own performance.

[0132] In this embodiment, the specific steps of the multimodal data fusion system include: (1) using an optical camera to collect visible light images of the wood surface to obtain surface texture information; (2) using an infrared camera to collect infrared images of the wood surface to obtain temperature distribution information; (3) aligning the visible light image and the infrared image to ensure the spatial consistency of the two; (4) using a feature fusion method, such as early fusion, late fusion or multi-layer fusion, to fuse the visible light features and the infrared features to generate a multimodal feature map; (5) inputting the multimodal feature map into a deep learning model for defect detection.

[0133] In this embodiment, by combining the data collected by the optical camera and the infrared camera, the information of the wood surface can be obtained from multiple angles and dimensions using multimodal data fusion technology. The optical camera captures the surface texture information, and the infrared camera captures the temperature distribution information. The combination of the two can more comprehensively reflect the state of the wood surface, especially for the detection of hidden defects such as internal cracks. Multimodal data fusion technology can reduce the uncertainty and noise effects brought by single modal data and improve the robustness and stability of the model. First, the visible light image and infrared image of the wood surface are collected respectively using an optical camera and an infrared camera, and then the spatial consistency of the two is ensured by alignment. Then, the visible light features and infrared features are fused using a feature fusion method (such as early fusion, late fusion or multi-layer fusion) to generate a multimodal feature map. Finally, the multimodal feature map is input into the deep learning model for defect detection. Multimodal data fusion enables the model to more accurately identify and locate defects, especially under complex background and lighting conditions, and the detection effect is more stable and reliable.

[0134] In this embodiment, multimodal data fusion can not only improve the accuracy of detection, but also enhance the ability to identify different types of defects. For example, some defects may not be obvious in visible light images, but can be clearly displayed in infrared images, and vice versa. This complementary information helps the model to understand the nature of the defects more comprehensively. Multimodal data fusion can trigger feature enhancement technology, which generates richer feature representations by combining information from different modalities, thereby improving the generalization and robustness of the model.

[0135] The specific steps of the adaptive threshold segmentation algorithm include: (1) performing local feature analysis on the input image and calculating the local average gray value of each pixel; (2) dynamically adjusting the threshold according to the local average gray value to generate a binary image; (3) using morphological operations such as erosion and dilation to remove noise in the binary image; (4) performing connected region analysis on the binary image to extract the defect area; (5) using post-processing methods such as area filtering and shape analysis to further optimize the extraction results of the defect area.

[0136] In this embodiment, the traditional fixed threshold segmentation method is easily affected by lighting conditions and background changes, resulting in false detection and missed detection. The adaptive threshold segmentation algorithm dynamically adjusts the threshold according to the local features of the image, and can more accurately segment the defect area. Through local feature analysis, the adaptive threshold segmentation algorithm can better adapt to different types of defects and background changes, and reduce the problems of false detection and missed detection. Perform local feature analysis on the input image and calculate the local average gray value of each pixel. Dynamically adjust the threshold according to the local average gray value to generate a binary image. Use morphological operations (such as corrosion and expansion) to remove noise from the binary image. Perform connected region analysis on the binary image to extract the defect area. Finally, use post-processing methods (such as area filtering and shape analysis) to further optimize the extraction results of the defect area. The adaptive threshold segmentation algorithm can more accurately segment the defect area, especially under conditions of uneven lighting and complex background, the detection effect is more stable and reliable.

[0137] In this embodiment, the adaptive threshold segmentation algorithm can not only improve the segmentation accuracy of the defect area, but also effectively reduce background interference, especially in complex backgrounds. The initial segmentation results generated by the adaptive threshold segmentation can be used as the basis for post-processing optimization, and the accuracy of the final detection results can be improved through further morphological operations and regional analysis.

[0138] The specific steps of generative adversarial networks (GANs) include: (1) constructing a generator network and a discriminator network. The generator network is used to generate defective samples, and the discriminator network is used to distinguish between real samples and generated samples; (2) using real defective samples and non-defective samples to train the discriminator network so that it can accurately distinguish between real samples and generated samples; (3) using the generator network to generate defective samples, and continuously optimizing the generator network through feedback from the discriminator network; (4) adding the generated defective samples to the training dataset to enhance the diversity and representativeness of the dataset.

[0139] In this embodiment, more high-quality defect samples are generated by generating adversarial networks (GANs), which can significantly enhance the diversity and representativeness of the data set and improve the generalization ability of the model. The generated defect samples can supplement the deficiencies in the actual data set, help the model better learn different types of defect features, and improve detection performance. A generator network and a discriminator network are constructed, the generator network is used to generate defect samples, and the discriminator network is used to distinguish between real samples and generated samples. The discriminator network is trained using real defect samples and non-defect samples so that it can accurately distinguish between real samples and generated samples. Defect samples are generated using the generator network, and the generator network is continuously optimized through feedback from the discriminator network. The generated defect samples are added to the training data set to enhance the diversity and representativeness of the data set. The generated defect samples enable the model to be trained on more diverse data, improving the detection performance of the model on unseen defect types.

[0140] In this embodiment, the generative adversarial network not only generates high-quality defect samples, but also generates different types of defect samples, which enhances the balance of the data set and avoids the overfitting of the model to a certain type of defect. The generated defect samples can be used as part of data enhancement to further increase the diversity and representativeness of the data set and improve the generalization ability of the model.

[0141] The specific steps of transfer learning and pre-trained models include: (1) selecting a pre-trained deep learning model, such as ResNet, EfficientNet, etc.; (2) freezing some layers of the pre-trained model to retain its powerful feature extraction capabilities; (3) adding a new classification layer based on the pre-trained model and fine-tuning it for the wood paint defect detection task; (4) using the wood paint defect dataset to train the model and optimize the parameters of the classification layer; (5) evaluating the performance of the model on the validation set and adjusting the hyperparameters to improve the detection accuracy of the model.

[0142] In this embodiment, transfer learning is performed using a pre-trained deep learning model (such as ResNet, EfficientNet), which can quickly adapt to the wood paint defect detection task and reduce the time and resource consumption of training from scratch. The pre-trained model has been fully trained on a large-scale data set and has a strong feature extraction capability. The initial performance of the model can be quickly improved through transfer learning. Select a pre-trained deep learning model, freeze some layers, and retain its strong feature extraction capability. Add a new classification layer based on the pre-trained model and fine-tune it for the wood paint defect detection task. Use the wood paint defect data set to train the model and optimize the parameters of the classification layer. Evaluate the performance of the model on the validation set and adjust the hyperparameters to improve the detection accuracy of the model. Transfer learning enables the model to quickly adapt to the wood paint defect detection task and improves the initial performance and training efficiency of the model.

[0143] In this embodiment, transfer learning not only quickly adapts to new tasks, but also significantly reduces training time and computing resources, which is particularly important when resources are limited. The feature extraction capability of the pre-trained model can be used as the basis for model initialization, and the model can be further optimized through fine-tuning to improve training efficiency and performance.

[0144] The specific steps of the real-time online learning mechanism include: (1) During the detection process, the newly collected sample data is passed into the model in real time; (2) Online learning algorithms, such as online gradient descent and online random forest, are used to update the parameters of the model; (3) The latest version of the model is saved regularly to ensure continuous optimization of the model; (4) Online evaluation methods, such as online cross-validation, are used to monitor the performance changes of the model; (5) According to the online evaluation results, the data collection strategy and model training strategy are adjusted to improve the adaptability and robustness of the model.

[0145] In this embodiment, a real-time online learning mechanism is designed, and the model continuously learns new samples during the detection process and gradually optimizes its own performance. This mechanism can adapt to changes on the production line and continuously improve the detection accuracy. Through online learning, the model can capture new defect types and changes on the production line in a timely manner, and enhance the robustness and adaptability of the model. During the detection process, the newly collected sample data is passed into the model in real time. The parameters of the model are updated using online learning algorithms (such as online gradient descent, online random forest, etc.). The latest version of the model is saved regularly to ensure the continuous optimization of the model. Use online evaluation methods (such as online cross-validation) to monitor the performance changes of the model. According to the online evaluation results, adjust the data collection strategy and model training strategy to improve the adaptability and robustness of the model. The real-time online learning mechanism enables the model to continuously optimize its own performance, adapt to changes on the production line, and improve detection accuracy and robustness.

[0146] In this embodiment, the real-time online learning mechanism can not only continuously optimize the model performance, but also enhance the model's self-repair ability and promptly correct errors introduced by environmental changes or new defect types. The real-time online learning mechanism can form a data feedback loop. By continuously learning new samples, the model can gradually optimize its own parameters and improve detection accuracy and robustness.

[0147] In this embodiment, the detection method also includes: constructing a multi-task learning framework, performing defect classification and positioning tasks simultaneously, sharing the feature extraction layer, improving the overall performance of the model, developing adaptive data enhancement technology, dynamically adjusting the data enhancement strategy according to the characteristics of the defect type, improving the diversity and quality of the data set, and using self-supervised learning methods to pre-train through unlabeled data to improve the feature extraction capability of the model.

[0148] The specific steps of the multi-task learning framework include: (1) constructing a multi-task learning model, including a shared feature extraction layer and multiple task-specific layers; (2) the shared feature extraction layer is used to extract common features of the input image, and the task-specific layers are used for defect classification and localization tasks respectively; (3) using a multi-task loss function, such as a joint loss function, to simultaneously optimize the objectives of multiple tasks; (4) during the training process, synchronously updating the parameters of the model through a multi-task learning algorithm, such as multi-task gradient descent; (5) evaluating the multi-task performance of the model on the validation set and adjusting the hyperparameters to improve the overall performance of the model.

[0149] In this embodiment, a multi-task learning framework is constructed to perform defect classification and location tasks simultaneously, share feature extraction layers, and improve the overall performance of the model. Through multi-task learning, the model can optimize multiple goals at the same time, improve the reusability and generalization ability of features. Multi-task learning can utilize complementary information between different tasks, reduce overfitting problems, and improve the generalization ability of the model. Construct a multi-task learning model, including a shared feature extraction layer and multiple task-specific layers. The shared feature extraction layer is used to extract common features of the input image, and the task-specific layers are used for defect classification and location tasks respectively. Use a multi-task loss function (such as a joint loss function) to optimize the objectives of multiple tasks simultaneously. During the training process, the parameters of the model are updated synchronously through a multi-task learning algorithm (such as multi-task gradient descent). Evaluate the multi-task performance of the model on the validation set, and adjust the hyperparameters to improve the overall performance of the model. The multi-task learning framework enables the model to optimize multiple tasks at the same time, improve the reusability and generalization ability of features, reduce overfitting problems, and improve detection accuracy.

[0150] In this embodiment, the multi-task learning framework not only improves the overall performance of the model, but also improves the interpretability of the model. By sharing the feature extraction layer, it is easier to understand how the model captures the common features of different tasks. The multi-task learning framework can promote feature sharing between tasks. By sharing the feature extraction layer, different tasks can benefit from each other and improve the generalization ability of the model.

[0151] In this embodiment, the specific steps of the adaptive data enhancement technology include: (1) analyzing the characteristics of the defect type and determining a suitable data enhancement strategy, such as random rotation, random translation, random scaling, random cropping, random flipping, etc.; (2) using the data enhancement strategy to generate more training samples to enhance the diversity and representativeness of the data set; (3) evaluating the performance of the data-enhanced data set on the validation set and adjusting the data enhancement strategy to improve the generalization ability of the model; (4) dynamically adjusting the data enhancement strategy during the training process and optimizing it according to the performance of the model.

[0152] In this embodiment, an adaptive data enhancement technology is developed to dynamically adjust the data enhancement strategy according to the characteristics of the defect type to improve the diversity and quality of the data set. By dynamically adjusting the data enhancement strategy, more high-quality training samples can be generated to improve the generalization ability of the model. Adaptive data enhancement technology can increase the diversity of training samples, reduce overfitting problems, and improve the generalization ability of the model. Analyze the characteristics of the defect type and determine suitable data enhancement strategies, such as random rotation, random translation, random scaling, random cropping, random flipping, etc. Use data enhancement strategies to generate more training samples and enhance the diversity and representativeness of the data set. Evaluate the performance of the data-enhanced data set on the validation set, and adjust the data enhancement strategy to improve the generalization ability of the model. During the training process, the data enhancement strategy is dynamically adjusted and optimized according to the performance of the model. Adaptive data enhancement technology enables the model to be trained on more diverse data, improve the quality of the data set, reduce overfitting problems, and improve detection accuracy.

[0153] In this embodiment, the adaptive data enhancement technology not only increases the diversity of the data set, but also improves the adaptability of the model to different environments and conditions, especially new situations encountered in practical applications. Adaptive data enhancement can dynamically adjust the data enhancement strategy according to the performance of the model, generate training samples that better meet actual needs, and improve the generalization ability of the model.

[0154] In this embodiment, the self-supervised learning method not only reduces the dependence on labeled data, but also improves the model's adaptive ability, enabling the model to better handle unseen data and new tasks. Self-supervised learning can optimize the model's feature extraction ability through pre-training, provide a better foundation for subsequent fine-tuning and task adaptation, and improve the overall performance of the model.

[0155] In this embodiment, a self-supervised learning method is used to pre-train the model through unlabeled data to improve the feature extraction ability of the model. Through self-supervised learning, the model can be pre-trained on a large amount of unlabeled data to enhance the robustness and generalization ability of the features. The self-supervised learning method can significantly reduce the dependence on a large amount of labeled data, reduce the labeling cost, and improve the practicality of the model. Design self-supervised learning tasks, such as image rotation prediction, image splicing prediction, etc. Use unlabeled data for pre-training, and optimize the feature extraction ability of the model through self-supervised learning tasks. After the pre-training is completed, use a small amount of labeled data for fine-tuning to further optimize the performance of the model. Evaluate the performance of the model on the validation set, and adjust the hyperparameters to improve the detection accuracy of the model. The self-supervised learning method enables the model to be pre-trained on a large amount of unlabeled data, enhance the robustness and generalization ability of the features, and significantly improve the detection performance of the model in the case of a small amount of labeled data.

[0156] In this embodiment, RT-DETR is a real-time target detection model based on the Transformer architecture developed by Baidu. It combines an efficient hybrid encoder and an IoU-aware query selection mechanism to provide excellent real-time detection performance and high detection accuracy, and supports flexible adjustment of the inference speed through different decoding layers. In view of the characteristics of small scale, diverse morphology and dense distribution of surface defects of wood paint, this paper makes targeted improvements based on the RT-DETR model.

[0157] In this embodiment, the RT-DETR model includes multiple variants such as R-18, R-34, R-50, R-50m, x, l, etc. In order to balance the detection accuracy and computing resource consumption, this paper chooses ResNet-18 as the backbone network, and optimizes the design of the MFWL-DETR model on this basis. The improved network structure is as follows Figure 3 shown.

[0158] In this embodiment, the wood paint defect dataset used in this paper is a self-built dataset collected in the actual production workshop of Jiangshan Baijiawang wooden doors. The image data was collected using an industrial array camera model MV-CS050-10UM, which was shot under the condition that the camera was perpendicular to the wood paint surface, and finally 529 images were obtained. After expert screening, 310 clear images were retained to ensure the quality and reliability of the dataset. The detailed parameters of the image acquisition equipment are listed in Table 1.

[0159] Table 1 Image acquisition equipment parameters:

[0160]

[0161] In this embodiment, in order to improve the generalization ability and adaptability of the model, this paper performs data enhancement processing on 310 defect images and expands the data set to 12,400 images. The enhancement methods include image darkening, brightening, adding Gaussian noise, adding salt and pepper noise, rotation, horizontal flipping, vertical flipping, etc. While ensuring data diversity, according to the requirements of model computing resources, the image resolution is uniformly adjusted to 640×640 pixels to improve training efficiency.

[0162] In this embodiment, the labeling tool LabelImg is used to label the image samples, and the defects are marked as bubbles (blister), cracks (crack), holes (hole) and scratches (scratch), and the defect positions are marked with red and black frames. Since this task belongs to small target detection, special attention is paid to the precision of the labeling. After the labeling is completed, a corresponding txt label file is generated for each image to record the defect type and location information.

[0163] In this embodiment, the data set is randomly divided into training set, validation set and test set in a ratio of 8:1:1, containing 9,920, 1,240 and 1,240 images respectively. The data set contains a total of 31,240 defect instances, including 7,840 hole defects (about 25%), 8,840 bubble defects (about 29%), 6,760 crack defects (about 21%), and 7,800 scratch defects (about 25%). Pixel-level statistical analysis is performed on the distribution of defects, such as Figure 2 As shown, it provides a detailed reference of data distribution for model training. Figure 2 In (b), S1 is Hole Length, S2 is Hole Height, S3 is Blister Length, S4 is Blister Height, S5 is Crack Length, S6 is Crack Height, S7 is Scratch Length, and S8 is Scratch Height.

[0164] In this embodiment, when the RT-DETR model uses ResNet-18 as the basic structure, its BasicBlock module has limitations in the size of the receptive field, making it difficult to effectively extract the features of small defects on the wood paint surface, and lacks the ability to interact with cross-channel information. To overcome these problems, this paper introduces a wavelet convolution module (WTConv) in the BasicBlock module, replacing the second convolution layer of BasicBlock with it. The improved module is called the BBWTConv module to enhance the model's ability to extract spatial hierarchical information.

[0165]

[0166] X=Conv transposed ([F LL F LH F HL F HH ],[X LL X LH X HL X HH ])(2)

[0167] In this embodiment, the wavelet convolution module (WTConv) is based on an innovative structure that extends the one-dimensional wavelet transform (WT) to two dimensions, and can effectively model features of different scales and directions, thereby improving the model's ability to capture features of different sizes and directions in the image. Its specific implementation is as follows: Formula (1) defines four filters of the two-dimensional wavelet transform, which are used to extract the four channel outputs of the input feature [XLL XLH XHL XHH]. Among them, XLL is the low-frequency component of X, and XLH, XHL, and XHH are the high-frequency components of X horizontally, vertically, and diagonally, respectively. Formula (2) gives the calculation method of the inverse wavelet transform. The four channels generated in formula (1) are combined into a feature map through inverse transformation, fused with the input feature, and the final feature is output, such as Figure 4 shown.

[0168] In this embodiment, the wavelet convolution module tends to make predictions based on shape rather than texture information, which is consistent with the characteristics of the human visual system. Through its multi-scale characteristics, wavelet convolution can decompose features at different scales, which not only helps to reduce the computational burden of subsequent layers, but also can more accurately capture key features in the image. This structural optimization enhances feature extraction capabilities while maintaining model performance, reduces computational overhead, and adapts to diverse detection task requirements.

[0169] In this embodiment, in the RT-DETR model, the AIFI module (also known as the intra-scale feature interaction module) is the core part of the decoder. This module simply adds the encoded position information to the K and V target information extracted from the image, and inputs it and the Q target information into the multi-head self-attention mechanism (MHSA). However, this direct addition processing method fails to fully consider the complex interactions between features of different scales, resulting in a lack of deep information, thereby limiting the network's ability to accurately segment and detect multi-scale targets.

[0170] In this embodiment, in order to improve the recognition performance of this module for multi-scale targets, this paper proposes to introduce the M2SA module in the AIFI module to more comprehensively retain the K and V feature information and integrate it with the multi-head attention mechanism. Specifically, for the input high-level feature X (size is C×H×W), it is first split and flattened and position encoding is added. Then, the input feature X is linearly transformed to obtain Queries (Q), Keys (K) and Values ​​(V), as shown in formula (3), where WQ, WK, and WV are the mapping matrices of Q, K, and V, respectively. The multi-scale mechanism of the M2SA module allows the K and V features to capture feature information at different resolutions, providing the network with richer contextual information. Through the channel attention mechanism, the key feature channels are further strengthened and the discriminability of the features is improved. The K and V generation structure modules are as follows: Figure 5 shown.

[0171] Q=W Q X, K = W K X,V=W V X(3)

[0172] Subsequently, the transformed Q, K, and V features are input into the multi-head attention mechanism to generate the interactive features within the scale, as shown in formula (4). Where dK represents the dimension of K, which is used for scaling in the dot product attention calculation. The attention weight distribution is generated by the softmax function and multiplied by the value matrix V to establish the long-distance dependency relationship between the features. Next, the output F of the multi-head attention mechanism is reshaped back to the original shape of the image feature through the tensor reshaping operation (Reshape), as shown in formula (5).

[0173]

[0174] F=Reshape(MHSA(Q,K,V)) (5)

[0175] In this embodiment, after obtaining the multi-head attention output F, it is further fused with the input high-level feature X through the channel attention module. This fusion strategy can not only capture local detail information, but also enhance the performance of the model in high-resolution defect images with complex backgrounds and multi-scale features. This module design effectively reduces the complexity of self-attention calculation while maintaining feature integrity, thereby improving the computational efficiency of the network. In addition, the addition of residual connections ensures the retention of the original feature information, further improving the feature fusion effect. The improved AIFI module structure is shown in Figure 2. Figure 6 shown.

[0176] In this embodiment, in the hybrid encoder of the RT-DETR model, this paper removes the original CCFM (Cross-Scale Communication Fusion Module) structure based on the comprehensive consideration of computational efficiency and feature fusion effect. Although CCFM has achieved certain results in feature fusion, its complex structure leads to high computational cost. In order to improve the efficiency of the model, this paper introduces a new efficient multi-branch feature pyramid network (EMBFPN) to replace the CCFM module.

[0177] In this embodiment, in the EMBFPN structure, a bidirectional feature pyramid network (BIFPN) with weighted fusion of multi-scale features is first introduced, and then a lightweight structural system with a global channel number of 128 is used. This network design aims to address the limitations of traditional feature fusion methods in processing high-resolution fine-grained features, especially in the task of wood paint defect detection, where fine-grained features are crucial for identifying small-sized defects. The CCFM module needs to repeatedly perform upsampling and downsampling operations during the feature fusion process, which can easily cause the loss of high-resolution fine-grained features, thereby reducing the model's ability to detect small-sized defects.

[0178] In this embodiment, in the paint defect detection task of this paper, the feature expression of a single scale is difficult to fully capture the complexity of paint defects. To this end, the BIFPN network adopts a bidirectional fusion structure to effectively retain key fine-grained features and significantly enhance the network's ability to identify tiny defects. Figure 7 In the convolution operation after feature fusion, BIFPN applies a fast normalized fusion weighting strategy to ensure the balanced fusion of features of different scales, as shown in formula (6).

[0179] In this embodiment, after the convolution operation of the feature fusion network, a weighting strategy based on Fast Normalized Fusion is applied to the output feature map, as shown in formula (6). In this strategy, Wk represents the weight obtained through learning, and the weight is ensured to be positive after being processed by the ReLU activation function; the parameter λ is a constant, usually 0.0001, which is used to avoid unstable factors in numerical calculations. Xi represents the input feature.

[0180]

[0181] In this embodiment, the BIFPN network realizes multi-layer feature fusion on a top-down path by integrating bidirectional cross-scale connections and a fast normalization fusion mechanism. Specifically, the intermediate features and output features are integrated on the 6th, 5th, and 4th layers (corresponding to formulas (7) and (8)), where when L=6, the Resize operation in formula (7) is applied to the input P7in of the 7th layer, and the remaining layers are applied to the intermediate features. BIFPN enriches the feature expression by introducing multi-scale features, enabling the model to capture defect features from multiple angles and scales. This multi-angle and multi-scale feature capture capability greatly improves the accuracy and robustness of the model in paint defect detection tasks, giving BIFPN a significant advantage in this field and enabling it to provide more accurate and reliable detection results.

[0182]

[0183]

[0184] In this embodiment, traditional convolutional neural networks face challenges in dealing with paint defects of different sizes. It is difficult to fully capture the complexity and diversity of paint defects with feature extraction at a single scale. To solve this problem, this paper introduces a global heterogeneous kernel selection mechanism for efficient convolution, namely the MSDC module, after the BIFPN network outputs features. This mechanism can adaptively adjust the receptive field to capture the features of defects of different sizes, significantly improving the accuracy and robustness of detection.

[0185] In this embodiment, the Global Heterogeneous Kernel Selection (GHKS) mechanism is an advanced convolutional neural network design strategy that dynamically adjusts the convolution kernel size of feature layers with different resolutions to enhance the network's ability to capture multi-scale features and achieve adaptive expansion of the Effective Receptive Field (ERF). Figure 3 As shown in the figure, in the HybridEncoder module, different levels of input features use convolution kernels of different sizes (the convolution kernel size is marked in the upper right corner of the module in the figure). This strategy is particularly important in target detection tasks, because the limited receptive field of small targets usually makes them difficult to detect accurately.

[0186] In this embodiment, in this study, the multi-scale convolution block (MSDC) is optimized to form an improved CMSCB network structure. The module first performs a convolution operation on the input feature map, then splits the feature map into channels, and the split feature map is processed by the MSDC module in turn, and then rearranges the channels with the original feature map after convolution. Finally, the processed feature map is output by another convolution operation.

[0187] In this embodiment, in the MSDC module, this paper adopts deep separable convolution to expand the number of channels, and the expansion factor is usually 2. This design not only maintains high computational efficiency, but also processes input channels independently at different scales, enhancing the feature expression capability. Specifically, the expanded channels are processed by batch normalization and ReLU6 activation to introduce nonlinear transformations and accelerate model convergence. In addition, a channel shuffling operation is introduced in the MSDC module, which makes up for the shortcomings of deep convolution in capturing inter-channel relationships by redistributing information among different groups, so that the feature map can more effectively capture multi-scale contextual information.

[0188] MSDC(x′)=∑k∈KDWC k∈K (x′) (9)

[0189] As shown in formula (9), in the core formula of the CMSCB module, K represents a set of different convolution kernel sizes, and DWC represents depthwise convolution. Through the design of multi-scale depthwise convolution, the CMSCB module can capture features of different scales at the same time, thereby improving segmentation accuracy. The improved CMSCB network structure is shown in Figure 8 shown.

[0190] In this embodiment, this paper introduces the EUCB (Efficient Up-Convolution Block) module in the upsampling module of the model to replace the traditional upsampling method. The EUCB module significantly enhances the detail expression ability of the feature map while maintaining computational efficiency through deep separable convolution and batch normalization technology, thereby improving the recognition accuracy of small targets. Its flexible design enables it to adapt to inputs of different resolutions and achieve efficient information fusion by adjusting the number of channels.

[0191] In this embodiment, during the multi-scale feature fusion process, EUCB has a particularly significant effect on the detection of small-sized targets, which greatly improves the segmentation accuracy and generalization ability of the model. In addition, EUCB also performs well in reducing computing resource consumption and accelerating model training and reasoning, making it more advantageous to deploy on resource-constrained devices, thereby significantly improving the overall model performance.

[0192] In this embodiment, the structure of the EUCB module is as follows: Fig. 9 As shown in Figure 1. The module first performs an upsampling operation with a scale factor of 2, then uses a 3×3 depth convolution to map the features, and further enhances the processed features through batch normalization and ReLU6 activation. Finally, a 1×1 convolution is used to reduce the number of channels and output the optimized feature information.

[0193] In this embodiment, in order to solve the problem of feature information loss caused by the traditional downsampling module in small target detection, this paper designs a downsampling module that integrates the gate mechanism. The module first performs a maximum pooling operation on the input features to reduce the dimension, and then adjusts the number of channels through 1×1 convolution. Subsequently, the output obtained by the convolution operation with a step size of 2 on the feature map and the original input feature map is channel-concatenated to achieve multi-path feature extraction, which enhances the diversity of feature expression and helps reduce the number of model parameters.

[0194] In this embodiment, the purpose of introducing the gating mechanism is to selectively enhance the features after sampling. The core of this mechanism is to control the inflow, retention and outflow of information through the gating unit, so as to highlight important features, suppress irrelevant or redundant information, and further improve the effectiveness of the features. Specifically, the input features are first processed by adaptive average pooling, then nonlinearly transformed by the convolution layer and the HardSigmoid activation function, and finally multiplied with the feature map after channel splicing to generate the output features (as shown in formula (10)). The HardSigmoid activation function is used in this process to ensure the smoothness and stability of the activation.

[0195]

[0196] In this embodiment, the downsampling module of the fusion gating mechanism proposed in this paper not only enriches the feature extraction path of the network and enhances the diversity of feature expression, but also effectively improves the accuracy of feature selection and the effectiveness of expression through the gating mechanism. The structure of the improved downsampling module (AtDown module) is as follows: Fig.10 shown.

[0197] Experimental indicators:

[0198] In this embodiment, in order to objectively evaluate the performance of the model used in this article, precision (P), recall (R), mean average precision (mAP), frames per second (FPS), giga floating point operations per second (GFLOPs) and parameter amount (params) are used as evaluation indicators. Formula (11) defines the precision, which is used to represent the proportion of positive samples detected that are truly positive samples; Formula (12) defines the recall, which calculates the relationship between true positive (TP), false positive (FP) and false negative (FN).

[0199]

[0200]

[0201]

[0202]

[0203] In this embodiment, the calculation formula of the average precision is shown in formula (13), and formula (14) represents the mean average precision (mAP), which represents the average precision of all categories. Here, N is the number of defect categories (N=4), and APi represents the average precision of the i-th category. mAP50 represents the mean average precision when the intersection-over-union (IoU) threshold is 0.5, and mAP50:95 is the mean average precision of all values ​​of the IoU threshold from 0.5 to 0.95.

[0204] In this embodiment, the frames per second (FPS) represents the number of image frames processed per second, which is used to measure the real-time processing capability of the model. The number of floating-point operations (GFLOPs) represents the number of billion floating-point operations performed per second, reflecting the computational complexity and computational complexity of the model. The model weight represents the size of the space occupied by the model in the memory, which directly affects the running efficiency of the model on specific hardware.

[0205] Comparative experiment to improve Backbone location:

[0206] In this embodiment, in order to evaluate the effect of introducing the BBWTConv module improved by wavelet convolution in different positions in the Backbone network, this paper conducts comparative experiments on its application in four different positions. The experiment compares the effect of introducing the BBWTConv module in each BasicBlock position of the Backbone network. The results are shown in Table 2. All data are based on the verification results of the test set. In addition, in order to more intuitively show the experimental effect of each position, Fig.11 A schematic diagram of each location is given.

[0207] Table 2 Comparative experiments of replacing BBWTConv at different positions:

[0208]

[0209] The BasicBlock was replaced with the BBWTConv module at four different locations in the Backbone network to analyze in detail the impact of the replacement on the model performance. In the replacement experiment at position 1, the number of parameters was reduced by 28.6%, the amount of calculation was reduced by 10.4%, and the weight size was reduced by 23.1%, but the mAP50 index dropped slightly by 0.7%. This result shows that the P5 layer contains a lot of redundant information, and the wavelet convolution effectively reduces these redundant features through low-frequency filters, while avoiding the parameter expansion problem caused by using larger convolution kernels.

[0210] In the replacement experiments of positions 2, 3, and 4, the number of parameters, the amount of calculation, and the size of weights were all reduced, especially the replacement of positions 3 and 4, the mAP50 performance increased by 1.2% and 1.5%, respectively. This shows that the feature information in the P3 layer is crucial in subsequent processing. In the replacement of position 4, although the reduction in the number of parameters and the amount of calculation is small, this is because the information extracted by the P2 layer contains a large amount of contextual features when integrated by the P3 layer.

[0211] Based on these results, we selected position 1, where the number of parameters, computation, and weights were most significantly reduced, as the benchmark, and conducted a combined experiment by introducing the BBWTConv module into other positions at the same time. The experimental results show that when the BasicBlock is replaced with the BBWTConv module in all four positions, the number of parameters of the model is reduced by 35.7%, the amount of computation is reduced by 24.6%, and the weight size is reduced by 29.8%, which are significantly better than the replacement effect in position 1 alone. At the same time, the mAP50 performance is improved by 1.1%.

[0212] These results show that by introducing BBWTConv modules at multiple locations, spatial hierarchical information can be extracted and captured more effectively, and features of different scales and directions can be captured. The multi-location combination strategy not only optimizes the parameter efficiency of the model, but also enhances the feature capture capability, thus further improving the overall performance.

[0213] In this embodiment, in order to verify the performance of the proposed MFWL-DETR algorithm and the rationality of the design of each module, this paper conducted an ablation experiment, focusing on six key modules: BBWTConv module, KVG-AIFI module, multi-scale weighted fusion BIFPN network, efficient convolution global heterogeneous kernel CMSCB module, parallel downsampling AtDown module, and efficient upsampling module EUCB. In the experiment, "√" means that the corresponding module is enabled, and "×" means that it is not used. The experimental results are shown in Table 3. All data are based on the verification results of the test set.

[0214] Table 3 Ablation experiment

[0215]

[0216] The experimental results show that the introduction of the BBWTConv module in the Backbone network not only improves the precision (by 0.7%) and mAP50 (by 1.1%), but also reduces the amount of calculation by 24.6% and the weight size by 29.9%, indicating that the module significantly optimizes the parameter efficiency while improving the model recognition ability. In view of the improvement of the AIFI module, the feature extraction of K and V is further optimized, which increases the mAP50 by 0.9% and the precision by 1.3%, indicating that the improved module can more effectively retain key information, provide more accurate data support for subsequent processing, and enhance the model's ability to detect multi-scale targets.

[0217] In this embodiment, the BIFPN network structure with multi-scale weighted fusion is introduced to significantly optimize the encoder, improve the accuracy of feature fusion and reduce redundant information. Through the weighted fusion strategy, the network reduces the amount of calculation by 14.5% and the weight by 2.3MB. This not only reduces the computational burden of the model, but also strengthens the network's ability in multi-scale feature fusion, enabling it to process image data more efficiently.

[0218] In this embodiment, the CMSCB module enhances the network's multi-scale feature capture capability and achieves adaptive expansion of the effective receptive field by dynamically adjusting the convolution kernel size of feature layers with different resolutions. Experiments show that the CMSCB module improves the accuracy by 0.7%, while significantly reducing the amount of computation (reduced by 15.8%) and weight size (reduced by 2.1MB), enabling the output feature map to more effectively capture multi-scale contextual information and provide support for subsequent processing.

[0219] Finally, the efficient upsampling module EUCB and the parallel downsampling module AtDown were added to the encoder. The EUCB module retains more edge and texture information, which improves mAP50 by 0.2% and reduces the amount of calculation by 0.8GFLOPs; the AtDown module improves the processing speed while maintaining the resolution through a parallel downsampling strategy, which improves mAP50 by 1.1%. Although the upsampling and downsampling modules slightly increase the weight size, the recognition and positioning accuracy of the model has been improved.

[0220] When all modules are used in combination, the amount of computation is reduced by 40.5% and the weight size is reduced by 36.1% compared to the baseline model, indicating that this algorithm significantly optimizes resource utilization while ensuring high performance. This optimization not only reduces the computational burden, but also reduces the storage requirements of the model, making it more suitable for deployment in resource-constrained environments.

[0221] In this example, in order to intuitively demonstrate the actual effect of the improved algorithm in this paper, we conducted a visual comparative analysis of the models before and after the improvement. Fig.12 The following is a comparison chart of the detection. Fig.13 It is a thermal visualization comparison chart. It can be clearly seen that both the model before and after the improvement can successfully detect the four defect categories, and the two models have similar performance in terms of confidence. Fig.13 Gradient-weighted Class Activation Mapping (Grad-CAM) is used to explain the classification decision of the deep neural network on the input image. The redder the color, the higher the attention paid to the area. In the detection of fine scratch defects, the improved model performs better because it retains more feature details, thereby enhancing the ability to capture small defects.

[0222] In this embodiment, when detecting small target dense areas, the performance of the baseline model is slightly better than that of the improved model. The possible reason is that too many features are retained, resulting in a decrease in matching accuracy. Nevertheless, the improved lightweight model still shows higher advantages in actual industrial applications. The algorithm proposed in this paper effectively solves the feature matching problem by integrating multi-scale features and efficient up and down sampling modules, and realizes the accurate positioning and classification of defects. This improvement not only improves the detection accuracy, but also provides a more efficient and reliable solution for the field of industrial detection.

[0223] In this embodiment, Fig.14 As shown in the figure, the accuracy and mAP50 comparison curves of the baseline model and the improved model during the training process show the performance difference between the two models. The two models converged after about 40 iterations, with the final convergence value of the baseline model being 85.3 and that of the improved model being 85.4. From the curves, it can be seen that the two models have little fluctuation in accuracy and mAP50 indicators, and there is no significant conflict, which indicates that the improved model has maintained comparable accuracy to the original model while maintaining lightweight, achieving performance optimization.

[0224] In this embodiment, different models are compared in experiments

[0225] To further verify the effectiveness of the improved algorithm in this paper, this section conducts comparative experiments with different benchmark models of the current mainstream algorithms Faster R-CNN, YOLOv7, and YOLOv8, as well as different versions of the RT-DETR benchmark model. The experiments were conducted under the same parameters and environment configurations, and the results are shown in Table 4. All data are based on the test set verification results.

[0226] Table 4 Comparative experiments of different algorithms

[0227]

[0228] Experimental results show that the improved model in this paper outperforms the traditional Faster R-CNN, YOLOv7, YOLOv8 benchmark models and different versions of RT-DETR models in multiple key performance indicators. Although RT-DETR-l has achieved high levels of 97.3% and 85.9% in accuracy and mAP respectively, its large number of parameters, computational complexity and weight size limit its application in actual detection scenarios. In contrast, the improved model in this paper reduces the number of parameters by 62.8%, the amount of computation by 67.2%, and the weight size by 62.8% while maintaining 85.1% mAP and 94.5% accuracy. With only 0.8% mAP accuracy loss, the computational efficiency and resource utilization of the model are significantly improved.

[0229] Model generalization analysis:

[0230] In order to comprehensively evaluate the generalization ability of the improved model, this paper verifies it on other datasets. We selected a public wood defect dataset similar to paint defects for generality comparison experiments. The experimental results are shown in Table 5. All data are based on the test set verification results.

[0231] Table 5 Universality comparison experiment

[0232]

[0233] The data in the table show that the improved model has 40.2% fewer parameters, 39.5% less computation, and 36.3% less weight on the wood defect dataset than the original model. At the same time, the accuracy and mAP50 have not dropped significantly, and it has reached 60FPS, meeting the needs of real-time detection. These results show that the improved model not only performs well in paint defect detection, but also has good versatility and is suitable for similar defect detection tasks. Its lightweight characteristics make it easy to deploy on hardware devices, providing an efficient and reliable solution for actual production detection.

[0234] In this embodiment, the accuracy and real-time requirements for wood water-based paint surface defect detection in wood product manufacturing are suitable for wood paint surface defect recognition. The model improves the Backbone network by introducing a wavelet convolution module, enhances the ability to capture multi-scale features, and avoids the problem of over-parameterization in traditional methods; a multi-scale mechanism is designed in the AIFI module to optimize the capture of K and V feature information, so that the network has rich context feature expression capabilities. In addition, the model integrates the BIFPN architecture of multi-scale weighted fusion, and combines the global heterogeneous kernel selection mechanism (MSDC) to adaptively adjust the receptive field and improve the recognition ability of defects of different sizes. The efficient upsampling module EUCB and the parallel downsampling Gate mechanism further optimize the feature retention and expression capabilities, and effectively improve the detection accuracy of small targets. The experimental results show that compared with traditional algorithms, MFWL-DETR significantly reduces the number of parameters and calculations while maintaining detection accuracy. It is suitable for the deployment of embedded devices and shows good versatility and deployment flexibility.

[0235] It should be noted that, in this article, relational terms such as one and two are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions. The sentence "comprises an element defined by ... does not exclude the existence of other identical elements in the process, method, article or device including the element".

[0236] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for detecting wood water-based paint defects based on computer vision, characterized in that: The following steps are involved: S1: Construct a wood paint defect dataset; S2: Introduce wavelet convolution module to improve the Backbone network and enhance the ability to capture image features; S2.1: Add a wavelet convolution module to the BasicBlock of the ResNet network, and enhance the network's ability to capture paint defect features by improving the feature extraction unit; S2.2: The wavelet convolution module enhances the multi-scale feature representation of the image through wavelet transform. The formula is as follows: W conv (f)=∫f(x)ψ(x-y)dx Where f(x) is the input image and ψ(xy) is the wavelet basis function. S3: Design the AIFI module to optimize the feature fusion effect through a multi-scale capture mechanism based on K and V feature information; S3.1: Introduce a combination of AIFI module and multi-head self-attention mechanism (M2SA) in the encoder part to optimize the expressiveness of the input K and V features; S3.2: The AIFI module retains and strengthens feature information of different scales through a multi-scale feature capture mechanism, thereby enhancing the ability to recognize multi-scale targets.

2. The method for detecting wood water-based paint defects based on computer vision according to claim 1, characterized in that: The S3 also includes a multi-head self-attention mechanism, the formula of which is as follows: Where Q is the query vector, K is the key vector, V is the value vector, and d k is the dimension of the key vector; The detection method also includes using a multi-scale weighted fusion feature pyramid network and a global heterogeneous kernel selection module to further enhance the feature fusion effect.

3. The method for detecting wood water-based paint defects based on computer vision according to claim 1, characterized in that: The fusion of the multi-scale weighted fusion feature pyramid network and the global heterogeneous kernel selection module includes: adopting the multi-scale feature weighted fusion strategy in the BIFPN network structure, replacing the traditional additive connection with channel splicing and combining the global heterogeneous kernel selection mechanism, adaptively selecting and weightedly fusing suitable convolution kernels according to the requirements of different scale feature layers, gradually accumulating multi-scale features, and avoiding the loss of small-size target information.

4. The method for detecting wood water-based paint defects based on computer vision according to claim 1, characterized in that: The formula for combining the global heterogeneous core selection mechanism is as follows: Among them, F i is the feature map of the i-th layer, w j is the weight coefficient, Conv(F j ,k j ) is the convolution operation, k j is the convolution kernel.

5. The method for detecting wood water-based paint defects based on computer vision according to claim 4, characterized in that: The detection method also includes introducing an efficient upsampling module and a parallel downsampling module combined with a gating mechanism, specifically including: designing an efficient upsampling module, combining deep separable convolution with batch normalization technology, retaining detailed information of small target features on the paint surface during the upsampling process, so as to ensure sensitivity and recognition accuracy to small defect targets. The formula of the upsampling module is as follows: U(F)=DepthwiseConv(F)+BatchNorm(F) Among them, F is the input feature map, DepthwiseConv(F) is the depthwise separable convolution operation, and BatchNorm(F) is the batch normalization operation.

6. The method for detecting wood water-based paint defects based on computer vision according to claim 1, characterized in that: A parallel branch downsampling module is designed to enrich the diversity of feature expression through multiple feature extraction paths. The extracted features are selected in combination with the Gate mechanism to screen out key features to suppress redundant information and improve the quality of feature expression. The formula of the parallel downsampling module combined with the gate mechanism is as follows: D(F) = Gate(Conv1(F), Conv2(F),…,Conv n (F) Among them, F is the input feature map, Conv i (F) is the i-th convolution operation, and Gate is the gating mechanism.

7. The method for detecting wood water-based paint defects based on computer vision according to claim 6, characterized in that: Apply water-based paint on a homemade sprayable wood board and collect paint surface images to ensure that the images are clear and unobstructed; obtain paint surface images of actual wood products from the production workshop, covering defects under different materials and process conditions; filter and annotate the collected images, and finally construct a wood paint surface defect dataset containing four types of defects: bubbles, cracks, holes, and scratches, with each type of defect containing at least 1,000 images; The dataset was augmented by performing data enhancement, including image darkening, brightening, adding Gaussian noise, adding salt and pepper noise, rotating, horizontal flipping, and vertical flipping, and the dataset was expanded to 12,400 images. The image resolution was uniformly adjusted to 640×640 pixels.

8. The method for detecting wood water-based paint defects based on computer vision according to claim 7, characterized in that: The model uses data augmentation techniques during training, including image darkening, brightening, adding Gaussian noise, adding salt and pepper noise, rotation, horizontal flipping, and vertical flipping to improve the generalization ability and adaptability of the model.

9. The method for detecting wood water-based paint defects based on computer vision according to claim 1, characterized in that: The detection method also includes: building a multimodal data fusion system, combining the data collected by the optical camera and the infrared camera, using multimodal data fusion technology to improve the accuracy and robustness of defect detection, developing an adaptive threshold segmentation algorithm, dynamically adjusting the threshold according to the local features of the image, improving the segmentation accuracy of the defect area, using a generative adversarial network to generate more high-quality defect samples, enhancing the diversity and representativeness of the data set, using a pre-trained deep learning model for transfer learning, quickly adapting to the task of wood paint defect detection, and designing a real-time online learning mechanism. The model continuously learns new samples during the detection process and gradually optimizes its own performance.

10. The method for detecting wood water-based paint defects based on computer vision according to claim 9, characterized in that: The detection method also includes: constructing a multi-task learning framework to perform defect classification and positioning tasks simultaneously, sharing feature extraction layers to improve the overall performance of the model, developing adaptive data enhancement technology to dynamically adjust data enhancement strategies according to the characteristics of defect types, improving the diversity and quality of data sets, and using self-supervised learning methods to perform pre-training through unlabeled data to improve the feature extraction capability of the model.

Citation Information

Cited By

  • Ancient building appearance corrosion degree evaluation method and system based on artificial intelligence

    CN120182835A

  • Chip packaging condition nondestructive analysis system and method based on microscopic detection

    CN120259279A

  • Artificial board surface defect intelligent detection method and system based on machine vision

    CN120355688A

  • Wood repairing method and device and medium

    CN120411054A

  • Infrared-visible light person re-identification method and system based on wavelet representation

    CN120599667A