Methods, equipment and media for detecting small target defects in materials with periodic textures

CN122550600APending Publication Date: 2026-08-11HUNAN AEROSPACE TIANLU NEW MATERIAL TESTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-14
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0007]为解决上述至少一个技术问题,针对具有周期性纹理的材料特性,有效抑制背景噪声干扰、无损保留极小尺度缺陷的精细空间特征,降低小目标缺陷检测的误检率和漏检率,提高小目标缺陷检测的检测精度,本申请提出一种具有周期性纹理材料的小目标缺陷检测方法、设备及介质

Benefits of technology

[0018] Fourthly, this application provides a computer program product comprising a computer program that, when executed by a processor, implements the steps of the method as described in the first aspect or any of its implementations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122550600A_ABST
    Figure CN122550600A_ABST
Patent Text Reader

Abstract

This application relates to the field of intelligent industrial inspection technology, and provides a method, device, and medium for detecting small target defects in materials with periodic textures. The method includes: acquiring an image of the surface to be inspected from the material with periodic textures, and inputting it into a trained small target defect detection model. The small target defect detection model includes a backbone feature extraction network, a path aggregation feature fusion network, and a detection head prediction network connected in sequence. The small target defect detection model performs feature extraction, feature fusion, and defect prediction processing on the image of the surface to be inspected, and outputs the location coordinates and defect category of the defect. The technical solution provided in this application, targeting the material characteristics of periodic textures, effectively suppresses background noise interference, preserves the fine spatial features of extremely small-scale defects without damage, reduces the false detection rate and false negative rate of small target defect detection, and improves the detection accuracy of small target defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent industrial inspection technology, and in particular relates to a method, equipment and medium for detecting small target defects in materials with periodic textures. Background Technology

[0002] In the field of industrial visual intelligent inspection, the detection of small-target defects in materials with periodic textures is an extremely challenging technical problem. These materials generally exhibit regular, repetitive periodic texture structures on their surfaces. However, tiny defects have a very low pixel ratio and weak effective features, making them highly susceptible to feature aliasing with the textured background and subject to texture interference far greater than ordinary untextured workpieces. Existing mainstream spatial domain detection algorithms based on convolutional neural networks mostly rely on spatial domain convolution to extract features, lacking the ability to distinguish texture noise. They generally suffer from problems such as difficulty in suppressing periodic background textures, insufficient extraction of tiny defect features, and easy submersion of shallow, fine-grained features, leading to particularly severe false positives and false negatives for small-target defects in periodic texture scenarios.

[0003] As a typical high-performance engineering material with a periodic woven texture, aerospace resin matrix composites (RMCs) are widely used in the core load-bearing structural components of spacecraft due to their excellent properties such as high specific strength, high specific modulus, and corrosion resistance. However, during the molding and processing of RMCs, their surfaces are prone to developing micro-defects such as micropores and scratches due to physical factors such as process disturbances and curing shrinkage. If these micro-defects are not detected in time, they may lead to catastrophic structural failures during long-term service cycles. Therefore, efficient and accurate automated visual inspection of RMC surface defects is a key link in ensuring the reliability of aerospace products throughout their entire life cycle.

[0004] However, in real-world industrial scenarios, the detection of minute defects on the surface of aerospace resin-based composite materials with periodic woven textures faces two core technical bottlenecks: 1. Severe Overlap Between Periodic Texture Background and Defect Features: RMCs surfaces possess highly dense and complex periodic multi-axis woven textures, while defects typically manifest as weak, non-periodic perturbations that disrupt local woven patterns. During multi-scale feature extraction in traditional spatial domain convolutional neural networks (CNNs), the weak features of defects are easily and severely overlapped with high-frequency, high-brightness woven texture features. This prevents the network model from effectively distinguishing between periodic texture backgrounds and non-periodic defect features, ultimately leading to the misclassification of a large number of texture background features as defects and resulting in large-scale false detections.

[0005] 2. Multi-level downsampling leads to loss of minute defect features: Existing classic object detection models (such as the traditional YOLO series, Faster R-CNN, etc.) typically use continuous strided convolutions or max pooling in the backbone network for spatial downsampling to expand the network's receptive field and adapt to the needs of multi-scale object detection. This design causes catastrophic information loss or divergence of minute defect features that originally occupy a very small spatial proportion (e.g., less than 10×10 pixels) in the deep feature map, making the network model unable to effectively capture minute defect features, ultimately resulting in a large number of missed small object defects.

[0006] Therefore, how to effectively suppress background noise interference, preserve the fine spatial features of extremely small-scale defects without damage, reduce the false detection rate and false negative rate of small target defect detection, and improve the detection accuracy of small target defect detection has become an urgent problem to be solved for materials with periodic textures. Summary of the Invention

[0007] To address at least one of the aforementioned technical problems, and considering the material characteristics of periodic textures, this application proposes a method, device, and medium for detecting small target defects in materials with periodic textures. This method aims to effectively suppress background noise interference, retain the fine spatial features of extremely small-scale defects without damage, reduce the false detection rate and false negative rate of small target defect detection, and improve the detection accuracy of small target defects.

[0008] In a first aspect, this application provides a method for detecting small target defects in a material with periodic texture, the method comprising: S1. Acquire an image of the surface to be detected with a material having periodic texture, and input it into the trained small target defect detection model. The small target defect detection model includes a backbone feature extraction network, a path aggregation feature fusion network, and a detection head prediction network connected in sequence. S2, the small target defect detection model is used to perform feature extraction, feature fusion and defect prediction processing on the surface image to be detected, and the location coordinates and defect category of the defect are output; The processing steps of the small target defect detection model include: The backbone feature extraction network performs non-destructive downsampling on the surface image to be detected through multiple spatial-to-depth transformations, and extracts feature maps corresponding to several times the downsampling. The path aggregation feature fusion network includes a frequency domain fusion path and a non-frequency domain fusion path. The frequency domain fusion path performs frequency domain decomposition based on two-dimensional discrete wavelet transform for the feature map corresponding to the lowest downsampling factor, modulates the frequency domain components through wavelet convolution, and then reconstructs the fused feature map in the spatial domain through inverse discrete wavelet transform. The non-frequency domain fusion path directly performs feature extraction and multi-scale fusion processing in the spatial domain for the feature maps corresponding to other downsampling factors to obtain the corresponding fused feature maps. The detection head prediction network feeds each fused feature map into the decoupled detection head of the corresponding scale to perform multi-task prediction of defect category classification and defect bounding box regression, so as to obtain the defect category and location coordinates of each defect.

[0009] In one possible implementation, the training process of the small target defect detection model includes: Several surface image samples of the material with periodic texture were collected and defect categories and bounding boxes were labeled. The labeled surface image samples are input into the small target defect detection model, and the predicted defect bounding box and predicted defect category are output for each surface image sample. Based on the predicted defect bounding boxes and labeled bounding boxes, a dynamic regression loss with sample outlier constraints is constructed; based on the predicted defect categories and labeled defect categories, a classification loss is constructed. The total loss is obtained by weighted summation of the dynamic regression loss and the classification loss. The model parameters are then iteratively updated through backpropagation until the total loss converges, and the optimal model weights are saved.

[0010] In one possible implementation, the process of constructing the dynamic regression loss includes: Based on the intersection-union ratio of the predicted defect box and the labeled bounding box, the relative distance between the center points, and the aspect ratio constraints of the bounding box, the regression loss of the basic position of the single-sample bounding box is calculated. The mean regression loss of the bounding box base position of all surface image samples in the current training batch is calculated, and the ratio of the regression loss of the bounding box base position of a single sample to the mean regression loss of the bounding box base position of the batch is used as the outlier of that surface image sample. A dynamic gradient adjustment factor is generated based on outlier degree using a preset non-monotonic function. The final dynamic regression loss is then constructed based on the product of the dynamic gradient adjustment factor and the regression loss of the bounding box base position.

[0011] In one possible implementation, the path aggregation feature fusion network adopts a bidirectional complementary feature aggregation structure of top-down upsampling and bottom-up sampling; In the top-down feature transfer path, the feature map corresponding to the highest downsampling factor is upsampled step by step. The upsampled features are then stitched and fused with shallow features of the same scale in sequence. A frequency domain decoupling enhancement module is set only in the lowest factor feature fusion branch to perform frequency domain decoupling and defect feature enhancement on the shallow high-resolution features. In the bottom-up feature propagation path, the lowest-multiple feature after fusion is downsampled step by step using standard convolution. After each downsampling, it is concatenated and fused with the feature of the next level. In this way, feature aggregation is completed for feature maps corresponding to other downsampling multiples except for the feature map corresponding to the lowest downsampling multiple.

[0012] In one possible implementation, the frequency domain decoupling enhancement module includes a discrete wavelet transform unit, a wavelet convolution unit, and an inverse discrete wavelet transform unit connected in sequence. The discrete wavelet transform unit is used to decompose the feature map corresponding to the lowest downsampling of the input into one low-frequency approximation component and three high-frequency detail components in the horizontal, vertical and diagonal directions through two-dimensional discrete wavelet transform. The wavelet convolution unit is used to perform feature modulation on the low-frequency approximation component and the three sets of high-frequency detail components by independent wavelet convolution, thereby suppressing high-frequency background noise belonging to the periodic woven texture and amplifying the non-periodic abrupt features corresponding to the minute defects. The inverse discrete wavelet transform unit is used to reconstruct a fused feature map in the spatial domain from one modulated low-frequency approximation component and three high-frequency detail components through inverse discrete wavelet transform, thereby decoupling the defect features from the texture background features.

[0013] In one possible implementation, the backbone feature extraction network sequentially includes an initial convolutional module, multiple sets of alternating cascaded spatial-to-depth convolutional SPD-Conv modules and C2f modules, and an SPPF module; The initial convolution module is used to perform initial downsampling on the input image to complete the basic feature extraction; Each SPD-Conv module is used to sample the upper output feature map at intervals along the length and width spatial dimensions, divide it into multiple sub-feature maps, and concatenate all the sub-feature maps in the channel dimension to achieve feature map downsampling, so as to completely preserve the fine-grained edge features of tiny defects. Each group of C2f modules is used to perform multi-gradient feature extraction and channel fusion on the feature map output by the SPD-Conv module; The SPPF module is used to perform multi-scale pooling aggregation on the deepest features of the backbone feature extraction network to expand the feature receptive field and output the feature map corresponding to the highest downsampling factor.

[0014] In one possible implementation, the processing of the backbone feature extraction network includes: The input surface image to be detected is fed into the initial convolution module, and the initial feature extraction and 2x downsampling are performed through the standard convolution operation with a stride of 2 to reduce the image resolution and extract the basic texture features of the image's underlying layers. The feature map output by the initial convolution module is fed into the first SPD-Conv module to complete lossless downsampling, and then the first C2f module performs feature fusion extraction. The first scale feature map is extracted at the output of the first C2f module after a cumulative 4x downsampling, which serves as the shallow high-resolution feature corresponding to the small defect. The feature map output by the first C2f module is sequentially fed into the second SPD-Conv module and the second C2f module for processing. Then, the second scale feature map is extracted from the output of the second C2f module after being downsampled by a cumulative 8 times. After the feature map output by the second C2f module is sequentially fed into the third SPD-Conv module and the third C2f module for processing, the third-scale feature map is extracted from the output of the third C2f module after a cumulative 16-fold downsampling. The feature map output by the third C2f module is sequentially fed into the fourth SPD-Conv module and the fourth C2f module for processing, and then multi-scale feature aggregation is performed by the SPPF module. The fourth-scale feature map is extracted at the output of the SPPF module after a cumulative 32-fold downsampling. The first-scale feature map, the second-scale feature map, the third-scale feature map, and the fourth-scale feature map are respectively input into the path aggregation feature fusion network through skip connections.

[0015] In one possible implementation, the detection head prediction network is configured with multiple sets of independent, decoupled detection heads, which are then fused with features obtained from downsampling at different ratios. Figure 1 One match; Each set of decoupled detection heads is configured with independent classification prediction branches and bounding box regression prediction branches in parallel; the classification prediction branch is used to output the probability value of the category to which the defect belongs; the bounding box regression prediction branch is used to output the center coordinates of the defect and the width and height parameters of the bounding box.

[0016] In a second aspect, this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the method as described in the first aspect or any of the implementations thereof.

[0017] Thirdly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method as described in the first aspect or any of the implementations thereof.

[0018] Fourthly, this application provides a computer program product comprising a computer program that, when executed by a processor, implements the steps of the method as described in the first aspect or any of its implementations.

[0019] Compared with existing technologies, the advantages of this application are as follows: Addressing the challenges of detecting small target defects on the surface of materials with periodic textures—namely, their weak features, susceptibility to interference from regular textures, and easy loss of fine-grained features—the backbone feature extraction network achieves lossless downsampling through multi-layer spatial-to-depth transformation. This effectively avoids the loss of minute defect detail features caused by traditional strided convolution and pooling downsampling, fully preserving the effective feature information of small target defects at different scales. Simultaneously, the path aggregation feature fusion network is divided into frequency domain fusion paths and non-frequency domain fusion paths. Only the shallow features most sensitive to small target defects at the lowest downsampling factor undergo two-dimensional discrete wavelet transform frequency domain decomposition, wavelet convolution integral modulation, and inverse wavelet transform spatial decomposition. The system reconstructs and precisely removes high-frequency noise from the periodic texture background, while enhancing the non-periodic abrupt features of minor defects. This addresses the root cause of false detections and missed detections of small target defects caused by texture interference. For other downsampled scales, deep features are directly fused in the spatial domain to avoid computational redundancy caused by full-domain frequency domain calculations, balancing model detection accuracy and inference real-time performance. Finally, a multi-scale decoupled detection head performs hierarchical classification and bounding box regression multi-task prediction on different fused feature maps, effectively distinguishing between defect classification and localization tasks. This improves the localization accuracy and classification accuracy of small target defects under complex periodic texture conditions, while also enhancing the robustness and detection efficiency of small target defect detection in periodic textured materials.

[0020] It is understood that the electronic devices, computer-readable storage media, and computer program products provided in this application have the same beneficial effects as the above-described method for detecting small target defects in materials with periodic textures, and will not be repeated here. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in this application, the accompanying drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the accompanying 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.

[0022] Figure 1 A flowchart illustrating a method for detecting small target defects in a material with periodic texture, provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a small target defect detection model provided in an embodiment of this application. Detailed Implementation

[0023] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of this application. However, those skilled in the art will understand that this application may be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0024] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0025] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0026] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0027] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0028] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0029] For ease of understanding, the technical solution of this application will be described in detail below with reference to the accompanying drawings.

[0030] Figure 1 This is a flowchart illustrating a method for detecting small target defects in a material with periodic texture, provided in one embodiment of this application. For ease of explanation, only the parts relevant to this embodiment are shown. The method provided in this embodiment includes the following steps: S1: Acquire images of the surface to be detected with periodic textured material and input them into the trained small target defect detection model. The small target defect detection model includes a backbone feature extraction network, a path aggregation feature fusion network, and a detection head prediction network connected in sequence.

[0031] Optionally, materials with periodic textures are aerospace resin-based composite materials. These materials are widely used in key components such as spacecraft shells and aerospace structural load-bearing components. Their surfaces often have defects of extremely small size, such as micron-sized micropores and fine scratches. In addition, the materials themselves have regular woven textures, and texture noise is easily confused with tiny defects, which leads to the problem of missed detection and false detection by conventional detection models. Therefore, it is necessary to conduct targeted small target defect detection.

[0032] As an example, a small-target defect detection model that has been trained to convergence and retains optimal weights is deployed to a dedicated industrial control computer for on-site inspection or an edge computing inspection node for aerospace components. This meets the engineering requirements for offline non-destructive testing and low-latency inference of aerospace components. An industrial camera is acquiring images of the surface of the molded aerospace resin-based composite material component, obtaining raw images of the surface to be inspected, including the material's inherent weave texture, surface micropores, and minor scratches. The acquired surface images are directly input into the deployed small-target defect detection model to perform forward inference, without the need for additional manual preprocessing.

[0033] In one possible implementation, the training process of the small target defect detection model includes: S11: Collect several surface image samples of materials with periodic textures and annotate the defect categories and bounding boxes.

[0034] As an example, several original surface images of aerospace resin-based composite materials were collected. These images contained several minor defects typical of the material, such as micropores and microscratches, while the background of the images was disturbed by the material's inherent periodic woven texture. To address the challenges of collecting defect samples from aerospace resin-based composite materials and the limited number of effective samples, the original surface images were subjected to data augmentation processing such as flipping, cropping, and scaling to expand the sample set and improve the model's resistance to interference from minor defects of different locations and shapes, as well as backgrounds with different textures. All surface image samples were then uniformly scaled to a preset resolution, and the defect categories and defect bounding boxes of each surface image sample were labeled.

[0035] S12 inputs the labeled surface image samples into the small target defect detection model and outputs the predicted defect bounding box and predicted defect category corresponding to each surface image sample.

[0036] As an example, the surface image samples of the labeled aerospace resin-based composite material are input into the small target defect detection model in batches. The model relies on improved structures such as non-destructive downsampling and shallow frequency domain feature enhancement to overcome the interference of composite material weaving texture, and completes multi-scale feature extraction and bidirectional feature fusion step by step. Finally, it outputs the predicted defect bounding box, predicted defect category and category confidence for each surface image sample.

[0037] Preferably, the small target defect detection model employs a frequency-spatial decoupling YOLO (FSD-YOLO) network, and an example of its model structure is shown below. Figure 2 As shown.

[0038] S13: Based on the predicted defect bounding box and the labeled bounding box, construct a dynamic regression loss with sample outlier constraints; based on the predicted defect category and the labeled defect category, construct a classification loss.

[0039] Specifically, to address the pain points of extremely small size and blurred boundary features of micro-defects in aerospace resin-based composite materials and other materials with periodic textures, as well as the severe interference of textures on some samples, high labeling difficulty, and a high proportion of difficult samples, classification loss and dynamic regression loss are constructed respectively. The classification loss is used to identify the surface defect category of materials with periodic textures, while the dynamic regression loss is used to adapt to the localization of micro-defects.

[0040] Preferably, during the model training phase, to address the outlier interference problem caused by blurred annotation boundaries in industrial scenarios, a dynamic focusing mechanism is used to calculate the dynamic regression loss of the bounding boxes. The construction process of the dynamic regression loss specifically includes: S131, based on the intersection-union ratio of the predicted defect box and the labeled bounding box, the relative distance between the center points and the aspect ratio of the bounding box, the regression loss of the basic position of the single sample bounding box is calculated.

[0041] Specifically, since surface defects in materials with periodic textures, such as aerospace resin-based composite materials, typically have a very low pixel ratio, relying solely on the cross-union ratio (CURBR) cannot accurately measure the frame deviation. Therefore, this embodiment integrates the CURBR of the predicted defect box and the actual labeled box, the relative distance between the center points, and the aspect ratio of the bounding box as triple constraints. This comprehensively constrains the positioning deviation of tiny defects, solves the problem of difficult boundary positioning of ultra-small defects in materials with periodic textures, and accurately calculates the basic position regression loss of a single image sample.

[0042] For example, the intersection-union ratio loss, the Euclidean distance loss of the center point, and the aspect ratio loss of the predicted defect box and the real labeled box corresponding to any surface image sample are calculated respectively. The three losses are weighted and summed to obtain the basic position regression loss of the bounding box of the single sample.

[0043] S132, Calculate the mean regression loss of the bounding box base position of all surface image samples in the current training batch, and take the ratio of the regression loss of the bounding box base position of a single sample to the mean regression loss of the bounding box base position of the batch as the outlier of the surface image sample.

[0044] As an example, the mean of the bounding box base position regression loss of all image samples in the current batch is calculated, and the outlier of the sample is calculated by combining the bounding box base position regression loss of a single sample. The larger the outlier, the stronger the texture interference, the more blurred the defects, the greater the difficulty of manual annotation, and the greater the gradient noise, which will seriously drag down the normal training accuracy of the model.

[0045] S133 generates a dynamic gradient adjustment factor based on outlier degree using a preset non-monotonic function. The final dynamic regression loss is then constructed based on the product of the dynamic gradient adjustment factor and the regression loss of the bounding box base position.

[0046] As an example, by pre-setting a non-monotonic function and combining it with the outlier of the samples to adaptively generate a dynamic gradient adjustment factor, the gradient backpropagation weight of highly interfering and difficult samples in materials with periodic textures is reduced in a targeted manner. This weakens the training interference caused by invalid samples such as woven textures and blurred defects, while retaining the effective gradient information of clear and small defect samples. The product of the dynamic gradient adjustment factor and the regression loss of the bounding box base position is used as the final dynamic regression loss adapted to the material detection scenario.

[0047] The dynamic regression loss calculated in this step is the dynamic regression loss corresponding to a single sample. Each sample obtains its own gradient adjustment weight based on its outlier. All samples in the same training batch complete this calculation independently. Finally, the mean of the dynamic regression loss of all samples in the batch is taken as the overall dynamic regression loss of that batch used for backpropagation.

[0048] S14: The total loss is obtained by weighted summation of dynamic regression loss and classification loss. The model parameters are then iteratively updated through backpropagation until the total loss converges, and the optimal model weights are saved.

[0049] As an example, the total loss is obtained by weighted fusion of dynamic regression loss and classification loss. The network parameters are continuously updated iteratively through backpropagation until the model loss converges and the detection accuracy stabilizes on the aerospace resin-based composite material test set. The optimal model weights are then saved, and the training of a dedicated model for detecting minute defects in this special composite material is completed.

[0050] The technical solution provided in this step addresses the pain points of detecting inherently periodic woven textures, extremely low proportions of minute defects, and a large number of difficult samples in aerospace resin-based composite materials. It introduces a non-monotonic dynamic focusing mechanism in the bounding box regression loss calculation during network training. By calculating the relative distance between the ground truth and predicted boxes and combining it with aspect ratio constraints, a basic penalty term adapted to ultra-small defects is constructed. Simultaneously, the mean loss of image samples within the training batch is statistically analyzed in real time to calculate the outlier degree of each sample, and the gradient focusing factor is adaptively adjusted based on the outlier degree. This mechanism can automatically reduce the gradient weights of extreme texture interference and difficult-to-label anomalous samples in the image samples, enabling the model training to stably focus on common minute defect samples, effectively improving the detection accuracy and training stability of micropores and micro-scratches on the surface of materials with periodic textures.

[0051] S2 uses a small target defect detection model to perform feature extraction, feature fusion, and defect prediction on the surface image to be inspected, and outputs the location coordinates and defect category of the defect.

[0052] The processing steps of the small target defect detection model include: The backbone feature extraction network performs multi-layer spatial-to-depth transformation to perform non-destructive downsampling of the surface image to be detected, and extracts feature maps corresponding to several times the downsampling. The path aggregation feature fusion network includes a frequency domain fusion path and a non-frequency domain fusion path. The frequency domain fusion path performs frequency domain decomposition based on two-dimensional discrete wavelet transform for the feature map corresponding to the lowest downsampling factor, modulates the frequency domain components through wavelet convolution, and then reconstructs the fused feature map in the spatial domain through inverse discrete wavelet transform. The non-frequency domain fusion path directly performs feature extraction and multi-scale fusion processing in the spatial domain for the feature maps corresponding to other downsampling factors to obtain the corresponding fused feature maps. The detection head prediction network feeds each fused feature map into the decoupled detection head at the corresponding scale to perform multi-task prediction of defect category classification and defect bounding box regression, thereby obtaining the defect category and location coordinates of each defect.

[0053] As an example, such as Figure 2As shown, the backbone feature extraction network performs lossless downsampling through multiple sets of Space-to-Depth Convolution (SPD-Conv) modules, extracting feature maps corresponding to 4x, 8x, 16x, and 32x downsampling, respectively. In the path aggregation feature fusion network, the frequency domain fusion path performs frequency domain decomposition based on two-dimensional discrete wavelet transform for the feature map corresponding to 4x downsampling, modulates the frequency domain components through wavelet convolution, and then reconstructs the fused feature map in the spatial domain through inverse discrete wavelet transform. The non-frequency domain fusion path directly performs feature extraction and multi-scale fusion processing in the spatial domain for the feature maps corresponding to 8x, 16x, and 32x downsampling, obtaining the corresponding fused feature maps. The detection head prediction network feeds the four sets of fused feature maps into the decoupled detection head at the corresponding scale for multi-task prediction of defect category classification and defect bounding box regression, obtaining the defect category, location coordinates, and category confidence of each defect.

[0054] The technical solution provided in this application addresses the challenges of detecting small target defects on the surface of materials with periodic textures, which suffer from weak features, susceptibility to interference from regular textures, and easy loss of fine-grained features. The backbone feature extraction network achieves lossless downsampling through multi-layer spatial-to-depth transformation, effectively avoiding the loss of minute defect detail features caused by traditional strided convolution and pooling downsampling, and fully preserving the effective feature information of small target defects at different scales. At the same time, the path aggregation feature fusion network is divided into frequency domain fusion path and non-frequency domain fusion path, and only performs two-dimensional discrete wavelet transform frequency domain decomposition, wavelet convolution integral modulation, and inverse wavelet transform spatial reconstruction on the shallow features most sensitive to small target defects at the lowest downsampling factor. This method accurately removes high-frequency noise from periodic texture backgrounds and enhances the non-periodic abrupt features of minor defects, fundamentally solving the problem of false detection and missed detection of small target defects caused by texture interference. For other downsampled scale deep features, a spatial domain direct fusion method is adopted to avoid computational redundancy caused by full-domain frequency domain calculation, balancing model detection accuracy and inference real-time performance. Finally, a multi-scale decoupled detection head performs hierarchical classification and bounding box regression multi-task prediction on different fused feature maps, effectively distinguishing between defect classification and localization tasks, improving the localization accuracy and classification accuracy of small target defects under complex periodic texture conditions, and improving the robustness and detection efficiency of small target defect detection in periodic texture materials.

[0055] In one possible implementation, the backbone feature extraction network sequentially includes an initial convolutional module, multiple sets of alternating SPD-Conv modules, a Cross Stage Partial Fusion (C2f) module, and a Spatial Pyramid Pooling-Fast (SPPF) module. The initial convolutional module is used to perform initial downsampling on the input image to complete basic feature extraction; Each SPD-Conv module is used to sample the upper output feature map at intervals along the length and width spatial dimensions, divide it into multiple sub-feature maps, and concatenate all sub-feature maps in the channel dimension. Throughout the process, it abandons downsampling methods such as strided convolution and max pooling, which are prone to causing the loss of small target features, to achieve lossless downsampling of feature maps and fully preserve the fine-grained edge features of tiny defects. Each C2f module is used to perform multi-gradient feature extraction and channel fusion on the feature map output by the SPD-Conv module, enriching the feature representation capability. The SPPF module is used to perform multi-scale pooling aggregation on the deepest features of the backbone feature extraction network to expand the feature receptive field, enhance the semantic information of deep features, and output the deep feature map corresponding to the highest downsampling factor.

[0056] As an example, such as Figure 2 As shown, the process of progressive downsampling and multi-scale feature output in the backbone feature extraction network is similar to... Figure 2 The data flow shown corresponds perfectly to the processing steps of the backbone feature extraction network, which may include: The input surface image to be detected is fed into the initial convolution module. The initial feature extraction and 2x downsampling are performed through the standard convolution operation with a stride of 2 to reduce the image resolution and extract the basic texture features of the image's underlying layers. The feature map output from the initial convolutional module is fed into the first SPD-Conv module for lossless downsampling, and then fused and extracted by the first C2f module. Finally, a first-scale feature map is extracted from the output of the first C2f module after a cumulative 4x downsampling, serving as the shallow high-resolution feature corresponding to the minor defects. This shallow high-resolution feature map corresponds to... Figure 2 The P2 feature branch in the model is specifically designed to capture extremely small surface defects. The feature map output from the first C2f module is sequentially fed into the second SPD-Conv module and then the second C2f module for processing. Finally, a second-scale feature map is extracted from the output of the second C2f module, which has undergone a cumulative 8-fold downsampling. Figure 2 The P3 characteristic branch in the text; The feature map output from the second C2f module is sequentially fed into the third SPD-Conv module and then the third C2f module for processing. Finally, a third-scale feature map is extracted from the output of the third C2f module, which has undergone a cumulative 16x downsampling. Figure 2 The P4 characteristic branch in the text; The feature map output from the third C2f module is sequentially fed into the fourth SPD-Conv module and then the fourth C2f module for processing. After multi-scale feature aggregation via the SPPF module, the fourth-scale feature map is extracted from the output of the SPPF module, which has undergone a cumulative 32x downsampling. Figure 2 The P5 deep feature branch in the data; The first-scale feature map, the second-scale feature map, the third-scale feature map, and the fourth-scale feature map are respectively processed through... Figure 2 The skip connection branches marked in the diagram are directly input into the backend path aggregation feature fusion network to achieve cross-layer transmission of shallow detailed features and deep semantic features.

[0057] The backbone feature extraction network proposed in this embodiment abandons the traditional strided convolution and pooling layers in the feature extraction stage and introduces a spatial-to-depth transformation mechanism. This mechanism proportionally transfers redundant spatial dimension information of the input feature map to the channel dimension, thereby achieving feature map downsampling and feature size compression while avoiding the irreversible loss of weak edge information of small defects. At the same time, combined with the model structure graph network architecture, a dedicated 4x downsampled shallow high-resolution feature path is introduced to build a dedicated small defect prediction branch, which is specifically adapted to the detection needs of ultra-small defects such as aerospace resin-based composite materials, and completely preserves the spatial geometric contour of small target defects.

[0058] In one possible implementation, the path aggregation feature fusion network adopts a bidirectional complementary feature aggregation structure of top-down upsampling and bottom-up sampling; In the top-down feature transfer path, the feature map corresponding to the highest downsampling factor is upsampled step by step. The upsampled features are then stitched and fused with shallow features of the same scale in sequence. A frequency domain decoupling enhancement module is set only in the lowest factor feature fusion branch to perform frequency domain decoupling and defect feature enhancement on the shallow high-resolution features. In the bottom-up feature propagation path, the lowest-multiple feature after fusion is downsampled step by step using standard convolution. After each downsampling, it is concatenated and fused with the feature of the next level. In this way, feature aggregation is completed for feature maps corresponding to other downsampling multiples except for the feature map corresponding to the lowest downsampling multiple.

[0059] As an example, such as Figure 2 As shown, the feature flow direction of two paths in the path aggregation feature fusion network is... Figure 2The arrows in the middle point flow direction are completely consistent. In the top-down feature transfer path, the deepest fourth-scale feature map is upsampled and amplified step by step upwards. The upsampled features are then concatenated and fused with shallow features of the same scale. Only the top-level first-scale feature fusion branch has a frequency domain decoupling enhancement module, while the other branches use the conventional C2f module. This is to specifically perform frequency domain decoupling and defect feature enhancement on the shallow high-resolution features, matching the characteristic that shallow features are easily affected by texture noise. In the bottom-up feature transfer path, the fused first-scale shallow features are downsampled step by step downwards using a standard convolution with a stride of 2. After each downsampling, the features are concatenated and fused with the next level of features, thus completing the feature aggregation of the second, third, and fourth-scale feature maps in sequence. The shallow detailed features are then fed back to the deep network to fill in the problem of missing details in the deep feature locations.

[0060] Preferably, the frequency domain decoupling enhancement module includes a discrete wavelet transform unit, a wavelet convolution unit, and an inverse discrete wavelet transform unit connected in sequence, thus fully realizing the frequency domain noise reduction and enhancement process. The discrete wavelet transform unit is used to decompose the feature map corresponding to the lowest downsampling of the input into one low-frequency approximation component and three high-frequency detail components in the horizontal, vertical and diagonal directions through two-dimensional discrete wavelet transform. Wavelet convolution units are used to perform feature modulation on low-frequency approximation components and three sets of high-frequency detail components using independent wavelet convolution, suppressing high-frequency background noise belonging to periodic woven textures and amplifying non-periodic abrupt features corresponding to minute defects. The inverse discrete wavelet transform unit is used to reconstruct a fused feature map in the spatial domain from one modulated low-frequency approximation component and three high-frequency detail components through inverse discrete wavelet transform, thereby decoupling defect features from texture background features.

[0061] As another example, based on the surface texture density, texture coarseness, and defect distribution characteristics of the material to be tested with periodic texture, the frequency domain decoupling enhancement module can be adaptively selected to set up feature fusion branches of different scales, so as to overcome the limitation of a single fixed shallow branch enhancement.

[0062] For example, the density parameters of the surface texture and the high-frequency noise distribution characteristics of the material to be tested can be statistically analyzed in advance: for materials with high texture density, complex texture details, and high-frequency interference concentrated in the shallow region, the frequency domain decoupling enhancement module is configured only in the first-scale shallow feature fusion branch; for materials with complex texture levels, uneven density distribution, and a large amount of periodic texture noise remaining in the mesoscale features, the frequency domain decoupling enhancement module can be added simultaneously in the first-scale and second-scale feature fusion branches; for materials with sparse texture and weak background interference, only the conventional spatial domain feature fusion branch can be retained or some frequency domain decoupling enhancement branches can be selectively turned off.

[0063] The aforementioned adaptive configuration method can flexibly match the frequency domain noise reduction enhancement level according to the actual interference characteristics of different periodic texture materials. This avoids the shortcomings of a single shallow enhancement layer being unable to adapt to complex multi-level texture interference, and can also reduce redundant frequency domain calculations for low-interference scenarios. While ensuring the noise reduction enhancement effect of various periodic texture materials, it further optimizes the model inference efficiency and greatly improves the general adaptability to different types of periodic texture industrial materials.

[0064] The path aggregation feature fusion network proposed in this embodiment adopts a bidirectional path aggregation feature fusion structure combining top-down and bottom-up approaches. On the one hand, relying on the top-down upsampling path, deep strong semantic features are progressively transferred to the shallow layer to compensate for the lack of semantic information in the shallow features. On the other hand, through the bottom-up progressive downsampling path, the rich edge detail features of the shallow layer are fed back to the deep features, effectively making up for the loss of positional details in the deep features, and realizing bidirectional complementary fusion of multi-scale features. At the same time, this embodiment differentiates the feature fusion branches, only applying them to features susceptible to the periodic weave texture of composite materials. The interference-prone feature branch is enhanced with a frequency domain decoupling module, while the other branches retain the conventional C2f module. Under the premise of ensuring that the overall network inference speed is not affected, the high and low frequency components of the feature are decomposed by discrete wavelet transform. Different frequency components are modulated differently by wavelet convolution to accurately suppress high-frequency texture background noise and enhance the abrupt features of small defects. Finally, the feature is reconstructed by inverse wavelet transform, which efficiently achieves complete decoupling of defect features and interference texture. This avoids the computational redundancy problem caused by full-domain frequency domain processing and significantly improves the anti-interference ability and detection accuracy of small defects in complex texture backgrounds.

[0065] In one possible implementation, the detection head prediction network is configured with multiple sets of independent, decoupled detection heads, and these multiple sets of decoupled detection heads are fused with features from downsampling at different ratios. Figure 1 One match; Each decoupled detection head is configured with independent classification prediction and bounding box regression prediction branches in parallel. The parameters of the two branches are not shared, and the tasks do not interfere with each other. The classification prediction branch is used to output the probability value of the category to which the defect belongs; the bounding box regression prediction branch is used to output the center coordinates of the defect and the width and height parameters of the bounding box.

[0066] As an example, such as Figure 2 As shown, the detection head prediction network corresponds to four-scale feature paths. Four sets of independent decoupled detection heads are set up, namely the first-scale detection head, the second-scale detection head, the third-scale detection head, and the fourth-scale detection head, which correspond to and match the four feature branches one by one. The first-scale detection head is matched with a 4x downsampling fusion feature map to detect micro-defects such as microholes and minor scratches with pixel sizes smaller than 10×10 pixels; the second-scale detection head is matched with an 8x downsampling fusion feature map to detect small-sized defects; the third-scale detection head is matched with a 16x downsampling fusion feature map to detect medium-sized defects; and the fourth-scale detection head is matched with a 32x downsampling fusion feature map to detect large-sized defects, achieving accurate detection of defects across all sizes.

[0067] Preferably, each classification prediction branch simultaneously calculates the defect category and the defect category confidence level. Only when the defect category confidence level is higher than the preset confidence level threshold, the small defect area on the material surface is automatically and accurately selected, and the detection results such as defect coordinates and defect type are output simultaneously. The entire process does not require contact with the material component being tested, realizing automated, high-precision, non-contact, and non-destructive testing of surface defects of material components.

[0068] This embodiment addresses the multi-scale defect distribution characteristics of materials with periodic textures, encompassing micropores, minor scratches, and large-scale damage. It sets up multiple sets of independently decoupled detection heads with one-to-one correspondences for the multi-scale feature pathways of the matching network. Relying on feature maps with different downsampling magnifications, it adapts to the detection needs of defects of different sizes. A high-resolution feature branch with 4x downsampling is specifically used to identify ultra-small defects smaller than 10×10 pixels, overcoming the shortcoming of conventional single detection heads in balancing the accuracy of detecting defects of different sizes. This achieves hierarchical adaptation detection of defects of all sizes on materials with periodic textures. Simultaneously, the detection head is split into independent classification prediction branches and bounding box regression prediction branches with non-shared parameters, separating the defect classification and bounding box regression learning tasks. This avoids the problems of mutual interference and gradient conflicts between the two tasks, effectively improving the accuracy of defect classification and the accuracy of small defect bounding box localization. This further adapts to the detection conditions of small defects on materials with periodic textures where the boundaries are blurred and localization is difficult, thus improving the overall stability and accuracy of the model's multi-scale defect detection.

[0069] In summary, the technical solution provided in this embodiment achieves lossless downsampling by introducing the SPD-Conv module into the backbone feature extraction network, constructing four scale feature paths at 4x, 8x, 16x, and 32x. This effectively avoids the loss of fine-grained features of minute defects caused by traditional downsampling methods, ensuring the complete preservation of shallow small target defect features. Simultaneously, a wavelet frequency domain transform mechanism is introduced into the shallow feature branch of the 4x downsampling. Through discrete wavelet transform, feature frequency domain decomposition, wavelet convolutional integral modulation, and inverse wavelet transform spatial reconstruction are completed, accurately separating the periodic texture background noise of the material surface from the effective features of minute defects. This solves the problem of false detection and missed detection of small target defects caused by texture interference. Furthermore, frequency domain enhancement is only applied to shallow features sensitive to small targets, while other deep features retain conventional spatial domain fusion methods, balancing model detection accuracy and inference real-time performance. Finally, a multi-scale decoupled detection head is used to achieve hierarchical detection of defects of different sizes, further improving the positioning accuracy and classification accuracy of various sizes of defects under complex texture conditions, while ensuring the robustness and detection efficiency of small target defect detection on the material surface.

[0070] On the other hand, this application also provides a computer storage medium storing executable program code; the executable program code is used to execute any of the above-mentioned methods for detecting small target defects in materials with periodic textures.

[0071] On the other hand, this application also provides an electronic device, including a memory and a processor; the memory stores program code that can be executed by the processor; the program code is used to execute any of the above-mentioned methods for detecting small target defects in materials with periodic textures.

[0072] For example, the program code may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the program code in an electronic device.

[0073] The electronic device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The electronic device may include, but is not limited to, processors and memory. Those skilled in the art will understand that the electronic device may also include input / output devices, network access devices, buses, etc.

[0074] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0075] The memory can be an internal storage unit of the electronic device, such as a hard drive or RAM. It can also be an external storage device, such as a plug-in hard drive, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory can include both internal and external storage units. The memory is used to store the program code and other programs and data required by the electronic device. The memory can also be used to temporarily store data that has been output or will be output.

[0076] The computer storage medium and electronic device described above are created based on the above method. Their technical functions and beneficial effects will not be elaborated here. The technical features of the above embodiments can be combined arbitrarily. 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.

[0077] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A method of small target defect detection of a material having a periodic texture, characterized by, The method comprises: S1, collecting an image of a surface to be detected with a periodic textured material, and inputting the image into a small target defect detection model trained, the small target defect detection model comprising a backbone feature extraction network, a path aggregation feature fusion network and a detection head prediction network connected in sequence; S2, performing feature extraction, feature fusion and defect prediction processing on the image of the surface to be detected by the small target defect detection model, and outputting the position coordinates and defect categories of the defects; The processing process of the small target defect detection model comprises: The backbone feature extraction network performs lossless down-sampling on the image of the surface to be detected through multi-layer space-to-depth conversion, and extracts feature maps corresponding to several times of down-sampling respectively; The path aggregation feature fusion network comprises a frequency domain fusion path and a non-frequency domain fusion path; the frequency domain fusion path performs frequency domain decomposition on the feature map corresponding to the lowest times of down-sampling based on two-dimensional discrete wavelet transform, modulates the frequency domain components through wavelet convolution, and reconstructs the fusion feature map in the spatial domain through inverse discrete wavelet transform; the non-frequency domain fusion path directly performs feature extraction and multi-scale fusion processing on the feature maps corresponding to other times of down-sampling in the spatial domain to obtain the corresponding fusion feature maps; The detection head prediction network sends each fusion feature map to a corresponding scale decoupled detection head to perform multi-task prediction of defect category classification and defect bounding box regression, and obtains the defect category and position coordinates of each defect.

2. The method of claim 1, wherein, The training process of the small target defect detection model comprises: Collecting a plurality of surface image samples with the periodic textured material and labeling the defect categories and bounding boxes; Inputting the labeled surface image samples into the small target defect detection model to output the predicted defect bounding boxes and predicted defect categories corresponding to each surface image sample; Based on the predicted defect bounding boxes and the labeled bounding boxes, a dynamic regression loss with sample outlying degree constraint is constructed; based on the predicted defect categories and the labeled defect categories, a classification loss is constructed; The dynamic regression loss and the classification loss are weighted and summed to obtain a total loss, and the model parameters are updated through back propagation iteration until the total loss converges, and the optimal model weight is saved.

3. The method of claim 2, wherein, The construction process of the dynamic regression loss comprises: Based on the intersection over union, the center point relative distance and the bounding box height-width ratio constraint of the predicted defect box and the labeled bounding box, a single sample bounding box basic position regression loss is calculated; The average of the bounding box basic position regression losses of all surface image samples in the current training batch is calculated, and the ratio of the single sample bounding box basic position regression loss to the average of the bounding box basic position regression losses in the batch is taken as the outlying degree of the surface image sample; A dynamic gradient adjustment factor is generated based on the outlying degree through a preset non-monotonic function, and a final dynamic regression loss is constructed based on the product of the dynamic gradient adjustment factor and the bounding box basic position regression loss.

4. The method of claim 1, wherein, The path aggregation feature fusion network adopts a bidirectional complementary feature aggregation structure of top-down up-sampling and bottom-up down-sampling; In the top-down feature transfer path, the feature map corresponding to the highest downsampling factor is upsampled step by step. The upsampled features are then stitched and fused with shallow features of the same scale in sequence. A frequency domain decoupling enhancement module is set only in the lowest factor feature fusion branch to perform frequency domain decoupling and defect feature enhancement on the shallow high-resolution features. In the bottom-up feature propagation path, the lowest-multiple feature after fusion is downsampled step by step using standard convolution. After each downsampling, it is concatenated and fused with the feature of the next level. In this way, feature aggregation is completed for feature maps corresponding to other downsampling multiples except for the feature map corresponding to the lowest downsampling multiple.

5. The method of claim 4, wherein, The frequency domain decoupling enhancement module includes a discrete wavelet transform unit, a wavelet convolution unit, and an inverse discrete wavelet transform unit connected in sequence: The discrete wavelet transform unit is used to decompose the feature map corresponding to the lowest downsampling of the input into one low-frequency approximation component and three high-frequency detail components in the horizontal, vertical and diagonal directions through two-dimensional discrete wavelet transform. The wavelet convolution unit is used to perform feature modulation on the low-frequency approximation component and the three sets of high-frequency detail components by independent wavelet convolution, thereby suppressing high-frequency background noise belonging to the periodic woven texture and amplifying the non-periodic abrupt features corresponding to the minute defects. The inverse discrete wavelet transform unit is used to reconstruct a fused feature map in the spatial domain from one modulated low-frequency approximation component and three high-frequency detail components through inverse discrete wavelet transform, thereby decoupling the defect features from the texture background features.

6. The method of claim 1, wherein, The backbone feature extraction network includes, in sequence, an initial convolutional module, multiple sets of alternating and cascaded spatial-to-depth convolutional SPD-Conv modules and C2f modules, and an SPPF module; The initial convolution module is used to perform initial downsampling on the input image to complete the basic feature extraction; Each SPD-Conv module is used to sample the upper output feature map at intervals along the length and width spatial dimensions, divide it into multiple sub-feature maps, and concatenate all the sub-feature maps in the channel dimension to achieve feature map downsampling, so as to completely preserve the fine-grained edge features of tiny defects. Each group of C2f modules is used to perform multi-gradient feature extraction and channel fusion on the feature map output by the SPD-Conv module; The SPPF module is used to perform multi-scale pooling aggregation on the deepest features of the backbone feature extraction network to expand the feature receptive field and output the feature map corresponding to the highest downsampling factor.

7. The method of claim 6, wherein, The processing steps of the backbone feature extraction network include: The input surface image to be detected is fed into the initial convolution module, and the initial feature extraction and 2x downsampling are performed through the standard convolution operation with a stride of 2 to reduce the image resolution and extract the basic texture features of the image's underlying layers. The feature map output by the initial convolution module is fed into the first SPD-Conv module to complete lossless downsampling, and then the first C2f module performs feature fusion extraction. The first scale feature map is extracted at the output of the first C2f module after a cumulative 4x downsampling, which serves as the shallow high-resolution feature corresponding to the small defect. The feature map output by the first C2f module is sequentially fed into the second SPD-Conv module and the second C2f module for processing. Then, the second scale feature map is extracted from the output of the second C2f module after being downsampled by a cumulative 8 times. After the feature map output by the second C2f module is sequentially fed into the third SPD-Conv module and the third C2f module for processing, the third-scale feature map is extracted from the output of the third C2f module after a cumulative 16-fold downsampling. The feature map output by the third C2f module is sequentially fed into the fourth SPD-Conv module and the fourth C2f module for processing, and then multi-scale feature aggregation is performed by the SPPF module. The fourth-scale feature map is extracted at the output of the SPPF module after a cumulative 32-fold downsampling. The first-scale feature map, the second-scale feature map, the third-scale feature map, and the fourth-scale feature map are respectively input into the path aggregation feature fusion network through skip connections.

8. The method according to any one of claims 1 to 7, characterized in that, The detection head prediction network is configured with multiple sets of independent decoupled detection heads, and each set of decoupled detection heads is matched one-to-one with a feature map fused by downsampling at different multiples. Each set of decoupled detection heads is configured with independent classification prediction branches and bounding box regression prediction branches in parallel; the classification prediction branch is used to output the probability value of the category to which the defect belongs; the bounding box regression prediction branch is used to output the center coordinates of the defect and the width and height parameters of the bounding box.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.