Magnetic sheet surface defect detection method based on improved target detection model
By improving the YOLOv1n network model, combining the C3k2_Her module and the multi-layer feature pyramid structure, the problems of missed and missed detection in magnetic sheet surface defect detection are solved, and efficient and accurate magnetic sheet surface defect detection is achieved, which is suitable for industrial production lines.
Patent Information
- Application Number
- CN202510499131.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-15
AI Technical Summary
The existing magnetic sheet surface defect detection methods are prone to missed or missed micro defects under low contrast and complex backgrounds. The traditional methods are inefficient or have high equipment costs, making it difficult to meet the real-time and accuracy requirements of industrial production.
Build an improved YOLOv1n basic network model, including backbone network, neck network and head network, and adopts C3k2_Her module, multi-layer feature pyramid structure and C3k2_FFCM module to improve sensitivity to subtle defects and edge information on the surface of the magnetic sheet, and optimize the model complexity to meet real-time detection needs.
It significantly improves the detection accuracy and efficiency of tiny defects on the surface of the magnetic sheet, reduces the calculation cost, meets the real-time inspection requirements of industrial sites, and has good industrial application value.
Smart Images

Figure CN120495681A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for detecting surface defects of magnetic sheets, and in particular to a method for detecting surface defects of magnetic sheets based on an improved target detection model, belonging to the technical field of machine vision defect detection. Background Art
[0002] As an important magnetic functional material, magnetic sheets are widely used in key equipment such as motors, generators, wind turbines, and high-precision sensors. Their surface quality directly impacts the performance and reliability of the final product. However, during the production process, magnetic sheets are prone to various defects, such as polarization, breakage, edge chipping, and missing grinding. These defects vary in shape and size, and the surface of the magnetic sheets themselves is often dark gray, low in contrast, and accompanied by complex grinding textures and uneven brightness, which poses a significant challenge to defect detection.
[0003] Traditional inspection methods, such as manual visual inspection, suffer from low efficiency, strong subjectivity, fatigue, and high rates of missed and false positives. While some non-destructive testing technologies (such as spectroscopy, ultrasound, laser, and X-ray) offer high precision, they are typically expensive, slow, and demanding on the environment and operators. These factors make them difficult to meet the dual demands of speed (required to reach at least 3 pieces per second) and precision (required to detect defects larger than 0.1 mm) required on large-scale industrial production lines.
[0004] In recent years, deep learning-based object detection models (such as Faster R-CNN and the YOLO series) have demonstrated great potential in industrial defect detection. However, existing models still face the following challenges when directly applied to magnetic disk defect detection: First, they are prone to missing or misdetecting small defects in low-contrast and complex backgrounds, which are common in magnetic disk images; second, standard convolution operations are limited in their ability to capture the multi-scale characteristics and fine edge details of defects; and third, some high-precision models have high computational complexity, making it difficult to meet the real-time requirements of industrial production. Therefore, there is an urgent need for a defect detection method that is optimized for the imaging characteristics and detection requirements of magnetic disks and that balances high precision and efficiency. Summary of the Invention
[0005] Based on the above background, the purpose of the present invention is to provide a magnetic sheet surface defect detection method based on an improved target detection model, to improve the detection accuracy and efficiency of tiny defects on the magnetic sheet surface, especially in low contrast and complex backgrounds, to meet the requirements of industrial real-time detection.
[0006] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:
[0007] A method for detecting surface defects of magnetic sheets based on an improved target detection model, the method comprising the following steps:
[0008] A defect detection model comprising a backbone network, a neck network and a head network is constructed based on the YOLO11n basic network model; wherein the backbone network includes at least one convolution module, at least one C3k2_Her module combining an edge refinement structure and a hierarchical edge refinement structure, a spatial pyramid pooling fast module and a C2PSA module combining a cross-stage local structure and a pyramid squeeze attention mechanism; the neck network is constructed based on a path aggregation feature pyramid network structure and has a multi-layer feature pyramid structure for processing low-level feature maps to fuse them into higher-level feature maps, the multi-layer feature pyramid structure includes a spatial depth convolution module for downsampling low-level feature maps and a CSP_OmniKernel module for feature fusion, the neck network also includes at least one C3k2_FFCM module combining a cross-stage local structure and a fused Fourier convolution mixer module; the head network includes multiple convolution layers for classifying and regressing feature maps of different scales from the neck network;
[0009] Acquire a surface image of a magnetic sheet and form a magnetic sheet surface defect dataset containing multiple defect types, divide the dataset into a training set, a validation set, and a test set, and use the training set and the validation set to train the defect detection model;
[0010] Acquire a surface image of the magnetic sheet to be inspected, and input the surface image of the magnetic sheet to be inspected into the trained defect detection model for defect detection;
[0011] Based on the defect detection result of the defect detection model, surface defect information of the magnetic sheet to be detected is output, where the surface defect information includes the type and position of the defect.
[0012] Preferably, the steps of constructing the C3k2_Her module include:
[0013] Split the input features into the first part of features and the second part of features;
[0014] Processing the first portion of features through a convolutional module;
[0015] Processing the second portion of features through at least one Her module;
[0016] splicing the output after the first part of feature processing and the output after the second part of feature processing;
[0017] The concatenated features are fused through a 1x1 convolution module and then output.
[0018] Preferably, the steps of constructing the Her module include:
[0019] Perform multi-scale adaptive average pooling on the input features to generate multiple pooled features of different scales;
[0020] The pooled features of each scale are respectively subjected to channel dimensionality reduction through a 1x1 convolution module, and then feature extraction through a 3x3 convolution module;
[0021] The features extracted at each scale are upsampled to the size of the original input features and are respectively subjected to edge enhancement processing through an edge refinement module;
[0022] All edge-enhanced features are concatenated with the original input features processed by a convolution module;
[0023] The spliced features are fused through a convolution module and then output.
[0024] Preferably, the step of constructing the edge refinement module includes:
[0025] Perform average pooling operation on the input features to obtain a smooth feature map;
[0026] Calculating the difference between the input feature and the smoothed feature map to obtain edge information features;
[0027] The edge information features are subjected to nonlinear transformation through a convolution module to obtain enhanced edge features;
[0028] The enhanced edge features are added to the input features element by element and then output.
[0029] Preferably, the step of constructing the multi-layer feature pyramid structure includes:
[0030] Obtaining a lower-layer feature map and a higher-layer feature map from the backbone network;
[0031] Downsampling the lower layer feature map using the spatial depth convolution module;
[0032] Concatenate the downsampled lower-level feature map with the higher-level feature map;
[0033] The CSP_OmniKernel module is used to fuse the spliced features.
[0034] Preferably, the steps of constructing the spatial depth convolution module include:
[0035] Applying a spatial depth layer to downsample the input feature map, wherein the spatial depth layer converts the spatial dimension information to the channel dimension;
[0036] Apply the non-strided convolution layer to perform convolution operation on the feature map processed by the spatial depth layer and output it.
[0037] Preferably, the steps of constructing the CSP_OmniKernel module include:
[0038] Split the input features into the first part and the second part;
[0039] Processing the first portion of features through a convolutional module;
[0040] Processing the second part of features sequentially through a convolution module and an OmniKernel module;
[0041] splicing the output after the first part of processing with the output after the second part of processing;
[0042] The spliced features are fused through a convolution module and then output;
[0043] The OmniKernel module includes a global branch for capturing global information, a large branch for capturing large receptive field features, and a local branch for local signal modulation.
[0044] Preferably, the steps of constructing the C3k2_FFCM module include:
[0045] Split the input features into the first part of features and the second part of features;
[0046] Processing the first portion of features through a convolutional module;
[0047] processing the second portion of features through at least one FFCM module;
[0048] splicing the output after the first part of feature processing and the output after the second part of feature processing;
[0049] The concatenated features are fused through a 1x1 convolution module and then output.
[0050] Preferably, the steps of constructing the FFCM module include:
[0051] The first convolution module is used to process the input features and divide the input features into two groups. Multi-scale local features are extracted through spatial domain deep convolution with different convolution kernel sizes, and the second convolution module is used to fuse the spatial domain features.
[0052] Applying a frequency domain fusion module to process the spatial domain features to obtain frequency domain enhanced features, the frequency domain fusion module including discrete Fourier transform, convolution processing of the real part and the imaginary part, and inverse discrete Fourier transform;
[0053] Adding the spatial domain features and the frequency domain enhanced features element by element;
[0054] The third convolution module is used to compress the channels of the added features and then output them.
[0055] Preferably, when the defect detection model is trained using the training set and the validation set, the network training parameters are set to: batch size is 8, the number of data loading processes is 4, the optimizer is stochastic gradient descent, the learning rate is 0.01, the momentum is 0.937, and the number of training rounds is 300.
[0056] Compared with the prior art, the present invention has the following advantages:
[0057] The present invention provides a magnetic disk surface defect detection method based on an improved target detection model. The method improves the YOLOv11n lightweight model to construct a targeted defect detection model. While improving the detection accuracy, the model complexity is optimized, the computational cost is reduced, and the speed requirements of real-time detection in industrial sites can be met. By introducing the C3k2_Her module based on the edge refinement structure and the layered edge refinement structure into the backbone network, the sensitivity of the model to subtle defects and edge information on the magnetic disk surface is significantly improved, and the detection effect of the model under complex texture background is improved. By designing a multi-layer feature pyramid structure in the neck network, the spatial depth convolution module is used to efficiently process the low-level features and combined with the CSP_OmniKernel module for fusion, the detection accuracy of small-size defects on the magnetic disk surface is effectively improved. By introducing the C3k2_FFCM module based on FFCM into the neck network, the frequency domain information is used to assist global feature modeling, thereby improving the model's accuracy in capturing different types of defect features. The present invention designs a model based on the actual characteristics of magnetic disk defects, and verifies its effectiveness on actual data sets. The detection accuracy is improved, and it has good industrial application value. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0059] Figure 1 1 is a schematic diagram of the overall structure of a defect detection model (YOLO-MT) constructed based on the improvement of the YOLO11n basic network model in an embodiment of the present invention;
[0060] Figure 22 is a schematic structural diagram of an edge refinement structure (EdgeRefinement) and a hierarchical edge refinement structure (Her) in an embodiment of the present invention;
[0061] Figure 3 2 is a schematic diagram of the structure of the C3k2_Her module in an embodiment of the present invention;
[0062] Figure 4 2 is a schematic diagram of the structure of a multi-layer feature pyramid (MFP) structure of a neck network according to an embodiment of the present invention;
[0063] Figure 5 2 is a schematic diagram of the structure of the spatial depth convolution module (SPDConv) in an embodiment of the present invention;
[0064] Figure 6 is a schematic structural diagram of the OmniKernel module in an embodiment of the present invention;
[0065] Figure 7 Schematic diagram of the structure of the CSP_OmniKernel module in an embodiment of the present invention;
[0066] Figure 8 Schematic diagram of the structure of the FFCM module in an embodiment of the present invention;
[0067] Figure 9 2 is a schematic diagram of the structure of the C3k2_FFCM module in an embodiment of the present invention;
[0068] Figure 10 is a schematic diagram of a magnetic sheet defect detection image acquisition device used in an embodiment of the present invention;
[0069] Figure 11 Figure 1 shows the test results of different models in the comparative experiment of the embodiment of the present invention on the magnetic disk defect dataset. In the figure, (a) is a DJ defect, (b) is a scrape defect, (c) is a DJ defect, (d) is an XB defect, (e) is a smallbreak defect and a DJ defect, and (f) is a dot defect.
[0070] Figure 12 These are the test results of different models for easily confused magnetic sheet defects in the comparative experiment of the embodiment of the present invention. In the figure, (a) is a smallbreak defect, (b) is a smallbreak defect, and (c) is a DJ defect.
[0071] Figure 13 These are the test results of different models in the comparative experiment in the embodiment of the present invention on the PCB defect dataset. DETAILED DESCRIPTION
[0072] The technical solution of the present invention will be further described in detail below through specific embodiments and in conjunction with the accompanying drawings. It should be understood that the implementation of the present invention is not limited to the following embodiments, and any form of modification and / or change made to the present invention will fall within the scope of protection of the present invention.
[0073] In the present invention, unless otherwise specified, all parts and percentages are by weight. The equipment and raw materials used are commercially available or commonly used in the art. The methods in the following embodiments, unless otherwise specified, are conventional methods in the art. The components or equipment in the following embodiments, unless otherwise specified, are all universal standard parts or components known to those skilled in the art. Their structures and principles are known to those skilled in the art through technical manuals or routine experimental methods.
[0074] The following detailed description of the embodiments of the present invention is made in conjunction with the accompanying drawings. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present invention. However, one or more embodiments may be implemented by those skilled in the art without these specific details.
[0075] An embodiment of the present invention discloses a method for detecting surface defects of magnetic sheets based on an improved target detection model. The core of the method is to construct and use a defect detection model optimized for the defect characteristics of magnetic sheets (referred to as the YOLO-MT model in this embodiment).
[0076] The method comprises the following steps:
[0077] A defect detection model comprising a backbone network, a neck network and a head network is constructed based on the YOLO11n basic network model; wherein the backbone network includes at least one convolution module, at least one C3k2_Her module combining an edge refinement structure and a hierarchical edge refinement structure, a spatial pyramid pooling fast module and a C2PSA module combining a cross-stage local structure and a pyramid squeeze attention mechanism; the neck network is constructed based on a path aggregation feature pyramid network structure and has a multi-layer feature pyramid structure for processing low-level feature maps to fuse them into higher-level feature maps, the multi-layer feature pyramid structure includes a spatial depth convolution module for downsampling low-level feature maps and a CSP_OmniKernel module for feature fusion, and the neck network also includes at least one C3k2_FFCM module combining a cross-stage local structure and a fused Fourier convolution mixer module; the head network includes multiple convolution layers for classifying and regressing feature maps of different scales from the neck network;
[0078] Obtaining images of the magnetic disk surface and forming a magnetic disk surface defect dataset containing various defect types, dividing the dataset into a training set, a validation set, and a test set, and using the training set and the validation set to train the defect detection model;
[0079] Obtaining a surface image of the magnetic sheet to be inspected, and inputting the surface image of the magnetic sheet to be inspected into a trained defect detection model for defect detection;
[0080] Based on the defect detection results of the defect detection model, the surface defect information of the magnetic sheet to be detected is output, and the surface defect information includes the type and location of the defect.
[0081] Reference Figure 1 Based on the improvement of the YOLO11n basic network model, the YOLO-MT defect detection model constructed in this embodiment mainly includes three parts: the backbone network (Backbone), the neck network (Neck) and the head network (Head).
[0082] The backbone network is responsible for extracting multi-layer features from the input disk image. The key improvement lies in replacing the original C3k2 module in the YOLO11n base network model with the C3k2_Her module. The C3k2_Her module internally utilizes a hierarchical edge refinement (Her) module structure and an edge refinement (EdgeRefinement) module structure.
[0083] Reference Figure 2 The EdgeRefinement module first performs an AvgPool2d operation on the input feature map with a pooling window size of 3x3 to obtain a smooth feature map that mainly retains low-frequency information. Then, edge information is obtained by calculating the difference between the input feature map and the pooled feature map, so as to extract high-frequency information (edges and details) from the input features. The obtained edge information is nonlinearly transformed through a convolutional layer to achieve a smooth transition of the edge information and obtain enhanced edge features. Finally, the enhanced edge features are added to the original feature map to obtain the final output feature map containing detail information.
[0084] Set the input feature map to X, and the feature map after pooling operation to X pool , the enhanced edge feature E' can be expressed as shown in formula (1):
[0085] E′=Conv(XX pool )#(1)
[0086] AdaptiveAvgPool2d is a pooling layer that adaptively adjusts the spatial size of the input feature map to the specified output size. It does this by calculating the average value of each pooling area on the input feature map. Unlike fixed-size pooling, AdaptiveAvgPool2d can dynamically adjust the size of the pooling area based on the size of the input. If the size of the input feature map is H×W and the target output size is H out ×W out , then for each element Y of the output feature map ,j , which can be expressed as:
[0087]
[0088] Where N is the number of elements in the pooling region, s H and s W are the strides calculated based on the input and output sizes, respectively, and k represents the element index within the pooling region.
[0089] Continue to refer to Figure 2 , the Her module processes features of different scales through multiple convolutional layers and combines edge information to achieve full fusion of hierarchical features. First, the input feature map is pooled at multiple scales, and the feature map is processed into scales of 3×3, 6×6, 9×9 and 12×12 respectively using AdaptiveAvgPool2d. Each scale corresponds to a feature branch to capture spatial features at different resolutions. This enables the model to always generate feature maps of uniform size when processing images or feature maps of different resolutions. Secondly, for each pooling branch, the channel dimension is reduced by 1×1 convolution, and then 3×3 convolution is used to extract features at a specific scale. This step effectively retains spatial information and local features at different scales; then, the features of each pooling branch use bilinear interpolation to upsample the feature maps of different scales to the size of the original feature map to ensure consistency with the input feature map size, and are edge enhanced by the EdgeRefinement module to further enhance detail features. Finally, the feature maps processed by each branch are concatenated with the original input feature map after one convolution, and fused through the convolution layer to generate the final output feature map.
[0090] Set the feature map after multi-scale pooling and edge enhancement to F' 3×3 , F' 6×6 , F' 9×9 and F' 12×12 , the input feature map is X, and the final output feature map Fout can be expressed as:
[0091] F out =Conv(Concat(Conv(X),F′3×3 ,F′ 6×6 ,F′ 9×9 ,F′ 12×12 ))#(3)
[0092] Reference Figure 3 , the C3k2_Her module divides the input features into two parts. One part is passed directly through convolution (CBS), and the other part is passed through multiple (for example, n) Her modules for deep feature extraction and edge enhancement. After the two parts of the results are spliced, they are fused and output through 1x1 convolution (Conv). This structure can maintain lightweight while effectively extracting deep features. Among them, the newly added EdgeRefinement module significantly improves the ability to capture details and edge features, making the model more accurate when processing complex backgrounds and images with rich details; the Her module can process features of various scales and has stronger adaptability, especially in small target detection. Through multi-level feature splicing and fusion, the feature information of each layer can be more comprehensively utilized to improve the overall detection accuracy.
[0093] The neck network is responsible for fusing the different levels of features output by the backbone network to generate feature maps suitable for detecting objects of different scales. The neck network of this embodiment is improved based on the PAFPN (FPN+PAN) structure.
[0094] Reference Figure 4 , the neck network of this embodiment introduces a multi-layer feature pyramid (MFP) structure to enhance small target detection. The lower-level feature maps obtained from the backbone network are processed by the spatial depth convolution module (SPDConv). The SPDConv module downsamples through the spatial-depth (SPD) transformation to effectively retain the small target information, and then performs feature transformation through a non-stride convolution (Conv). The processed lower-level feature map is concatenated (Concat) with the higher-level feature map. The concatenated features are input to the CSP_OmniKernel module for fusion. This improvement not only improves the detection performance of small targets, but also optimizes computational efficiency and reduces resource consumption.
[0095] Reference Figure 5 The SPDConv module consists of a spatial-depth (SPD) layer and a non-strided convolution (Conv) layer. It can effectively extract features rich in small object information, thereby improving the detection performance of small objects. At the same time, SPDConv improves the efficiency of the model by reducing the number of parameters and the amount of computation, thus achieving higher real-time performance when processing complex scenes. The specific operation process of the SPD layer is shown in Equation (4).
[0096] Setting intermediate features Figure XThe size of is S×S×C1, and SPD splits it into a sequence of sub-feature maps:
[0097] f 0,0 =X[0:S:scale,0:S:scale],f 1,0 =X[1:S:scale,0:S:scale],…,
[0098] f scale-1,0 =X[scale-1:S:scale,0:S:scale];
[0099] f 0,1 =X[0:S:scale,1:S:scale],f 1,1 ,…,
[0100] f scale-1,1 =X[scale-1:S:scale,1:S:scale];
[0101] …
[0102] f 0,scale-1 =X[0:S:scale,scale-1:S:scale],f 1,scale-1 ,…,f scale-1,scale-1 =X[scale-1:S:scale,scale-1:S:scale]; #(4)
[0103] For a given feature map X, the subgraph f x,y It is a feature map composed from all feature map slices, where i+x and i+y are divisible by the scale factor. Therefore, each submap scales the feature map by the scale factor. Figure X Downsampling. When scale=2, Figure 5 Four sub-feature maps f are shown 0,0 , f 1,0 , f 0,1 , f 1,1 , each sub-feature map has a size of (S / 2, S / 2, C1), and the original feature Figure X Downsampled by a factor of 2. These subgraphs are then concatenated along the channel dimension to generate new features. Figure X ', its spatial dimension is reduced by a scaling factor, while the channel dimension is increased by twice the original. Finally, SPD transforms the feature Figure X (S,S,C1) converted to intermediate features Figure X '(S / sacle,S / scale,scale 2 C1).
[0104] After the SPD feature transformation, a non-strided convolution layer is introduced. This layer aims to preserve all discriminative feature information as much as possible. It uses a convolution operation with a C2 filter, with a stride of 1 (i.e., stride = 1), and satisfies C2 <scale 2 C1. Through this process, X'(S / sacle,S / scale,scale 2 C1) is further converted into X”(S / sacle, S / scale, C2).
[0105] Reference Figure 6 The OmniKernel module is a convolutional module designed to simultaneously capture global and local information to enhance feature representation capabilities, which is particularly suitable for complex visual tasks. First, after preliminary feature processing through 1×1 convolution, features are effectively extracted through three branches (Global, Large, and Local). The results of the three branches are then fused by addition and further modulated by another 1×1 convolution. In the Large branch, a cheap depth convolution with a convolution kernel size of 31×31 is applied to pursue a large receptive range. In addition, 1×31 and 31×1 convolution kernels are used to obtain strip-shaped contextual information. The Global branch consists of a dual-domain channelattention module (DCAM) and a frequency-based spatial attention module (FSAM). Given X Global ∈R C×H×W , DCAM first applies frequency channel attentio (FCA) to X Global , as shown in (5):
[0106]
[0107] in and They are fast Fourier transformer and its inverse operation, X FCA , W 1×1 and GAP represent FCA, 1×1 convolutional layer and global average pooling respectively; Represents the element-wise multiplication operation. Through Fourier processing, the global features are effectively refined according to the spectral convolution theorem.
[0108] After global modulation in the spectral domain, the resulting features are further fed into the spatial channel attention module (SCA), as shown in (6):
[0109]
[0110] where X DCAM is the output of DCAM, which only enhances the dual-domain features at the channel coarse granularity.
[0111] Applying a frequency-based attention module in the spatial dimension refines the spectrum at a fine-grained level, formally expressed as (7):
[0112]
[0113] where X FSAM is a result of FSAM, and by doing so, the model can focus on information-rich frequency components to achieve high-quality image reconstruction.
[0114] In addition to the Large and Global branches that capture a large receptive field, the OmniKernel module also designs an extremely simple yet effective Local branch for local signal modulation by using 1×1 depthwise convolutional layers. Combining the advantages of depthwise separable convolutions, the OmniKernel module improves the model's expressiveness while maintaining a low computational footprint.
[0115] Reference Figure 7 ,The CSP_OmniKernel module combines CSP and OmniKernel for feature ,integration.
[0116] In addition, the neck network of this embodiment replaces the original C3k2 module of the neck network of the YOLO11n basic network model with a C3k2_FFCM module.
[0117] Reference Figure 8 , the FFCM module first uses PConv to improve the input features And divide it into two groups to extract multi-scale local features, and finally obtain X spatial As shown in formula (8):
[0118]
[0119] Among them, Conv multi represents different kernel sizes of 3×3 and 5×5 depthwise convolution in the spatial domain. σ is the GeLU activation function.
[0120] In the Frequency-Domain Fusion module, X spatialAfter discrete Fourier transform, it is converted into real and imaginary parts. These serial components are convolved using a 1×1 kernel size. After modulation, the real and imaginary parts are separated, and the frequency domain features are converted back to the spatial domain through inverse discrete Fourier transform, as shown in Equations (9)(10)(11):
[0121]
[0122] Finally, the output of FFCM is obtained by the residual structure and PConv for channel compression:
[0123]
[0124] By combining frequency domain information and spatial domain information, the FFCM module is able to model defect characteristics more comprehensively.
[0125] The FFCM module can identify periodic features in the frequency domain while preserving edge details in the spatial domain, thereby enhancing the recognition of various small targets. This design not only improves training results but also avoids over-smoothing of features, preserving richer defect details, thereby facilitating accurate positioning and classification.
[0126] Reference Figure 9 The C3k2_FFCM module divides the input features into the first part features and the second part features, processes the first part features through a convolution module, processes the second part features through a FFCM module, and then splices the output of the first part features processed with the output of the second part features processed, and finally fuses the spliced features through a 1x1 convolution module and outputs them.
[0127] The neck network implements top-down and bottom-up feature fusion paths through upsampling (Upsample), splicing (Concat), these improved modules (SPDConv, CSP_OmniKernel, C3k2_FFCM) and standard convolution (Conv).
[0128] The head network receives multi-scale feature maps from the neck network and processes the feature maps of each scale through the decoupled detection head (Detect) to predict the category probability and bounding box coordinates of the target (regression).
[0129] In order to verify the effectiveness of the magnetic sheet surface defect detection method based on the improved target detection model, the following experiments were conducted in this embodiment.
[0130] The magnetic disc defect dataset built by the experiment comes from a real industrial site, and the image acquisition device is such as Figure 10As shown in the figure, the magnetic disks were transported to the imaging area via a conveyor belt and captured by high-speed industrial cameras at different angles. Given the high yield rate of the product, defects were manually identified and confirmed by quality inspectors. After cropping, 19,621 images were obtained, which were then classified and annotated using labelimg, resulting in a total of 22,307 labels.
[0131] Due to the varying difficulty of detecting different defects, the number of images corresponding to each defect varies. See Table 1 for details. Specifically, the number of images corresponding to the six defects (Dot, Scrape, DJ, Smallbreak, XB, and LM) is 3697, 1453, 6106, 8935, 1590, and 4344, respectively.
[0132] Table 1 Magnetic disk defect detection dataset
[0133]
[0134] The self-constructed magnetic disk defect dataset for this experiment consists of training, validation, and test sets. Because each image may contain one or more defects, the dataset cannot be strictly divided based on the number of defects in each category. The 19,621 images were divided roughly into training, validation, and test sets at a ratio of 80%, 10%, and 10%, respectively. The results of the category divisions are shown in Table 2.
[0135] Table 2 Dataset training, validation and test set division
[0136]
[0137] The experimental platform was configured as follows: the hardware environment included an AMD Ryzen 55600X 6-core CPU, 32GB of memory, and an RTX 2060 (6GB) GPU. The operating system was Windows 10, and the software versions included PyCharm 2022, PyTorch 1.12.1, Python 3.9, and CUDA 11.1. The network training parameters were set as follows: batch size 8, number of workers 4, SGD optimizer, learning rate 0.01, momentum 0.937, input image size 640×640, and epochs 300.
[0138] To evaluate the performance of the YOLO-MT network, this paper selected several performance evaluation metrics, including mean average precision (mAP), average precision (AP), Giga Floating-point Operations Per Second (GFlops), and Frames Per Second (FPS). AP refers to the area between the PR curve and the coordinate axis, and is used to evaluate the prediction accuracy of each defect, while mAP is the average AP value across all categories. FPS is used to evaluate the model's detection speed; a higher FPS value indicates that the network processes more images per second.
[0139] To analyze the effectiveness of the YOLO-MT network structure and the impact of the C3k2_Her module, MFP structure, and C3k2_FFCM module on network performance, ablation experiments were conducted. Seven different combinations were set up: the original YOLO11n model, the original YOLO11n model improved using the C3k2_Her module, the MFP structure, and the C3k2_FFCM module (the MFP structure processed the P2 layer using SPDConv and WTConv, respectively), and the original model's neck network improved using the MFP structure and C3k2_FFCM module. The detection results of each combination on the magnetic disk defect dataset are shown in Table 3.
[0140] Table 3 Ablation Experiment
[0141]
[0142] As shown in Table 3, YOLO11n achieves a mAP@50 value of 95.9%. After using the C3k2_Her module, the MFP structure (SPDConv), and the C3k2_FFCM module, mAP@50 increases to 96.2%, 96.3%, and 96.5%, respectively, demonstrating that all three improvements significantly enhance model performance. For the MFP structure, using WTConv and SPDConv to process the P2 layer yields mAP@50 values of 95.9% and 96.3%, respectively. Therefore, SPDConv was chosen for the P2 layer, which performed better. When the MFP structure and the C3k2_FFCM module are combined to improve the neck network of the original model, mAP@50 increases to 96.9%, further validating the C3k2_FFCM module's significant contribution to feature fusion. The model achieves the best performance with all three modules, achieving a mAP@50 of 97.2%. Although this combination increases the number of model parameters and GFLOPs, the significant improvements in mAP@50 and mAP@50-95 indicate that the improvement is highly effective in balancing computational complexity and accuracy, demonstrating the superiority of these modules in improving detection accuracy, especially in magnetic disc defect detection.
[0143] This example also conducted a comparative experiment comparing the YOLO-MT network disclosed in this example with common object detection networks in the prior art. Four typical object detection networks and a state-of-the-art defect detection network were selected for comparison: YOLOv9t, YOLOv10n, YOLO11n, RT-DETR-r18, and EC-PFN.
[0144] The comparison results, shown in Table 4, show that YOLO-MT achieves a mAP@50 value of 97.2%, the highest among all models. Although only 0.4% and 0.5% higher than RT-DETR-r18 and EC-PFN, YOLO-MT demonstrates significant advantages in GFlops, FPS, and parameter count, making it more suitable for deployment in real-world industrial environments. While YOLO-MT lags behind other YOLO models in GFlops, FPS, and parameter count, its detection speed fully meets real-time detection requirements.
[0145] Table 4 Detection results of magnetic disc defect dataset on different networks
[0146]
[0147] The test results of each detection network model are as follows Figure 11 As shown in Figure 2, it is clear that the YOLO-MT network performs better than the other three detection networks in detecting common defects.
[0148] During the production process of magnetic disks, defects such as DJ or small break are prone to occur due to factors such as bumps. These two defects are difficult to distinguish with the naked eye, but their treatment methods are different during industrial processing. In order to test the detection effect of the model on more difficult defects, some challenging defect images were selected for testing. The test results are as follows: Figure 12 shown.
[0149] exist Figure 12 In a, YOLOv10n misdetects it as DJ, YOLO11n misses the detection, and only YOLOv9t and YOLO-MT correctly detect the defect. However, the detection accuracy of YOLO-MT is significantly better than that of YOLOv9t. Figure 12 In b, YOLO11n misdetects it as DJ, while YOLO-MT’s detection results are significantly better than the other two networks that correctly detect it. Figure 12 In Figure c, both YOLOv9t and YOLO11n mistakenly detect the target as smallbreak, while YOLOv10n and YOLO-MT detect it correctly, and the latter has higher detection accuracy.
[0150] This example also conducted comparative experiments using the open-source PCB Defect Dataset provided by Yolox. This dataset contains six defect categories: missing_hole, mouse_bite, open_circuit, short, spur, and spurious_copper. Comparative experiments were also conducted using YOLOv9t, YOLOv10n, YOLO11n, and YOLO-MT networks. The experimental results are shown in Table 5.
[0151] Table 5 PCB defect dataset comparison test
[0152]
[0153] As shown in Table 5, YOLO-MT has the highest mAP@50 value of 83.8%, which is 0.9%, 3.0%, and 2.5% higher than YOLOv9t, YOLOv10n, and YOLO11n respectively. Some of the test results of the four models are shown in the figure. Figure 13 shown.
[0154] Experimental results show that the YOLO-MT model significantly outperforms other models in defect detection tasks, performing well not only in magnetic disk defect detection but also in other defect detection tasks. This further validates the universality and robustness of the YOLO-MT model.
[0155] In summary, the present embodiment discloses a magnetic disk surface defect detection method based on an improved target detection model. The model is designed based on the actual characteristics of magnetic disk defects, and its effectiveness is verified on actual data sets. The detection accuracy is improved, and it has good industrial application value.
[0156] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only intended to help understand the method and core concept of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from the principles of the present invention, and such improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A magnetic sheet surface defect detection method based on an improved target detection model, characterized in that: The method comprises the following steps: A defect detection model comprising a backbone network, a neck network and a head network is constructed based on the YOLO11n basic network model; wherein the backbone network includes at least one convolution module, at least one C3k2_Her module combining an edge refinement structure and a hierarchical edge refinement structure, a spatial pyramid pooling fast module and a C2PSA module combining a cross-stage local structure and a pyramid squeeze attention mechanism; the neck network is constructed based on a path aggregation feature pyramid network structure and has a multi-layer feature pyramid structure for processing low-level feature maps to fuse them into higher-level feature maps, the multi-layer feature pyramid structure includes a spatial depth convolution module for downsampling low-level feature maps and a CSP_OmniKernel module for feature fusion, the neck network also includes at least one C3k2_FFCM module combining a cross-stage local structure and a fused Fourier convolution mixer module; the head network includes multiple convolution layers for classifying and regressing feature maps of different scales from the neck network; Acquire a surface image of a magnetic sheet and form a magnetic sheet surface defect dataset containing multiple defect types, divide the dataset into a training set, a validation set, and a test set, and use the training set and the validation set to train the defect detection model; Acquire a surface image of the magnetic sheet to be inspected, and input the surface image of the magnetic sheet to be inspected into the trained defect detection model for defect detection; Based on the defect detection result of the defect detection model, surface defect information of the magnetic sheet to be detected is output, where the surface defect information includes the type and position of the defect.
2. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 1, characterized in that: The construction steps of the C3k2_Her module include: Split the input features into the first part of features and the second part of features; Processing the first portion of features through a convolutional module; Processing the second portion of features through at least one Her module; splicing the output after the first part of feature processing and the output after the second part of feature processing; The concatenated features are fused through a 1x1 convolution module and then output.
3. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 2, characterized in that: The steps for building the Her module include: Perform multi-scale adaptive average pooling on the input features to generate multiple pooled features of different scales; The pooled features of each scale are respectively subjected to channel dimensionality reduction through a 1x1 convolution module, and then feature extraction through a 3x3 convolution module; The features extracted at each scale are upsampled to the size of the original input features and are respectively subjected to edge enhancement processing through an edge refinement module; All edge-enhanced features are concatenated with the original input features processed by a convolution module; The spliced features are fused through a convolution module and then output.
4. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 3, wherein: The steps of constructing the edge refinement module include: Perform average pooling operation on the input features to obtain a smooth feature map; Calculating the difference between the input feature and the smoothed feature map to obtain edge information features; The edge information features are subjected to nonlinear transformation through a convolution module to obtain enhanced edge features; The enhanced edge features are added to the input features element by element and then output.
5. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 1, wherein: The steps of constructing the multi-layer feature pyramid structure include: Obtaining a lower-layer feature map and a higher-layer feature map from the backbone network; Downsampling the lower layer feature map using the spatial depth convolution module; Concatenate the downsampled lower-level feature map with the higher-level feature map; The CSP_OmniKernel module is used to fuse the spliced features.
6. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 5, characterized in that: The steps of constructing the spatial depth convolution module include: Applying a spatial depth layer to downsample the input feature map, wherein the spatial depth layer converts the spatial dimension information to the channel dimension; Apply the non-strided convolution layer to perform convolution operation on the feature map processed by the spatial depth layer and output it.
7. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 5, characterized in that: The construction steps of the CSP_OmniKernel module include: Split the input features into the first part and the second part; Processing the first portion of features through a convolutional module; Processing the second part of features sequentially through a convolution module and an OmniKernel module; splicing the output after the first part of processing with the output after the second part of processing; The spliced features are fused through a convolution module and then output; The OmniKernel module includes a global branch for capturing global information, a large branch for capturing large receptive field features, and a local branch for local signal modulation.
8. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 1, characterized in that: The construction steps of the C3k2_FFCM module include: Split the input features into the first part of features and the second part of features; Processing the first portion of features through a convolutional module; processing the second portion of features through at least one FFCM module; splicing the output after the first part of feature processing and the output after the second part of feature processing; The concatenated features are fused through a 1x1 convolution module and then output.
9. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 8, characterized in that: The steps for constructing the FFCM module include: The first convolution module is used to process the input features and divide the input features into two groups. Multi-scale local features are extracted through spatial domain deep convolution with different convolution kernel sizes, and the second convolution module is used to fuse the spatial domain features. Applying a frequency domain fusion module to process the spatial domain features to obtain frequency domain enhanced features, the frequency domain fusion module including discrete Fourier transform, convolution processing of the real part and the imaginary part, and inverse discrete Fourier transform; Adding the spatial domain features and the frequency domain enhanced features element by element; The third convolution module is used to compress the channels of the added features and then output them.
10. The method for detecting surface defects of magnetic sheets based on an improved target detection model according to claim 1, characterized in that: When the defect detection model is trained using the training set and the validation set, the network training parameters are set as follows: batch size is 8, the number of data loading processes is 4, the optimizer is stochastic gradient descent, the learning rate is 0.01, the momentum is 0.937, and the number of training rounds is 300.
Citation Information
Cited By
PCB defect detection method based on multi-branch feature extraction and adaptive enhancement strategy
CN121010597A
PCB defect detection method based on multi-branch feature extraction and adaptive enhancement strategy
CN121010597B
Forge piece surface defect detection method based on YOLO model
CN121481935A
Silicon carbide wafer surface defect intelligent detection method
CN122265789A
Intelligent detection method for surface defects of silicon carbide wafer
CN122265789B