A method, device, medium and product for detecting multi-scale defects on a particle board surface
By improving asymmetric data augmentation and the PBDNet model, the efficiency and accuracy issues of multi-scale defect detection on particleboard surfaces were resolved, achieving efficient detection of multi-scale defects and improving detection accuracy and detection rate.
Patent Information
- Application Number
- CN202510495705.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-04-21
AI Technical Summary
Existing technologies struggle to efficiently and accurately detect multi-scale defects on particleboard surfaces, especially when there are large areas of oil stains and small wood chips with significant scale variations. The detection model cannot simultaneously capture the details of small targets and the global features of large targets, and the number of defects exhibits a positively skewed distribution with size, leading to data imbalance between classes.
Asymmetric data augmentation methods are employed to augment different defect categories, constructing a PBDNet model including the SPDConv and C2f_SD modules. Fine-grained information is preserved through spatial segmentation and channel fusion strategies, and the model's adaptability to multi-scale defects is enhanced by combining switchable dilated convolution and differential convolution modules.
It significantly improves the efficiency and accuracy of multi-scale defect detection on particleboard surfaces, increasing detection accuracy by 5% and detection rate by 9.3%, while reducing the number of model parameters and maintaining the detection speed at virtually the same level.
Smart Images

Figure CN120013946B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of surface defect detection technology, and in particular to a method, equipment, medium and product for multi-scale defect detection on particleboard surfaces. Background Technology
[0002] Particleboard is a primary material for custom furniture, and with the increasing demand in the custom furniture market, the demand for particleboard is also growing. Surface defect detection is a crucial step in ensuring product quality during particleboard production. However, due to the large size variation of surface defects, the coexistence of multi-scale defects, and the positively skewed distribution of defect quantity with defect size, efficient and accurate detection of particleboard remains challenging. Summary of the Invention
[0003] The purpose of this application is to provide a method, equipment, medium, and product for detecting multi-scale defects on particleboard surfaces, so as to improve the efficiency and accuracy of detecting multi-scale defects on particleboard surfaces.
[0004] To achieve the above objectives, this application provides the following solution.
[0005] In a first aspect, this application provides a method for multi-scale defect detection on particleboard surfaces, comprising: acquiring a full-frame original image of the particleboard surface and preprocessing it to construct a surface defect dataset; the surface defect dataset includes multiple defect images of different surface defect types; applying different data augmentation methods to perform asymmetric data augmentation operations on the defect images of different surface defect types in the surface defect dataset to obtain an augmented surface defect dataset; constructing a PBDNet model including a backbone network, a neck network, and a detection head; the backbone network includes an SPDConv module, a CBS module, a C2f_SD module, and a C2f module; the neck network includes an SPPF module, an upsampling module, a stitching module, a C2f module, and an SPDConv module; the detection head includes a CBS module, a Conv2d module, a Cls loss module, and a Bbox loss module; training the PBDNet model using the augmented surface defect dataset, and using the trained model as a surface defect detection model; and using the surface defect detection model to perform multi-scale defect detection on particleboard surface images.
[0006] Optionally, the step of acquiring and preprocessing the full-frame original image of the particleboard surface to construct a surface defect dataset specifically includes: performing sliding window slicing on the full-frame original image of the particleboard surface to extract multiple sub-images; filtering the multiple sub-images to retain only the sub-images with surface defects; labeling the types of surface defects in the sub-images with surface defects; the types of surface defects include mottled defects, wood chips, oil stains, chipped edges, chalk marks, scratches, and cracks; and storing the labeled sub-images as defect images as a surface defect dataset.
[0007] Optionally, the asymmetric data augmentation operation is performed by applying different data augmentation methods to defect images of different surface defect types in the surface defect dataset. Specifically, this includes: for defect images with chipped edges, vertical flipping, horizontal flipping, random brightness / contrast changes, and random cropping / scaling operations are performed; for defect images with chalk marks, vertical flipping, blur transformation, random brightness / contrast changes, and random cropping / scaling operations are performed; for defect images with scratches, vertical flipping and horizontal flipping operations are performed; and for defect images with cracks, vertical flipping, horizontal flipping, random brightness / contrast changes, and random cropping / scaling operations are performed.
[0008] Optionally, the SPDConv module specifically includes: a space-to-depth transformation layer and a non-stretch convolutional layer; the space-to-depth transformation layer is used to transform the input size into a depth-to-depth transformation layer. Feature map The image is segmented spatially, and decomposed into four sub-images with half the spatial dimensions by uniform grid sampling. Then subgraph The stacked feature map is obtained by concatenating along the channel dimension. ;in It is spatial dimension. It is the number of channels; express The real space of dimension; the non-stretch convolutional layer is used to process the stacked feature maps. Using a standard convolution with a stride of 1, the number of channels is compressed to... The downsampled feature map is obtained. .
[0009] Optionally, the C2f_SD module specifically includes: a DEConv module, a CBS module, a segmentation module, a BottleNeck_SAC module, and a stitching module; the DEConv module consists of a regular convolution module, a horizontal difference convolution module, and a vertical difference convolution module; wherein the regular convolution module is used to extract the intensity-level features of the image; the horizontal difference convolution module uses a fixed horizontal gradient convolution kernel to capture horizontal edge features; the vertical difference convolution module uses a fixed vertical gradient convolution kernel to capture vertical edge features; the CBS module is used to adjust the number of channels of the image; the segmentation module is used to split the feature map in the channel dimension; the BottleNeck_SAC module consists of a SAConv module and two global context modules appended before and after the SAConv module; the stitching module is used to stitch the input feature map in the channels.
[0010] Optionally, the calculation formula for the SAConv module is as follows: ;in Indicates that the input is Weights are The void ratio is 1 and the output is Ordinary convolution operations; It is a learnable switching function; Weights for participation in training; This refers to the void ratio hyperparameter. This is the output of the SAConv module.
[0011] Optionally, the global context module includes a 5×5 average pooling layer and a two-dimensional convolutional layer.
[0012] Secondly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the multi-scale defect detection method for particleboard surface.
[0013] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the multi-scale defect detection method for particleboard surface.
[0014] Fourthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the multi-scale defect detection method for particleboard surfaces.
[0015] Based on the specific embodiments provided in this application, the following technical effects are disclosed.
[0016] This application provides a method, device, medium, and product for detecting multi-scale defects on particleboard surfaces. It designs an asymmetric data augmentation method, applying different data augmentation strategies for different defect categories, effectively alleviating the problem of imbalanced sample numbers between classes within the dataset from a data perspective. In the PBDNet model, by introducing the SPDConv module, a spatial segmentation and channel fusion strategy is implemented, preserving more fine-grained information during downsampling and improving the model's detection capability when the number of defects exhibits a positively skewed distribution with defect size. Furthermore, in the PBDNet model, the dual observation and dynamic weight integration mechanism of the C2f_SD module captures multi-scale defect features, enhancing the model's adaptability to particleboard surface defects with significant scale variations. Therefore, the method of this application can significantly improve the efficiency and accuracy of multi-scale defect detection on particleboard surfaces. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a method for detecting multi-scale defects on the surface of particleboard according to this application.
[0019] Figure 2 This is a schematic diagram illustrating the process of creating a surface defect dataset.
[0020] Figure 3 A 3D model of a specialized equipment for acquiring images of surface defects in particleboard;
[0021] Figure 4 A schematic diagram showing the types of surface defects in particleboard;
[0022] Figure 5 This is a schematic diagram of data augmentation methods;
[0023] Figure 6 This is a diagram of the PBDNet model architecture.
[0024] Figure 7 This is a schematic diagram of the SPDConv structure;
[0025] Figure 8 This is a schematic diagram of the C2f_SD module structure;
[0026] Figure 9 This is a schematic diagram of the DEConv module structure;
[0027] Figure 10 This is a schematic diagram of the CBS module structure;
[0028] Figure 11 This is a schematic diagram of the BottleNeck_SAC module structure;
[0029] Figure 12 This is a schematic diagram of the SAConv module structure;
[0030] Figure 13 This is a diagram showing the distribution of the number of defects.
[0031] Figure 14 This is a histogram showing the distribution of the number of defects under the normalized defect height dimension.
[0032] Figure 15 This is a histogram showing the distribution of the number of defects in the normalized defect width dimension.
[0033] Figure 16 A normalized defect size heatmap;
[0034] Figure 17 mAP during training 50 Line graph;
[0035] Figure 18 Bbox loss curve for validation set;
[0036] Figure 19 A schematic diagram illustrating the detection results of different models;
[0037] Figure 20 Heatmaps of Eigen-CAM (Class Activation Map) for different models;
[0038] Figure 21 This is a comparison chart of the convergence speed of different models during the training process. Detailed Implementation
[0039] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0040] The purpose of this application is to propose a method, equipment, medium, and product for detecting multi-scale defects on particleboard surfaces, aiming to improve the efficiency and accuracy of multi-scale defect detection on particleboard surfaces.
[0041] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0042] Currently, various improved target detection models based on the YOLO framework have gained widespread attention in multiple target detection fields, including particleboard surface defect detection, due to their superior real-time performance, algorithm stability, and ease of implementation. However, existing YOLO-based improvement methods tend to focus on lightweight design, with limited discussion on their insufficient detection capabilities when multiple scale-varying defects coexist. When defects of different sizes (such as large areas of oil stains and small wood chips) appear simultaneously, existing detection methods are limited by a fixed receptive field during feature extraction. This leads to a tendency for the algorithm model to ignore the detailed information of small targets when processing large-sized defects, while failing to effectively capture the global features of large targets when processing small-sized defects. Furthermore, particleboard surface defect samples collected during normal production line operation exhibit an uneven distribution of defects of different scales. This causes the algorithm model, limited by a fixed receptive field, to be more biased towards single-scale defects with a larger sample size, while ignoring defects of other scales. Simultaneously, the number of defects shows a positively skewed distribution with defect size, meaning that small target defect samples account for a higher proportion, and the defect scale differences are significant. Therefore, an effective detection method must give higher attention to small target defects while ensuring accurate detection of large target defects.
[0043] To address the characteristics of particleboard surface defects collected during normal production processes, such as large dimensional variations, coexistence of multi-scale defects, and a positively skewed distribution of defect quantity with defect size, this application provides a method for detecting multi-scale defects on particleboard surfaces. In an exemplary embodiment, such as... Figure 1 As shown, the multi-scale defect detection method for particleboard surface includes the following steps 1 to 5.
[0044] Step 1: Obtain the full-size original image of the particleboard surface and perform preprocessing to construct a surface defect dataset; the surface defect dataset includes multiple defect images of different surface defect types.
[0045] The process of creating the surface defect dataset in this application is as follows: Figure 2 As shown. To obtain high-resolution images of the full-frame original image of the particleboard surface, this application developed a dedicated equipment for acquiring images of surface defects in particleboard. (See attached image.) Figure 3 As shown, the special equipment for acquiring surface defect images of particleboard is equipped with two industrial line scan cameras 301 with a resolution of 4096×2 pixels. The two cameras 301 are at the same height and are distributed along the same line, with an image field of view overlap rate of 30%. The images acquired by the left and right cameras are stitched together to a resolution of 8192×4096 to obtain a full-frame original image of the particleboard surface.
[0046] See Figure 2To meet the input requirements of the neural network model and ensure the integrity of small target details in the high-resolution image, a sliding window slicing process, also known as sliding block processing, is applied to the full-frame original image of the particleboard surface. Specifically, multiple sub-images (referred to as sub-images) are extracted from the full-frame original image of the particleboard surface using a sliding window of 1024×1024 pixels. The window moves from the upper left corner of the image to the lower right corner. The extracted sub-images are then filtered, retaining only those with surface defects. To avoid missing any defects, the movement step size is set to 768. Furthermore, the types of surface defects in the sub-images with surface defects are labeled, including seven types of defects: spot-like defects, shavings, oil pollution, edge breakage, chalk marks, scratches, and cracks. These are described as follows: Figure 4 As shown in sections (a) to (g), the boxes in the figures are detection boxes used to mark the location of defects. The annotations in the images are in YOLO format. Each annotated sub-image is stored as a defect image and is considered a sample in the surface defect dataset.
[0047] Step 2: For the defect images of different surface defect types in the surface defect dataset, apply different data augmentation methods to perform asymmetric data augmentation operations to obtain the augmented surface defect dataset.
[0048] For particleboard produced on a specific production line, the distribution of surface defects is non-uniform. Typically, the most frequent defects are mottled defects and wood chips, followed by oil stains and surface scratches, while chalk marks, cracks, and other defects are less common. Because it is difficult to obtain information on low-frequency defects, the number of defects of different categories in the dataset varies significantly, resulting in a clear data imbalance between categories. Therefore, to improve the robustness and generalization of the detection model, this application employs asymmetric data augmentation operations based on the characteristics of different defects. Different data augmentation methods are applied to different defect categories, as detailed below. Figure 5 As shown.
[0049] See Figure 5For defect images with surface defects such as mottled defects, shavings, and oil stains, due to the large number of samples, data augmentation is not required. For defect images with surface defects such as chipped edges, vertical flipping, horizontal flipping, random brightness / contrast changes, and random cropping / scaling can be performed. For defect images with surface defects such as chalk marks, vertical flipping, blur transformation, random brightness / contrast changes, and random cropping / scaling can be performed. For defect images with surface defects such as scratches, vertical flipping and horizontal flipping can be performed. For defect images with surface defects such as cracks, vertical flipping, horizontal flipping, random brightness / contrast changes, and random cropping / scaling can be performed. The symbol " / " in this text represents "and" or "or". Of course, the order of the above operations can be set according to actual needs.
[0050] Taking chalk mark defects as an example, since chalk mark defects occur infrequently in the dataset and are manually labeled, their morphology and features are relatively simple. Therefore, this application employs several data augmentation strategies specifically for them. First, vertical flipping can be used to enhance the simulation of defects occurring in different board entry directions, thereby improving the model's robustness to changes in direction. Second, random cropping and scaling are applied to enhance the simulation of defects of different sizes, improving the model's adaptability to scale changes. Simultaneously, random brightness transformation is used to enhance the simulation of changes in light source conditions, making the model more robust to changes in illumination. Finally, blur transformation is used to simulate camera defocusing, enhancing the model's ability to recognize blurred images.
[0051] The asymmetric data augmentation method designed in this application employs different data augmentation strategies for different types of defects, effectively alleviating the problem of imbalance in the number of samples between classes within the dataset from a data perspective.
[0052] Step 3: Construct a PBDNet model that includes a backbone network, a neck network, and a detection head.
[0053] The PBDNet model architecture used in this application is as follows: Figure 6As shown, the PBDNet model, based on YOLOv8s, mainly consists of three components: a backbone network, a neck network, and a head. The backbone network extracts features from the input image, capturing feature representations from low to high levels. The neck network enhances contextual information and improves the quality of feature representations by fusing features from different levels. The head is responsible for the final prediction output, performing classification and regression operations based on the features passed from the neck network to determine the location of the detection box and its category. To address the issue of insufficient defect detection capabilities at different scales, PBDNet introduces switchable dilated convolutions with gating mechanisms into the C2f feature extraction module. These gated switchable dilated convolutions adaptively adjust the model's receptive field, enabling it to capture global features when dealing with small defects and focus on local details when dealing with large defects. Furthermore, this application improves upon the ordinary convolution in the C2f module by introducing a differential convolution module with prior knowledge. By combining edge detection operators to extract the horizontal edge texture information of the image, the model's ability to perceive additional edge features is enhanced.
[0054] Specifically, see Figure 6 The backbone network includes several SPDConv modules, CBS modules, C2f_SD modules, and C2f modules. The neck network includes several SPPF modules, upsampling modules, concat modules, C2f modules, and SPDConv modules. The detection head includes several CBS modules, Conv2d modules, Cls loss modules, and Bbox loss modules. The inputs of each module can be uniformly described as follows: The feature map of size is output as Size feature map. Among them These represent the image's height, width, and number of channels, respectively. The module names in the YOLO network (such as Backbone, Neck, Head, C2f, SPPF, CBS, etc.) are common terms in computer vision, widely accepted and used in academia and industry. For example, Backbone: the backbone network responsible for feature extraction. Neck: the neck network used for feature fusion and multi-scale processing. Head: the detection head responsible for generating the final detection results. Another example is the CBS (Convolution-BatchNorm-SiLU) module: a standard convolutional module including Conv2d convolution, batch normalization (BatchNorm, BN), and the activation function (SiLU). C2f (Faster Implementation of CSP Bottleneck with 2 convolutions) module: a cross-stage partial connection module, a feature extraction module used for efficient feature extraction. SPPF (Spatial Pyramid Pooling - Fast) module: a fast spatial pyramid pooling module used for multi-scale feature extraction. SPDConv module: a spatial-to-depth downsampling module used to replace the CBS module for downsampling operations. The C2f_SD (Cross Stage Partial Connections - Space to Depth) module is an improved cross-stage partial connection module. Features include Upsample, Concat, etc.
[0055] In the backbone network of this application, the SPDConv module and the CBS module are used to perform downsampling operations on the feature maps, that is, to... The height and width of the feature map of the size are halved to obtain Feature maps of different sizes. Both have the same function but different implementations. The C2f_SD module and the C2f module are used for feature extraction. The C2f_SD module is an improved version of the C2f module and is one of the innovations of this application.
[0056] In the neck network, the SPPF module is used to perform multi-scale pooling on the feature maps to extract multi-scale contextual information while maintaining high computational efficiency. The upsampling module performs the opposite function of the downsampling module, enabling... The height and width of the feature map of the size are both doubled to obtain The feature map is of a certain size. The stitching module has two inputs and one output, and can stitch together features of a size of... The two feature maps are concatenated along the channel dimension to obtain... Feature map of size.
[0057] In the detection head, Conv2d represents two-dimensional convolution, a core operation in deep learning for processing two-dimensional data (such as images), primarily used to extract local features of the input data by sliding the convolution kernel. Cls loss refers to the classification loss function, used to calculate the difference between the model's predicted class label and the true class label. This application uses the BCE (Binary CrossEntropy) loss function. Bbox loss refers to the bounding box loss function, used to calculate the positional difference between the model's predicted object bounding box and the true bounding box. This application uses the CIoU (Complete Intersectionover Union) loss function and the DFL (Distribution Focal Loss) function.
[0058] The modules are stacked sequentially to form the PBDNet model. For example... Figure 6 As shown, in the backbone network, the following nine modules are stacked sequentially: SPDConv, CBS, C2f_SD, SPDConv, C2f_SD, SPDConv, C2f_SD, CBS, and C2f, numbered 0-8 from the top right corner. In the neck network, the following modules are stacked sequentially: SPPF, upsampling, stitching, C2f, upsampling, stitching, C2f, SPDConv, stitching, C2f, SPDConv, stitching, and C2f, numbered 9-21 from the top right corner. Specifically, the C2f_SD module numbered 4 in the backbone network is connected to the stitching module numbered 14 in the neck network; the C2f_SD module numbered 6 in the backbone network is connected to the stitching module numbered 11 in the neck network; and the C2f_SD module numbered 8 in the backbone network is connected to the SPPF module numbered 9 in the neck network. The SPPF module numbered 9 in the neck network is also connected to the splicing module numbered 20 in the neck network; the C2f module numbered 12 in the neck network is also connected to the splicing module numbered 17 in the neck network. The detection head includes several branches, each of which sequentially stacks a CBS module, a Conv2d module, and either a Cls loss module or a Bbox loss module. The C2f modules numbered 15, 18, and 21 in the neck network are respectively connected to the two branches ending with the Cls loss module and the Bbox loss module.
[0059] During model training, Figure 6The input to the entire PBDNet model shown is the data-augmented defect image data. During real-time defect detection on particleboard surfaces, the input to the entire PBDNet model is the real-time acquired image of the particleboard surface. The input to the entire PBDNet model is... Image of size For the height, we take 1024 in this application; For the width, this application uses 1024; The image channel count is 3 in this application. The input image passes through each module sequentially according to the arrow order to obtain the final detection result, including the detection category and the detection box. The output of the PBDNet model is implemented by the detection head, which outputs the detection category c and the detection box position (x, y, w, h). Here, c is the defect category, with values ranging from {0, 1, 2, 3, 4, 5, 6}, representing 7 different defects. (x, y) are the center point coordinates of the detection box after normalization relative to the image size, with values ranging from [0, 1]. (w, h) are also the width and height of the detection box after normalization relative to the image size, with values ranging from [0, 1]. By outputting the detection box position (x, y, w, h), the PBDNet model can accurately locate defect regions in the image. By outputting the detection category c, the specific type of defect, such as scratches or cracks, can be identified.
[0060] To address the issue of a positively skewed distribution of defect numbers with size and a high proportion of small-target defects, the PBDNet model introduces the SPDConv module, replacing the convolution operation with a stride of 2 in the YOLOv8 backbone. The SPDConv module reduces information loss during downsampling through spatial segmentation, channel fusion, and dimensionality compression, thereby preserving more fine-grained information and optimizing the model's detection capabilities when defect sizes exhibit a positively skewed distribution.
[0061] like Figure 7 As shown, the SPDConv module specifically includes: a space-to-depth transformation layer and a non-stride convolutional layer. Figure 7 middle This represents the coordinate position in the feature map, for example, for an input size of... Feature map , This represents the feature map. The Middle Liede The element in the row has a size of That is, a collection A vector of channels. express The real space of dimension 1; other real spaces are defined similarly, only differing in dimension. For example... Figure 7As shown, the feature map is first analyzed in the spatial dimension. The image is segmented and decomposed into four sub-images with half the spatial dimensions using uniform grid sampling. :
[0062] (1);
[0063] in, Indicates the input feature map Extract pixels at even-numbered indices in the height and width directions to generate a sub-image. The dimensions are Feature map middle, It refers to spatial dimensions (height and width). It refers to the number of channels. This represents a slice operation with a stride of 2, meaning that sampling is performed every other pixel in both the height and width directions. Specifically, This indicates starting from index 0 and ending at index 1. End, step size is 2. Therefore, Indicates from feature map Extract the pixels at even-numbered indices in the height and width directions. (This is done by...) Extracted subgraph The size is Similarly, other subgraphs It was also extracted through different slicing operations. The height direction corresponds to an even index, and the width direction corresponds to an odd index. The corresponding odd-numbered index is used in the height direction, and the even-numbered index is used in the width direction. The corresponding odd index is in the height direction and the odd index is in the width direction.
[0064] Each subgraph The size is Subgraph The stacked feature map is obtained by concatenating along the channel dimension. This decomposition method achieves spatial compression with zero information loss. Furthermore, non-stretch convolutional layers are used to process the stacked feature maps. Using a standard convolution with a stride of 1, the number of channels is compressed to... The downsampled feature map is obtained. .
[0065] In this application, the SPDConv module is introduced into the PBDNet model to implement a spatial segmentation and channel fusion strategy. This retains more fine-grained information during the downsampling process and improves the surface defect detection model's ability to detect defects when the number of defects is positively skewed with respect to defect size.
[0066] Furthermore, this application introduces a convolutional module with switchable hole ratio into the C2f feature extraction layer of the PBDNet model. This module captures multi-scale defect features through a dual-observation and dynamic weight integration mechanism, enhancing the detection model's adaptability to particleboard surface defects with significant scale variations. Simultaneously, a DEConv module is added to extract additional defect edges and contours using prior information, enriching the feature information extracted by the detection model and improving its convergence speed.
[0067] like Figure 8 As shown, the C2f_SD module includes a DEConv module, a CBS module, a Split module, several BottleNeck_SAC modules, a splicing module, and the CBS module stacked in sequence.
[0068] The DEConv module structure is as follows: Figure 9 As shown, it consists of a CBS module, a Horizontal Difference Convolution (HDC) module, and a Vertical Difference Convolution (VDC) module. The CBS module is used to extract intensity-level features from the image. The HDC module uses a fixed horizontal gradient convolution kernel, which can capture horizontal edge features, and its kernel weights... satisfy:
[0069] (2);
[0070] in The parameters are learnable, and their initial values are set to the weights of the Sobel level kernel, i.e. , , .
[0071] The VDC module uses a fixed vertical gradient convolution kernel, and its kernel weights... satisfy:
[0072] (3);
[0073] in The parameters are learnable, and their initial values are set to the weights of the Sobel vertical kernel, i.e. , , .
[0074] During the training phase, the output features of ordinary convolution, horizontal difference convolution, and vertical difference convolution are fused by element-wise addition. After training, when performing inference, since the weights of the three convolutions have been learned and fixed, the weights of the three convolution kernels can be equivalently merged into a single standard convolution kernel through reparameterization techniques, thereby eliminating the multi-branch structure and simplifying model deployment.
[0075] The CBS module structure is as follows: Figure 10 As shown, it includes Conv2d convolution, batch normalization (BN), and activation function (SiLU). Figure 8 In the C2f_SD module shown, the two CBS modules at the beginning and end are both used to adjust the number of channels in the image, that is, to... The size of the feature map is adjusted to The size is determined to facilitate further splitting and compression on the channel in the next step.
[0076] The segmentation module is used to split the feature map along the channel dimension, that is, to divide... The feature map of size is split into two parts. The two feature maps are processed separately, one part continues to the next module, and the other part is sent to the final concatenation. The concatenation module is used to concatenate the input feature maps on the channels to obtain... Feature map of size. This indicates the number of times the BottleNeck_SAC module is repeated. Figure 8 The "..." indicates that the BottleNeck_SAC module is repeatedly stacked, totaling [number] stacks. indivual.
[0077] The BottleNeck_SAC module structure is as follows: Figure 11 As shown, it includes the CBS module and the SAC module. The expanded internal structure of the BottleNeck_SAC module has two forms, as shown below. Figure 11 As shown in parts (a) and (b), its Add parameter is a boolean value (True or False) used to control whether a residual connection is used. Figure 11 As shown in part (a), when Add=True, it indicates that a residual join is used. Figure 11 As shown in part (b), when Add=False, it means that residual joins are not used.
[0078] The SAC module structure is as follows: Figure 12As shown, it consists of the SAConv module and two global context modules attached before and after the SAConv module. The SAConv module includes a 5×5 average pooling layer, a 2D convolutional (Conv2d) module, a 3×3 2D convolutional layer with an atrous rate of 1, and a 3×3 2D convolutional layer with an atrous rate of 3. The two global context modules attached before and after the SAConv module are called the pre-global context module and the post-global context module, respectively, each containing a 5×5 average pooling layer and a 2D convolutional module.
[0079] Assumption Indicates that the input is Weights are The void ratio is 1, and the output is... If the ordinary convolution operation is performed, then the processing procedure of the SAConv module can be written in the form of formula (4).
[0080] (4);
[0081] in The dilation rate is a hyperparameter. The SAConv module splits the input into two parallel paths. The first path uses the original convolution with weights of... No other processing is performed; the second path is a convolution with a dilation rate of 3 and weights of 1. ,in The weights used in training are initialized to 0. The second dilated convolution leverages the weights of the original convolution. Initialization is performed because objects of different scales can be detected with the same weights but different void ratios; therefore, this is adopted. As a weight, it can reduce the learning cost of this path. For learnable switching functions, in Figure 12 Simplified Chinese representation . The convolution results of the first and second paths with different void ratios can be weighted and fused. In this application, a 5×5 average pooling layer followed by a 1×1 two-dimensional convolution is used to achieve this. This indicates the output of the SAConv module.
[0082] Step 4: Train the PBDNet model using the enhanced surface defect dataset, and use it as a surface defect detection model after training.
[0083] The enhanced surface defect dataset was divided into training and testing sets, and the PBDNet model was trained and tested separately for each. The trained PBDNet model was then used as the surface defect detection model.
[0084] This application uses mAP50 With mAP 50-95 mAP is used as an indicator to evaluate the average recognition accuracy across all categories. 50 This is the mAP value calculated when the IoU threshold is 0.5. 50-95 More rigorously, the average precision calculated at different IoU thresholds between 0.50 and 0.95 was statistically analyzed to reflect the model's performance under different detection difficulties. Considering the requirements of this application's defect detection task regarding defect detection rate, detection speed, and deployment difficulty, recall rate was also included as a performance evaluation metric. The calculation methods for each evaluation metric are shown in equations (5) to (8):
[0085] (5); (6); (7); (8).
[0086] in, (True Positive) represents the number of defects that were correctly detected. (True Negative) represents the number of samples correctly identified as defect-free. (False Positive) represents the number of samples that were falsely identified as defects. (False Negative) represents the number of defects that were missed. It is the first Average precision for each category The total number of categories in this application =7. Equation (7) is the average precision of a single category. The calculation formula. All categories The average value. It is the accuracy value under a fixed confidence threshold. It is the Precision-Recall (PR) curve that varies with recall rate. The precision value of the change. Graphically, if we use recall rate... The horizontal axis represents the precision. Using the vertical axis as the ordinate, a PR curve can be plotted, and the area under the PR curve is defined as the average precision. . This means that on the PR curve, when the horizontal axis... Value The time axis corresponding to value. for abbreviation, This refers to the specific numerical value of the calculated Recall value.
[0087] This application proposes a lightweight particleboard surface defect detection model based on YOLOv8s—the PBDNet model—which maintains a parameter count of 6.43M with minimal loss in detection speed while achieving a detection accuracy of mAP. 50 The value increased by 5%, and the detection rate Recall value increased by 9.3%.
[0088] Step 5: Use a surface defect detection model to perform multi-scale defect detection on the particleboard surface image.
[0089] In use, the real-time acquired image of the particleboard surface is input into the trained surface defect detection model, which then outputs the detection category c and the detection box position (x, y, w, h). The detection box position (x, y, w, h) allows for accurate localization of defect areas in the image. The detection category c identifies the specific type of defect, such as scratches or cracks.
[0090] The following specific embodiments verify the effectiveness of the method of this application. An experiment was conducted using fine-surface oriented strand board (OSB) produced by a certain company as the test subject. The board size was 1220 mm × 2440 mm, and the density was 655 kg / m³. 3 The thickness is 18 mm and the moisture content is 8%. By adding or replacing different improved modules on the original YOLOv8s model, the impact of different improvement methods on the overall model is analyzed and verified, and it is compared with mainstream defect detection models such as Faster-RCNN, YOLOv10s, RTMDet-s, and RT-DETR.
[0091] The experimental hardware platform consisted of an AMD EPYC 7542 (2.90GHz) computer with 256 GB of memory and a ZOTAC RTX4090 24 GB GPU. The system ran Ubuntu 22.04, and the development software was Visual Studio Code, the programming language was Python 3.10, and the deep learning framework was PyTorch 2.3.0. In this experiment, the training image size was set to 1024×1024 pixels, the dataset was divided into training and validation sets in an 8:2 ratio, the number of epochs was set to 300, the batch size was set to 8, the learning rate was 0.001, the early stopping interval was 50, AMP (Automatic Mixed Precision) was set to True (AMP optimization enabled), the weight decay was 0.0005, and the momentum factor was 0.937.
[0092] The distribution of defect quantity for each category of defect instances after data augmentation is as follows: Figure 13As shown. After data augmentation, the dataset contains a total of 3436 images, comprising 4324 instances. Subsequently, for each type of defect, 20% of the images were extracted as the validation set, and the remaining 80% were used as the training set. The training set includes 2749 images with 3497 instances; the validation set includes 687 images with 827 instances.
[0093] Figure 14 and Figure 15 The normalized histograms showing the distribution of defect height and width reveal that the number of defects exhibits a positively skewed distribution with respect to size, both in terms of width and height, with peaks concentrated on the left side. Most defects have a width and height that do not exceed 20% of the original image's width and height. Figure 16 The defect size heatmap shown shows that, apart from the small target defects concentrated in the lower left corner, the remaining defects are more concentrated in the four corners of the image and less in the middle, indicating that there are more defects with larger dimensions in width or height and fewer medium-sized defects.
[0094] This application selected mainstream models such as Faster R-CNN, YOLOv8s, RTMDet-s, RT-DETR, and YOLOv10s to construct comparative experiments, and the results are shown in Table 1.
[0095] Table 1 Comparative Experimental Results
[0096]
[0097] As can be seen from Table 1, among all models, the mAP of PBDNet in this application is [missing information]. 50 Value and mAP 50-95 The values are the highest, reaching 0.881 and 0.655 respectively, while its Recall value also reaches the highest at 0.840. Furthermore, PBDNet's inference time is 2.46 ms, second only to YOLOv8s' 2.49 ms, demonstrating high inference efficiency. In terms of parameter count, PBDNet has only 6.43 M, making it the most lightweight model, on par with YOLOv8s and YOLOv10s, and far smaller than Faster-RCNN, RTMDet-s, and RT-DETR models.
[0098] Figure 17 This demonstrates the mAP during model training. 50 Value and number of iterations (Epoch). Figure 18 The bounding box loss curves for the validation set are shown below, along with a visualization of the detection results. Figure 19 As shown. From Figure 17 and Figure 18As can be seen, during training, Faster-RCNN converges the fastest and most stably, followed closely by PBDNet. RTMDet-s and RT-DETR show lower initial mAP. 50 The values rise more slowly but are relatively stable. The YOLO series networks, including YOLOv8s and YOLOv10s, are the most unstable during training, with the largest fluctuations in Bbox loss.
[0099] Comparative experiments show that Faster-RCNN fails to converge when trained without a pre-trained network, while it converges faster when a pre-trained model is used, but its mAP is lower. 50 The value is only 0.702. In terms of detection accuracy, PBDNet's mAP... 50 The value reached 0.881, a 5.5% improvement over YOLOv8s, significantly outperforming the RT-DETR and RTMDet series detection models, and also showing an 8% improvement over YOLOv10s. Under more stringent mAP... 50-95 In terms of metrics, PBDNet also performed best, leading all models with an accuracy of 0.655, a 3.6% improvement over YOLOv8s. This result demonstrates that the proposed PBDNet model exhibits stronger robustness and detection capabilities across different IoU thresholds. Figure 19 The results show that, when defects of different sizes coexist, PBDNet, compared to Faster-RCNN and RTMDet-s, did not miss small-sized defects, and compared to YOLOv8s, YOLOv10s, and RT-DETR, it did not have false positives or false negatives. Furthermore, PBDNet can detect seven types of defects: mottled defects (including glue spots and dust spots), shavings, oil stains, chipped edges, chalk marks, surface scratches, and cracks. Compared to previous studies, it includes the detection of more difficult-to-identify surface scratches and chipped edges, and the newly added mAP of these defects... 50 The values all exceeded 0.9.
[0100] Furthermore, in practical applications, the detection rate of various defects is more important than the accuracy of defect classification, making the model's recall value more crucial. PBDNet's recall value is 0.84, a 6.4% improvement over YOLOv8s and a 15.6% improvement over YOLOv10s, significantly reducing the probability of missed detections and better aligning with real-world factory applications. Simultaneously, combined with... Figure 19The detection examples also clearly demonstrate that, compared to other mainstream defect detection models, PBDNet achieves higher accuracy and confidence in locating defects with weaker features (such as surface scratches) and small target defects, and the detection results are closer to the true values. In terms of model parameter count, PBDNet has 6.43 M parameters, a 42.2% reduction compared to YOLOv8s' 11.14 M, while its inference time is slightly faster. Compared to other models, RTMDet-s, although boasting a high parameter count of 39.00 M, has a higher mAP. 50 The Recall value is only 0.836, lower than PBDNet, and its inference time of 54.2 ms is far inferior to PBDNet. This also indicates that the PBDNet model proposed in this application achieves a better balance between accuracy and efficiency through structural optimization. In addition, although RT-DETR-ResNet50 achieves a Recall value of 0.776, which is relatively high, its parameter count exceeds 80 M, making it difficult to deploy in real time with high performance on resource-constrained industrial edge computing devices.
[0101] Furthermore, this application designed improved modules such as C2f_SD (including the DEConv module) and SPDConv and introduced them into the YOLOv8 network. At the same time, the YOLOv8 model was also trimmed and lightweighted to form models A to H. The ablation experiment results of each model are shown in Table 2.
[0102] Table 2 Ablation Experiment Results
[0103]
[0104] As shown in Table 2, the model performance exhibits differentiated changes with the introduction of the improved module. After adding the C2f_SD module, the mAP of models C and G... 50 The values increased to 0.849 and 0.867 respectively. After adding the SPDConv module, the number of parameters in models B and F decreased to 10.11M and 5.50M respectively.
[0105] mAP of different models in ablation experiments 50 The values and recall values were evaluated, and the results are shown in Tables 3 and 4.
[0106] Table 3. mAP of different types of defects in ablation experiments 50 Value comparison
[0107]
[0108] Table 4 Comparison of Recall values for different types of defects in ablation experiments
[0109]
[0110] The results shown in Tables 3 and 4 reveal significant differences in detection performance across different defect categories. Among all models, the mAP for oil stain defects is [missing data]. 50 The values were all low, with only 0.462 in YOLOv8s (model A). Model H improved this metric to 0.618 through a combined improvement module, a 34.2% improvement over model A. Model G showed the best detection performance for wood shavings defects, with mAP... 50 The value reached 0.893.
[0111] This application uses Eigen-CAM to visualize the features extracted from the same layer of each model in the ablation experiment, in order to determine whether they have learned the correct defect feature information. The visualization results are as follows: Figure 20 As shown, the darker the red portion of the heatmap, the higher the level of attention the model pays to that portion.
[0112] In ablation experiments, after channel pruning (halving the number of backbone channels) of YOLOv8, the mAP of models E, F, G, and H compared to the unpruned models A, B, C, and D was significantly higher. 50 The values all showed varying degrees of improvement; for example, the mAP of model E after lightweighting increased. 50 The value increased from 0.833 to 0.88, indicating that the YOLOv8s model has some parameter redundancy for particleboard surface detection tasks. In this case, pruning the channels can force the model to focus on features with stronger discriminative power.
[0113] As shown in Table 2, replacing the downsampling method in Backbone with the SPDConv module using a step size of 2 significantly improved the model's F performance and mAP. 50 The value increased to 0.857, the recall value increased to 0.823, and the number of parameters decreased significantly to 5.50 M. (This was achieved through...) Figure 20 Visual heatmap analysis reveals that models F and H, after individually adding SPDConv, show increased attention to small-target wood chip defects, detecting small wood chip defects that models E and G failed to detect, and comprehensively improving the model's attention intensity to various types of defects. This indicates that SPDConv's unique spatial splitting-channel stacking strategy avoids the feature loss problem easily caused by traditional strided convolution, effectively preserving more fine-grained feature information during downsampling. Especially for surface defects in particleboard where the number of defects exhibits a positive skewness distribution with defect size, small-target defects occupying the peak side rely more heavily on this fine-grained feature information for correct classification and localization.
[0114] Among all seven types of defects, oil stains, chalk marks, and cracks generally have larger areas, while chipped edges, glue spots, and wood shavings generally have smaller areas. Different types of defects may also coexist, creating complex multi-scale problems. Therefore, this application introduces the C2f_SD module to improve the model's ability to detect coexisting multi-scale defects. The C2f_SD module integrates SAC and DEConv. SAC performs two observations of the input features through parallel convolution branches with different hole ratios and uses a switching function to adaptively combine the results of different hole convolution ratios, expanding the receptive field and thus improving the C2f module's ability to extract features of different scale particleboard defects. As shown in Tables 3 and 4, adding the C2f_SD module significantly improves the detection capabilities of models C, D, G, and H for defects of different scales. Models C and G, with only the C2f_SD module added, show a higher mAP for oil stain defects (large targets). 50 The values increased by 6.1% and 5.9% respectively, while maintaining the mAP for small target defects such as mottled defects and shavings. 50 The values remained basically unchanged or increased slightly, indicating that the model with the added improved module has better robustness in dealing with the problem of multi-scale defect coexistence.
[0115] At the same time, from Figure 20 As can be seen from the heatmap, due to the presence of DEConv in the C2f_SD module, models D and H show significantly improved attention to defect edges. Compared to models B and F, which failed to identify oil stain areas, models D and H, after adding the C2f_SD module, showed significantly improved attention to the edge regions of oil stain areas and successfully detected defects. This indicates that the introduction of horizontal and vertical differential convolution branches endows the model with certain prior knowledge, enabling the model to focus on the edge information of defects. Another advantage of this module is that the convergence speed during model training is also improved. Figure 21 As shown, after adding a C2f_SD module containing DEConv to the baseline model, models C and G showed a significant difference in mAP after only 100 epochs. 50 The value then approached 0.8, and the convergence speed was greatly accelerated.
[0116] This application addresses the challenges in surface defect detection for fine-surface oriented strand board (OSB) by addressing issues such as large defect scale variations, coexistence of multi-scale defects, positively skewed distribution of defect quantity with defect size, and imbalance in defect sample numbers across different classes. It proposes a lightweight detection model, PBDNet, based on YOLOv8s, and an asymmetric data augmentation method. On the seven valid defect classes specified in the enterprise standard, the average defect detection accuracy (mAP) is [not specified]. 50The mAP value reached 0.881, the average defect detection recall value reached 0.840, and the average inference time was less than 3 ms. In the PBDNet model, the SPDConv module, through its unique spatial splitting-channel stacking strategy, retains more feature information, significantly enhancing the model's ability to detect small target defects and improving its ability to detect defects with a positively skewed distribution of defect number with defect size; the C2f_SD module, through a switchable dilated convolution mechanism, significantly improves the model's ability to detect multi-scale defects. The mAP of large defects such as oil stains is also improved. 50 The value improved by nearly 6.1%, while maintaining the mAP for small target defects such as mottled defects and shavings. 50 The values remain largely unchanged or slightly improved. The addition of the DEConv module introduces prior knowledge into the model, improving convergence speed during training. Ultimately, the PBDNet model maintains a lightweight parameter count of 6.43M while achieving higher mAP. 50 The accuracy and recall values are improved by 4.8% and 6.4% respectively compared to YOLOv8s. It is significantly better than mainstream target detection models such as Faster R-CNN, RT-DETR and RTMDet in terms of accuracy-efficiency balance. It also provides an efficient, accurate and edge-deployable automated detection method for particleboard surface defect detection, which is of positive significance for improving particleboard product quality and promoting intelligent manufacturing upgrades.
[0117] In one exemplary embodiment, this application also provides a computer device, which may be a server or a terminal. The computer device includes a processor, a memory, an input / output interface, and a communication interface. The processor, memory, and input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the multi-scale defect detection method for particleboard surfaces.
[0118] In one exemplary embodiment, this application also provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the multi-scale defect detection method for particleboard surfaces.
[0119] In one exemplary embodiment, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the multi-scale defect detection method for particleboard surfaces.
[0120] Surface defect detection is a crucial step in ensuring product quality during particleboard production. However, due to the large scale variation of surface defects, the coexistence of multi-scale defects, and the positively skewed distribution of defect quantity with defect size, efficient and accurate detection remains challenging. To address these issues, this application proposes a multi-scale defect detection method for particleboard surfaces. The PBDNet model employs the SPDConv module as a downsampling method, spatially segmenting the feature tensor and concatenating it along channels. This reduces information loss during downsampling and preserves more fine-grained features for defects on the peak side of the positively skewed distribution, improving the detection model's ability to detect defects with a positively skewed distribution. Furthermore, the proposed C2f_SD module significantly enhances the model's ability to detect defects at different scales by adding switchable dilated convolution and differential convolution to C2f. Comparative and ablation experiments show that PBDNet achieves higher mAP. 50 PBDNet outperforms mainstream defect detection algorithms in both mAP and recall. Compared to YOLOv8s, PBDNet's mAP is higher. 50 The inference performance and recall values increased by 4.8% and 6.4%, respectively, reaching 0.881 and 0.840. Meanwhile, the number of parameters was reduced by 42.2% while maintaining a relatively constant inference speed. The PBDNet model proposed in this application can better meet the needs of real-time and accurate detection of surface defects in particleboard.
[0121] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by hardware related to computer program instructions. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any reference to memory or other media in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0122] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0123] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0124] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for detecting multi-scale defects on particleboard surfaces, characterized in that, include: Acquire full-frame raw images of the particleboard surface and preprocess them to construct a surface defect dataset; The surface defect dataset includes multiple defect images of different types of surface defects; For defect images of different surface defect types in the surface defect dataset, different data augmentation methods are applied to perform asymmetric data augmentation operations to obtain the augmented surface defect dataset; A PBDNet model is constructed, comprising a backbone network, a neck network, and a detection head. The backbone network includes SPDConv, CBS, C2f_SD, and C2f modules. The neck network includes SPPF, upsampling, stitching, C2f, and SPDConv modules. The detection head includes CBS, Conv2d, Cls loss, and Bbox loss modules. In the backbone network, nine modules are stacked sequentially: SPDConv, CBS, C2f_SD, SPDConv, C2f_SD, SPDConv, C2f_SD, CBS, and C2f, numbered 0-8. In the neck network, nine modules are stacked sequentially: SPPF, upsampling, stitching, C2f, upsampling, stitching, C2f, SPDConv, stitching, C2f, SPDConv, stitching, and C2f, numbered 9-21. The C2f_SD module (number 4) in the backbone network is also connected to the stitching module (number 14) in the neck network. The modules numbered 4 in the backbone network are... The C2f_SD module 6 is also connected to the splicing module numbered 11 in the neck network; the C2f_SD module numbered 8 in the backbone network is also connected to the SPPF module numbered 9 in the neck network; the SPPF module numbered 9 in the neck network is also connected to the splicing module numbered 20 in the neck network; the C2f module numbered 12 in the neck network is also connected to the splicing module numbered 17 in the neck network; the detection head includes several branches, and each branch sequentially stacks a CBS module, a CBS module, a Conv2d module, and a Cls loss module or a Bbox loss module; the C2f modules numbered 15, 18, and 21 in the neck network are respectively connected to the two branches ending with the Cls loss module and the Bbox loss module; The C2f_SD module specifically includes: the DEConv module, the CBS module, the segmentation module, the BottleNeck_SAC module, and the splicing module; The DEConv module consists of a regular convolution module, a horizontal differential convolution module, and a vertical differential convolution module. The regular convolution module is used to extract the intensity level features of the image. The horizontal differential convolution module uses a fixed horizontal gradient convolution kernel to capture horizontal edge features. The vertical differential convolution module uses a fixed vertical gradient convolution kernel to capture vertical edge features. Convolution kernel weights of the horizontal difference convolution module satisfy: ;in The parameters are learnable, and their initial values are set to the weights of the Sobel level kernel, i.e. , , ; The vertical difference convolution module uses a fixed vertical gradient convolution kernel, and its kernel weights... satisfy: ;in The parameters are learnable, and their initial values are set to the weights of the Sobel vertical kernel, i.e. , , ; During the training phase, the output features of ordinary convolution, horizontal difference convolution, and vertical difference convolution are fused by element-wise addition. After training, when performing inference, since the weights of the three convolutions have been learned and fixed, the convolution kernel weights of the three are equivalently merged into a standard convolution kernel through reparameterization. The CBS module is used to adjust the number of channels in an image; The segmentation module is used to split the feature map along the channel dimension, that is, to... The feature map of size is split into two parts. The two feature maps are processed separately, with one part continuing to the next module and the other part sent to the final concatenation module. The concatenation module is used to concatenate the input feature maps on the channels to obtain... Size feature map; Indicates the number of times the BottleNeck_SAC module is repeated; The BottleNeck_SAC module includes a CBS module and a SAC module. The expanded internal structure of the BottleNeck_SAC module has two forms. Its Add parameter is a boolean value, True or False, used to control whether residual joins are used. When Add=True, residual joins are used; when Add=False, residual joins are not used. The SAC module consists of the SAConv module and two global context modules appended before and after the SAConv module. The stitching module is used to stitch the input feature maps together on the channels; The PBDNet model was trained using the enhanced surface defect dataset and then used as a surface defect detection model. A surface defect detection model is used to perform multi-scale defect detection on particleboard surface images.
2. The method for detecting multi-scale defects on particleboard surface according to claim 1, characterized in that, The process of acquiring and preprocessing the full-frame original image of the particleboard surface to construct a surface defect dataset specifically includes: A sliding window slicing process is performed on the full-frame original image of the particleboard surface to extract multiple sub-images. Filter multiple sub-images and retain only those with surface defects; The types of surface defects in the sub-images with surface defects are labeled; the types of surface defects include mottled defects, shavings, oil stains, chipped edges, chalk marks, scratches and cracks; The labeled sub-images are used as defect images and stored as a surface defect dataset.
3. The method for detecting multi-scale defects on particleboard surface according to claim 2, characterized in that, The method involves applying different data augmentation methods to asymmetric data augmentation operations on defect images of different surface defect types within the surface defect dataset. Specifically, this includes: For defect images with surface defects of edge chipping, perform vertical flipping, horizontal flipping, random brightness / contrast changes, and random cropping / scaling operations; For defect images with chalk markings as the surface defect type, perform vertical flipping, blur transformation, random brightness / contrast changes, and random cropping / scaling operations; For defect images with scratches as the surface defect type, perform vertical and horizontal flipping operations; For defect images with surface defects of the type of crack, perform vertical flipping, horizontal flipping, random brightness / contrast changes, and random cropping / scaling operations.
4. The method for detecting multi-scale defects on particleboard surface according to claim 1, characterized in that, The SPDConv module specifically includes: a space-to-depth transformation layer and a non-stretch convolutional layer; The space-to-depth transformation layer is used to transform the input size to a depth-to-depth value. Feature map The image is segmented spatially, and decomposed into four sub-images with half the spatial dimensions by uniform grid sampling. Then subgraph The stacked feature map is obtained by concatenating along the channel dimension. ;in It is spatial dimension. It is the number of channels; express The real space of dimensional numbers; The non-stretch convolutional layer is used to process the stacked feature maps. Using a standard convolution with a stride of 1, the number of channels is compressed to... The downsampled feature map is obtained. .
5. The method for detecting multi-scale defects on particleboard surface according to claim 1, characterized in that, The calculation formula for the SAConv module is as follows: ;in Indicates that the input is Weights are The void ratio is 1 and the output is Ordinary convolution operations; It is a learnable switching function; Weights for participation in training; This refers to the void ratio hyperparameter. This is the output of the SAConv module.
6. The method for detecting multi-scale defects on particleboard surface according to claim 1, characterized in that, The global context module includes a 5×5 average pooling layer and a two-dimensional convolutional layer.
7. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the multi-scale defect detection method for particleboard surface according to any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method for detecting multi-scale defects on particleboard surfaces as described in any one of claims 1 to 6.
9. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the method for detecting multi-scale defects on particleboard surfaces as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Shaving board surface defect detection method and device based on improved YOLOv5
CN117058077A
Defect detection model training method and defect detection method
CN117809110A
Steel plate surface defect detection method based on improved YOLOv8
CN118279272A