Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

30 April 2026

29 Pages

FMSD-YOLO12: An Efficient and Lightweight Network for Surface Defect Detection of Ferrite Permanent Magnets

,
,
and
1
School of Information Science & Engineering, Zhejiang Sci-Tech University, Hangzhou 310018, China
2
Changshan Research Institute Co., Ltd. of Zhejiang Sci-Tech University, Quzhou 324299, China
*
Author to whom correspondence should be addressed.
This article belongs to the Section Artificial Intelligence

Abstract

To address micro-break and edge-chipping defects in ferrite magnetic sheets, as well as the difficulty of balancing detection accuracy and deployment cost under complex grinding-texture interference, this paper proposes FMSD-YOLO12, an efficient and lightweight defect detection model based on YOLOv12. The proposed method follows a task-oriented design for three coupled challenges in ferrite magnetic sheet inspection, namely texture-interfered feature extraction, cross-scale feature inconsistency, and lightweight yet accurate defect localization. Specifically, a Spatially Re-weighted Convolution (SR-Conv) is introduced into the C3k2 backbone module to suppress repetitive grinding-texture noise and enhance the response contrast of subtle defect regions. A Context and Spatial Feature Calibration Network (CSFCN) is further developed to improve semantic consistency and spatial alignment during multi-scale feature fusion. In addition, a Lightweight Shared Detail-Enhanced Convolutional Detection head (LSDECD) is designed to strengthen weak-edge localization while reducing parameter redundancy through re-parameterization. Experimental results show that, with a comparable number of parameters, FMSD-YOLO12 improves mAP@50 by 2.40%, mAP@75 by 3.71%, and mAP@50-95 by 3.03% on the magnetic sheet defect dataset. These results demonstrate that the proposed model achieves a favorable balance between detection accuracy and computational efficiency for irregular defect detection under complex industrial backgrounds.

1. Introduction

Ferrite permanent magnet materials are widely used in critical fields such as electronic communication, automotive manufacturing, aerospace, and specialized micro-motors due to their high coercivity, strong corrosion resistance, and cost-effectiveness [1,2]. However, during complex manufacturing processes such as pressing, sintering, and grinding, surface defects—including micro-breaks, edge wear, dots, and edge chipping—are inevitably introduced due to process variations and environmental factors. These defects not only affect surface quality but may also degrade magnetic field uniformity and mechanical strength, thereby influencing the stability of downstream precision systems. Traditionally, surface quality inspection of magnetic sheets has relied on manual visual inspection. However, with the rapid growth in demand driven by the expansion of the new energy vehicle industry, along with increased production scale and speed, manual inspection has become less practical. In particular, strong interference from grinding textures leads to high labor intensity, low efficiency, and a high risk of missed detections, making it difficult to meet the requirements of modern industrial automation.
To address these limitations, extensive efforts have been made in automated defect detection. Early approaches mainly relied on traditional non-destructive testing techniques, such as eddy current testing [3], laser ultrasonic inspection [4], and magnetic particle testing [5]. These methods leverage electromagnetic or acoustic responses of materials and can achieve reliable detection under specific conditions. However, they often require strict inspection setups, incur high system costs, and lack the ability to precisely localize defects on complex surfaces. Subsequently, conventional machine vision-based methods [6], including edge detection (e.g., Sobel), threshold segmentation, and template matching, have been widely studied. Although effective under controlled conditions, these methods often exhibit limited robustness and generalization when dealing with reflective surfaces, complex textures, and large variations in defect scale, such as the coexistence of micrometer-level breaks and centimeter-level edge chipping.
In recent years, deep learning has achieved remarkable success in industrial inspection, anomaly detection, and fault diagnosis. To address critical challenges such as domain shifts, complex feature variations, and data scarcity, a variety of advanced frameworks have been actively explored. For instance, conditional distribution-guided adversarial transfer learning networks have been developed to effectively align multi-source domains and reduce distribution discrepancies [7], while spatial-channel collaborative multi-scale graph interaction deep transfer learning frameworks enhance transferable representations by jointly modeling spatial relationships, channel dependencies, and multi-scale interactions [8]. Additionally, adaptive fused domain-cycling variational generative adversarial networks have shown strong potential for mitigating data scarcity and enhancing robustness under limited sample availability [9].
However, for real-time visual surface defect detection tasks, the direct applicability of the aforementioned methods may still be limited. This is because they primarily focus on cross-domain adaptation and often involve relatively complex training procedures and considerable computational overhead, whereas practical surface inspection systems usually impose strict efficiency constraints. For such tasks, researchers have increasingly turned to dedicated object detection frameworks. Transformer-based methods, such as Real-Time Detection Transformer (RT-DETR) [10], leverage global context modeling to reduce false detections in complex backgrounds, yet their computational cost and model size often restrict deployment on edge devices. In contrast, one-stage detectors represented by the You Only Look Once (YOLO) series [11] utilize convolutional neural networks (CNNs) for hierarchical feature learning and achieve a favorable balance between detection accuracy and inference speed, making them highly suitable for real-time industrial vision applications [12]. Representative recent advances in this line, such as the NMS-free YOLOv10 [13], have further pushed the boundaries of real-time end-to-end detection by minimizing inference latency.
In the recently proposed YOLOv12 [14], Flash Attention and improved compound scaling strategies further enhance feature representation capability. Nevertheless, ferrite magnetic sheet inspection remains challenging due to low image contrast, repetitive grinding-induced textures, and large defect scale variation. Although existing YOLO-based defect detection methods have improved performance through attention enhancement, feature fusion redesign, or lightweight modifications, most of them do not explicitly address these coupled challenges in a unified manner. In addition, some lightweight industrial detection networks achieve lower computational cost at the expense of weakened feature representation and less accurate localization for subtle or irregular defects. Therefore, a more task-oriented design is still needed to achieve a practical balance between detection accuracy and deployment efficiency in this scenario. To this end, we propose FMSD-YOLO12, an improved detection model for ferrite magnetic sheet surface defects. The proposed method is designed to enhance defect representation under texture interference while maintaining a lightweight architecture for industrial deployment. Its accuracy–efficiency trade-off is further evaluated against both mainstream and lightweight baseline models in Section 4. The main contributions of this work are summarized as follows:
(1)
Structured enhancement of feature extraction. For texture-interfered industrial inspection, a task-oriented shallow feature enhancement module is introduced. Unlike conventional convolution or generic attention-based enhancement used in existing YOLO-based detectors, the proposed SR-C3k2 incorporates a spatially re-weighted convolution with a center-biased prior to suppress repetitive grinding-texture noise at the early feature extraction stage, thereby improving the signal-to-noise ratio of subtle low-contrast defects.
(2)
Efficient cross-scale feature fusion and alignment. For cross-scale defect representation, a context and spatial feature calibration strategy is designed. Different from standard feature pyramid fusion or direct concatenation methods, the proposed CSFCN jointly models contextual semantic refinement and spatial alignment, which improves the consistency between high-level semantics and shallow geometric details for irregular defects with large scale variation.
(3)
Lightweight re-parameterized detection head. For real-time industrial deployment, a lightweight yet edge-sensitive detection head is developed. Compared with conventional decoupled heads or purely lightweight replacements, the proposed LSDECD combines cross-scale parameter sharing and re-parameterized detail-enhanced convolution, reducing parameter redundancy while strengthening the localization of weak and blurry defect boundaries.
The remainder of this paper is organized as follows. Section 2 reviews related work in object detection and industrial surface defect inspection. Section 3 presents the proposed FMSD-YOLO12 architecture and its key components. Section 4 reports experimental results and ablation studies. Finally, Section 5 concludes the paper and discusses future work.

3. Proposed Methodology

3.1. Base Model: YOLOv12

YOLOv12n is a lightweight variant of the YOLOv12 family, designed to balance detection accuracy and inference speed, making it suitable for real-time industrial defect detection tasks. The network consists of three main components: a backbone, a neck, and a detection head, as illustrated in Figure 1.
Figure 1. Architecture of the YOLOv12n model.
The backbone is responsible for extracting multi-scale features. To accommodate different feature hierarchies, a hybrid module design is adopted. In the shallow layers (P2, P3), a C3k2 module (C3k = False) composed of stacked Bottleneck blocks is employed, which focuses on capturing high-resolution details such as grinding textures and micro-breaks on the magnetic sheet surface. In the deeper layers (P4, P5), an A2C2f module (A2 = True) based on the R-ELAN architecture is introduced. This module removes the branch-splitting structure in the original ELAN design and instead adopts a chained stacking strategy with learnable residual connections. In addition, an embedded Area-Attention Block (ABlock) enables the modeling of long-range dependencies, which improves the representation of large-scale defects such as edge chipping.
The neck follows the Path Aggregation Network (PANet) architecture, where both top-down and bottom-up pathways are used to facilitate feature fusion across different scales. At this stage, the A2C2f module is configured in a pure convolutional mode (A2 = False), simplifying into a C3k-like stacked structure. This design maintains efficient multi-scale feature aggregation while avoiding the additional computational cost introduced by attention mechanisms, which is important for low-latency industrial applications. The detection head adopts an anchor-free decoupled design. For feature maps at three scales (P3, P4, P5), the classification and regression tasks are handled by separate convolutional branches. The classification branch employs Depthwise Separable Convolution (DSConv) to reduce computational overhead, while the regression branch retains standard convolution to preserve localization accuracy. During training, Distribution Focal Loss (DFL) and Binary Cross-Entropy (BCE) loss are jointly used for optimization.
Overall, benefiting from the R-ELAN architecture and the incorporation of area attention mechanisms, YOLOv12n demonstrates solid real-time performance and feature representation capability in general industrial detection tasks. However, for ferrite magnetic sheet surface defect detection, there remains room for improvement. In particular, challenges persist in suppressing high-frequency noise under strong grinding texture interference (affecting low-contrast defect recognition) and in addressing spatial misalignment of irregular defects (e.g., edge chipping and micro-breaks) during cross-scale feature fusion. To address these limitations, an improved model, FMSD-YOLO12, is proposed in this work.

3.2. Proposed Model: FMSD-YOLO12

In this work, an improved model, FMSD-YOLO12, is proposed for surface defect detection of industrial ferrite magnetic sheets. Owing to the dark-gray appearance of magnetic sheets, low image contrast and strong grinding-texture interference often degrade the representation of subtle defects. Meanwhile, large defect scale variation further increases the difficulty of effective feature extraction and localization. Motivated by these challenges, we reconstruct the baseline YOLOv12 framework and develop FMSD-YOLO12, whose overall structure is presented in Figure 2.
Figure 2. Architecture of the FMSD-YOLO12 model.
Rather than introducing isolated architectural modifications, FMSD-YOLO12 adopts a coordinated three-part design for texture suppression, cross-scale feature calibration, and lightweight edge-aware prediction. Specifically, a Spatially Re-weighted C3k2 module (SR-C3k2) is introduced into the shallow backbone to suppress high-frequency grinding-texture noise, a Context and Spatial Feature Calibration Network (CSFCN) is deployed in the neck to alleviate semantic inconsistency and spatial misalignment during feature fusion, and a Lightweight Shared Detail-Enhanced Convolutional Detection head (LSDECD) is designed to improve weak-edge localization while reducing parameter redundancy.

3.3. Spatial Re-Weighting Module: SR-C3k2

During the manufacturing process of ferrite magnetic sheets, dense high-frequency grinding textures are inevitably introduced on the surface. When detecting low-contrast defects (e.g., micro-breaks), the translation invariance and uniform weighting mechanism of standard convolution tend to cause the feature extraction process to be dominated by surrounding background noise. To address this issue, a Spatial Re-weighting module, termed SR-C3k2, is proposed to improve the feature signal-to-noise ratio at the early stage of feature extraction.

3.3.1. Density-Guided Spatially Re-Weighted Convolution

Inspired by recent studies on optimal weighted convolution in learning models [45,46], the proposed method enhances standard convolution by introducing a Spatial Density Prior to regulate the contribution of neighboring pixels to the central pixel. Based on this concept, a Spatially Re-weighted Convolution (SR-Conv) operator is designed. As illustrated in Figure 3, the SR-Conv operation consists of three stages: Spatial Prior Generation, Weights Re-weighting, and Feature Application.
Figure 3. Operational mechanism of the SR-Conv operator. It incorporates a spatial density prior to re-weight learnable filters, acting as a soft-attention mechanism to suppress background noise and enhance defect features. (Note: The ⊗  denotes the outer product, ⊙ denotes element-wise multiplication and ⊛ denotes the convolution operation).
The key difference between SR-Conv and standard convolution lies in the explicit incorporation of a spatial prior constraint into the convolution kernel. Given a standard learnable convolution kernel W ∈ ℝ C o u t × C i n × k × k , a spatial prior mask Φ ∈ ℝ k × k is constructed based on a distance-decay principle. For the 3 × 3 case used in this work, the density distribution is controlled by a decay coefficient d e n   d e n   <   1.0 . A one-dimensional density vector is first defined as α = d e n , 1.0 , d e n , and a two-dimensional symmetric spatial prior matrix Φ is obtained via the outer product of α with itself (denoted as α α T ):
Φ = α α T = d e n 2 d e n d e n 2 d e n 1.0 d e n d e n 2 d e n d e n 2
This formulation yields a symmetric and separable center-biased prior, where the central position is preserved and peripheral responses are progressively attenuated. During forward propagation, the original convolution kernel W is modulated by Φ through element-wise multiplication, yielding a re-weighted kernel W Φ :
W Φ ( i , j ) = W ( i , j ) • Φ ( i , j )
where i ,   j denotes the spatial position within the kernel. This operation introduces a center-biased inductive prior without adding extra learnable parameters.
After obtaining the equivalent convolution kernel, the feature extraction process can then be formulated as:
Y = W Φ ⊛ X + B
where ⊛ denotes the discrete convolution operation, X and Y represent the input and output feature maps, respectively, and B is the bias term.
From a signal processing perspective, the proposed prior matrix can be interpreted as a center-weighted spatial window applied to the convolution kernel. Such a windowing operation reduces the contribution of peripheral positions in the receptive field and introduces a task-oriented low-pass bias, which is beneficial for suppressing repetitive high-frequency grinding textures. Meanwhile, the center-preserving structure helps retain locally coherent weak defect responses, thereby improving the local signal-to-noise ratio during early feature extraction.
From a Bayesian viewpoint, Φ can be interpreted as a location-dependent prior on the effective convolution weights, where positions closer to the kernel center are assigned higher prior importance and peripheral positions are down-weighted due to their greater uncertainty and higher susceptibility to background interference. Under this interpretation, SR-Conv combines learnable convolution weights with lightweight spatial regularization through W Φ ( i , j ) = W ( i , j ) • Φ ( i , j ) , yielding an interpretable center-biased inductive bias without introducing additional learnable parameters. From a functional perspective (Figure 3, bottom), the resulting re-weighted kernel acts as a lightweight soft-attention mechanism that suppresses peripheral high-frequency activations while preserving defect-related central responses.

3.3.2. Architecture and Application of SR-C3k2

To integrate the advantages of SR-Conv into the detection framework, the original C3k2 module in YOLOv12 is restructured to form the SR-C3k2 module.
Figure 4 presents the structure of SR-C3k2. This module preserves the efficient feature reuse mechanism of the CSP framework, while replacing the standard 3 × 3 convolutions in the Bottleneck with SR-Conv operators to improve robustness against texture interference. In the forward process, a 1 × 1 convolution is first used to compress the input channels, after which the feature representation is divided into two paths. The shortcut path retains the original information, whereas the refinement path is processed by n stacked SR-Bottleneck blocks. Finally, the features from the two paths are merged along the channel axis to obtain the output representation.
Figure 4. Architecture of the SR-C3k2 module. (Note: ⊕ denotes feature addition).
Within the FMSD-YOLO12 framework (Figure 2), SR-C3k2 is primarily deployed in the shallow stages of the backbone (P3 and P4). These layers possess high spatial resolution and are responsible for extracting low-level features such as edges and contours, but they are also more susceptible to interference from high-frequency grinding textures. Through the introduction of SR-C3k2 at this stage, early feature representations can be moderated through spatial re-weighting. As features propagate through stacked SR-Bottlenecks, the built-in SR-Conv continuously suppresses high-frequency activation responses along edges using its static density mask Φ . Through multiple stacked processing steps, repetitive texture patterns are gradually suppressed, while defect-related structures are retained. This design provides cleaner feature inputs for subsequent modules (e.g., A2C2f and CSFCN), reducing the risk of noise accumulation across layers, while maintaining computational efficiency during inference.

3.4. Context and Spatial Feature Calibration Network: CSFCN

In ferrite magnetic sheet defect detection, defect scales vary significantly, ranging from micro-breaks occupying only a few pixels to large-area edge chipping. Shallow features preserve fine structures but are susceptible to background textures, whereas deep features contain richer semantics but often lose spatial precision. Conventional feature pyramid networks typically rely on bilinear upsampling and channel concatenation for multi-scale feature fusion. However, such rigid fusion strategies neglect both the semantic inconsistency between low-level and high-level features and the spatial displacement introduced during cross-scale aggregation, which may degrade the localization accuracy of irregular defect boundaries. To address this issue, a Context and Spatial Feature Calibration Network (CSFCN) is introduced, as illustrated in Figure 5. CSFCN consists of two complementary components: Context Feature Calibration (CFC), which refines contextual semantics and suppresses background interference, and Spatial Feature Calibration (SFC), which aligns semantic features with shallow geometric details. Through this two-stage design, CSFCN improves semantic consistency and spatial alignment during multi-scale feature fusion. The individual effects of CFC and SFC are further verified in Section 4.4.
Figure 5. Detailed architecture of the proposed CSFCN. (a) The CFC filters out grinding noise and extracts refined global context. (b) The SFC dynamically aligns high-level semantic and current structural features via semantic flow-driven grid resampling.

3.4.1. Context Feature Calibration: CFC

Deep features (e.g., from the P5 level) possess large receptive fields and rich semantic information. However, they are also prone to interference from large-scale high-frequency grinding textures (as shown in Figure 5a), which may lead to pixel–context inconsistencies. Directly fusing such features can propagate and amplify noise.
To mitigate this issue, the CFC module is designed to extract refined global contextual representations. Given an input feature X ∈ R C × H × W , a reduced feature X red is first obtained via a 1 × 1 convolution. The feature is then projected into a dense query matrix Q , while a Pyramid Scene Parsing (PSP) module is employed to aggregate contextual information at multiple spatial scales S ∈ 1 × 1 , 2 × 2 , 3 × 3 , 6 × 6 . Based on this, the key matrix K and value matrix V that encapsulate the background prior are constructed as:
Q = θ q ( X r e d ) ∈ ℝ N × d k K = θ k ( P S P ( X r e d ) ) ∈ ℝ S × d k V = θ v ( P S P ( X r e d ) ) ∈ ℝ S × d v
where θ q , θ k , θ v denote 1 × 1 convolutional projections, N = H × W denotes the flattened pixels, and S represents the pooled sequence length. Next, a global attention map is computed by the inner product of the matrices Q and K :
A = Softmax Q K T ∈ ℝ N × S
Then, the global attention map is aggregated with the value matrix V , and the result is reshaped to obtain the global context features:
C global = A V ∈ ℝ C ′ × H × W
To further refine the contextual representation, a local attention mechanism is introduced. A spatial mask M is generated using the Tanh activation function and applied to re-weight the contextual feature. The calibrated output Y CFC is then obtained via a residual formulation:
Y CFC = X red + C global ⊙ M + C global
After calibration, the output feature suppresses irrelevant background responses while preserving semantically meaningful regions (as shown in Figure 5a), providing more reliable guidance for subsequent feature fusion.

3.4.2. Spatial Feature Calibration: SFC

After obtaining the calibrated deep feature Y CFC , it needs to be fused with a shallow feature (e.g., from the P3 level, denoted as X c p ). Shallow features contain precise geometric structures but limited semantic information (the cyan diagonal breaks in Figure 5b), whereas deep features provide coarse semantic localization (the blue halos in Figure 5b). Direct concatenation may therefore result in spatial inconsistency between semantic responses and structural details.
To address this issue, the SFC module explicitly models inter-layer semantic flow instead of relying on rigid fusion. First, the upsampled deep feature X s p is concatenated with the shallow features X c p and passed through an offset prediction layer to estimate spatial offset fields Δ p c p , Δ p s p ∈ ℝ 2 × H × W and fusion weights W a t t :
[ Δ p c p , Δ p s p , W a t t ] = C o n v 3 × 3 C o n c a t X c p , X s p
Next, grid sampling ( G ) is applied to perform deformable alignment:
X ˜ c p ( p ) = G X c p , p + Δ p c p , X ˜ s p ( p ) = G X s p , p + Δ p s p
where p denotes spatial coordinates. This operation enables semantic responses from deep features to be adaptively aligned with structural details in shallow features.
Finally, the gated mask activated by Tanh adaptively fuses the aligned dual-layer features:
Y S F C = X ˜ s p ⊙ 1 + T a n h W a t t s p + X ˜ c p ⊙ 1 + T a n h W a t t c p
After spatial calibration, the deep semantic highlights closely align with the shallow geometric breaks (as shown by the blue Aligned Feature region on the far left of Figure 5b). This demonstrates that the SFC mechanism can eliminate spatial misalignment issues in multi-scale fusion, significantly improving the model’s accuracy in boundary regression for irregular and faint defects.

3.5. Lightweight Shared Detail-Enhanced Convolutional Detection Head: LSDECD

In the original YOLO architecture, the detection head typically allocates independent convolutional branches for feature maps at different scales (P3, P4, and P5). Although straightforward, this design introduces significant parameter redundancy in deep networks. Moreover, standard 3 × 3 convolutions tend to smooth local features, making it difficult to capture the high-frequency gradient variations associated with subtle defects such as micro-breaks and edge chipping, which may lead to missed detections. To enhance the perception of weak defect boundaries while maintaining a lightweight design, a Lightweight Shared Detail-Enhanced Convolutional Detection (LSDECD) head is proposed.

3.5.1. Cross-Scale Parameter Sharing and Adaptive Calibration

Inspired by the cross-scale consistency design in RetinaNet, we abandon the redundant structure of multi-branch independent designs and adopt a weight-sharing strategy. Specifically, the P3, P4, and P5 features from the CSFCN are first reduced to 256 channels and then fed into a fully shared feature extraction network. This design leverages the self-similarity of physical defects across different scales, significantly reducing parameter redundancy while improving generalization to multi-scale targets. To address the normalization inconsistency caused by parameter sharing, Group Normalization (GN) is adopted instead of Batch Normalization (BN), a strategy that has been widely validated in recent advanced defect detectors [47]. Since GN is independent of batch size, it provides more stable performance in cross-scale shared architectures. Furthermore, to compensate for the distribution differences in regression magnitudes across scales, a learnable scaling factor (Scale) is introduced after the shared regression branch. This enables adaptive calibration of bounding box predictions at different feature levels.

3.5.2. Re-Parameterized Detail-Enhanced Convolution: DEConv

To better capture the subtle gradient variations at defect boundaries, a Detail-Enhanced Convolution (DEConv) module is incorporated into the detection head. Following the recent work of Chen et al. [48] on detail-enhanced feature modeling, we utilize structural re-parameterization to construct a dynamic architecture featuring “multi-branch training and single-branch inference”.
As illustrated in Figure 6, during training, DEConv consists of five parallel branches to explicitly capture edge information from different orientations: the standard convolution branch (Vanilla Conv) for basic low-frequency feature extraction, with weights W vanilla ; the Central Difference Convolution (CDC) branch for capturing isolated intensity variations, with equivalent weights W cd ; the Horizontal Difference Convolution (HDC) branch for vertical edge detection, with weights W hd ; the Vertical Difference Convolution (VDC) branch for horizontal edge detection, with weights W vd ; and the Angular Difference Convolution (ADC) branch for diagonal edge modeling, with weights W ad . Given an input feature map X , the training-time output is formulated as:
Y t r a i n = ∑ k ∈ { v a n i l l a , c d , h d , v d , a d } W k ⊛ X + B k
where each branch explicitly models gradient differences between the central pixel and its neighbors, encouraging the network to learn high-frequency edge information and enhancing sensitivity to weak defect contours.
Figure 6. The structural re-parameterization mechanism of DEConv. During training, it employs five parallel branches including central, horizontal, vertical, and angular difference convolutions to capture high-frequency edge gradients. During deployment, it is fused into a single standard convolution without introducing additional inference cost.
Due to the linearity of convolution operations, all parallel branches can be equivalently merged into a single 3 × 3 convolution during inference, where W eq = ∑ k W k , B eq = ∑ k B k . Finally, the forward propagation during deployment is simplified to:
Y deploy = W eq ⊛ X + B eq
This re-parameterization strategy eliminates the computational overhead of differential branches during deployment, achieving improved edge representation capability without introducing additional inference latency. As a result, the model reduces missed detections caused by blurred or weak defect boundaries while preserving deployment efficiency.

4. Experiments and Analysis

4.1. Experimental Dataset

The experimental dataset was constructed from a real industrial production environment. As illustrated in Figure 7, ferrite magnetic sheets were transported into the imaging area by a conveyor-belt inspection system and captured by high-speed industrial cameras from multiple viewing angles. The imaging setup was relatively fixed, including the camera position, light source, and conveyor path, so that the acquired images could stably reflect practical industrial inspection conditions. However, due to the intrinsic dark-gray appearance of ferrite magnetic sheets and the repetitive grinding textures on their surfaces, the collected images still exhibited low contrast, strong texture interference, and slight appearance variations across samples.
Figure 7. Industrial image acquisition system for ferrite magnets.
Since ferrite magnetic sheets have a relatively high production yield, defective samples are scarce in practice. Therefore, defect samples were manually screened and confirmed by quality inspection personnel before being included in the dataset. After screening, a total of 3592 images were obtained. The dataset was annotated using the LabelImg tool and saved in TXT format, and all labeled defect regions were manually checked to ensure category consistency and bounding-box quality. The dataset was finally divided into training, validation, and test sets at a ratio of 8:1:1.
The dataset contains five defect categories: Dot, DJ, Smallbreak, LM, and XB. Figure 8a–d shows representative annotated samples, and Figure 9 presents the instance distribution of each category. The numbers of instances for Dot, DJ, Smallbreak, LM, and XB are 537, 805, 960, 798, and 816, respectively, indicating a noticeable class imbalance caused by the natural occurrence frequency of different defects. Moreover, the dataset remains challenging. For example, Smallbreak often exhibits large scale variation and irregular defect boundaries, while XB is characterized by subtle low-contrast appearance and strong background interference from grinding textures.
Figure 8. Production anomaly data and annotations.
Figure 9. Distribution of defect instances in the custom ferrite magnet dataset.

4.2. Experimental Environment

The experiments were conducted on the Ubuntu 22.04 operating system with the PyTorch 2.3.0 deep learning framework. Detailed information about the experimental environment is provided in Table 1, while the training parameters are listed in Table 2. In addition to these settings, all compared models were trained and evaluated under the same protocol to ensure a fair comparison.
Table 1. Experimental Environment Configuration.
Table 2. Training hyperparameters and implementation settings.
During training, standard data augmentation in the Ultralytics YOLO pipeline was adopted, including HSV color augmentation, random translation, random scaling, horizontal flipping, and Mosaic augmentation. In this study, Mosaic was enabled throughout the whole training process, whereas MixUp, copy–paste, rotation, shear, perspective transformation, and vertical flipping were disabled.
For model selection, the best-performing checkpoint on the validation set was used for final testing. During inference, all models were evaluated on the test set with an input size of 640 × 640 and a batch size of 16, without test-time augmentation. Non-maximum suppression was applied with an IoU threshold of 0.7 to remove redundant predictions.

4.3. Evaluation Metrics

This study adopts Precision, Recall, F1-Score, mAP@50, and mAP@50-95 as evaluation metrics to assess detection accuracy. To further assess model efficiency, GFLOPs, parameter count, and inference speed (FPS) were also reported. The corresponding calculation formulas for these metrics are provided in Equations (13)–(17).
P = T P T P + F P
R = T P T P + F N
F 1 - S c o r e = 2 T P 2 T P + F P + F N
A P = ∫ r = 0 1 P ( r ) d r
m A P = ∑ i = 1 n A P i n
In these equations, TP, FP, and FN refer to true positives, false positives, and false negatives, respectively. Precision measures the correctness of predicted defect instances, whereas Recall reflects the ability of the model to detect actual defects. The reported F1-Score is averaged over defect categories, reflecting the model’s overall balance between prediction accuracy and defect coverage. AP represents the detection accuracy of each individual category, and mAP is obtained by averaging AP over all defect classes to characterize the overall multi-class detection performance. The FPS reported in this paper denotes inference-only speed, excluding preprocessing and postprocessing.

4.4. Ablation Experiments

To examine the effectiveness of the proposed components in ferrite magnetic sheet defect detection, a series of ablation studies were carried out on the custom dataset. All experiments were performed under identical hyperparameter settings, with YOLOv12n adopted as the baseline model. The quantitative comparisons of the three main modules and the internal sub-components of CSFCN are summarized in Table 3 and Table 4, respectively.
Table 3. Ablation experiments on FMSD-YOLO12.
Table 4. Further ablation on the sub-components of CSFCN.
As shown in Table 3, the three proposed modules improve the detector from different aspects. When SR-C3k2 is introduced alone, mAP@75 increases from 76.1% to 78.2%, indicating that the spatially re-weighted convolution can suppress repetitive grinding-texture interference at the shallow stage and improve the localization of subtle defects under a stricter IoU criterion. When CSFCN is added alone, mAP@50 increases from 84.0% to 85.5%, suggesting that the joint modeling of contextual refinement and spatial calibration enhances cross-scale feature consistency, which is particularly beneficial for defects with irregular shapes and large scale variation. The respective contributions of its two sub-components, CFC and SFC, are further analyzed in Table 4. When LSDECD is used alone, the parameter count decreases from 2.5 M to 2.2 M while mAP@75 improves from 76.1% to 77.6%. This shows that the proposed detection head reduces parameter redundancy while improving high-IoU localization by enhancing sensitivity to weak edge gradients via DEConv. Therefore, the three modules contribute to performance improvement in different ways, namely noise suppression, feature alignment, and lightweight edge-aware localization.
To further investigate the internal effectiveness of CSFCN, we separately evaluated Context Feature Calibration (CFC) and Spatial Feature Calibration (SFC) on the baseline YOLOv12n. As shown in Table 4, the two sub-components improve the detector in different aspects. Specifically, when only CFC is introduced, Precision increases markedly from 85.9% to 90.9%, indicating that contextual calibration effectively suppresses misleading background responses and enhances semantic discriminability. However, Recall decreases slightly to 76.9%, suggesting that CFC alone tends to produce more conservative predictions. In contrast, using only SFC improves Recall from 79.0% to 80.6% and increases mAP@75 from 76.1% to 78.3%, demonstrating that spatial calibration is more effective in preserving defect details and improving localization accuracy. When CFC and SFC are combined to form the complete CSFCN, the model achieves the highest mAP@50 of 85.5%, while maintaining a more balanced trade-off between Precision and Recall. Although the SFC-only variant achieves a slightly higher mAP@75, the complete CSFCN provides better overall balance and stronger robustness across evaluation metrics, which is more desirable for practical defect detection. These results indicate that CFC and SFC play complementary roles: CFC mainly enhances semantic discrimination and false-positive suppression, whereas SFC contributes more to spatial alignment and fine-grained localization. Therefore, the complete CSFCN is adopted in the final model due to its more robust and balanced overall performance.
The pairwise combinations in Table 3 further reveal the complementary roles of the proposed modules. The combination of SR-C3k2(A) and LSDECD(C) achieves 91.2% Precision with only 5.2 GFLOPs and 2.2 M parameters, indicating that suppressing shallow texture noise and strengthening edge-sensitive prediction can jointly reduce false positives while preserving a lightweight design. In contrast, the combination of CSFCN(B) and LSDECD(C) achieves the highest Recall (83.4%) and F1-Score (82.6%), together with a higher mAP@50 of 86.3%. This suggests that context-aware feature calibration and detail-enhanced localization are more effective in reducing missed detections, especially for irregular defects whose semantic cues and boundary details need to be jointly preserved. Meanwhile, the combination of SR-C3k2 and CSFCN improves mAP@75 from 76.1% to 79.0%, showing that suppressing grinding-texture interference at the shallow stage can provide cleaner inputs for subsequent cross-scale calibration. In other words, SR-C3k2 mainly improves feature quality before fusion, whereas CSFCN further refines semantic consistency and spatial alignment after fusion. Their sequential effects explain why the A + B configuration yields a clear gain in strict localization accuracy.
Building upon these improvements, the fully integrated model, FMSD-YOLO12, achieves the best overall performance. Compared with the baseline, Recall increases to 81.9% (+2.9%), mAP@50 improves to 86.4% (+2.4%), and the more stringent mAP@75 significantly increases to 79.8% (+3.7%), while maintaining a lightweight model size of only 2.6 M parameters. These results show that jointly optimizing shallow noise suppression, cross-scale feature calibration, and edge-aware prediction leads to more robust overall detection performance without sacrificing lightweight deployment.
It is also worth noting that the fully integrated model does not achieve the best value in every individual configuration. Rather than indicating direct conflict among modules, this phenomenon reflects their non-linear coupling and different optimization emphases. Specifically, SR-C3k2 mainly suppresses grinding-texture interference and reduces false positives at the shallow stage, CSFCN improves semantic consistency and cross-scale spatial alignment during feature fusion, and LSDECD strengthens edge-sensitive localization while reducing parameter redundancy in the detection head. Since these modules optimize different stages of the detection pipeline, their joint effect is manifested as a rebalancing among precision, recall, and localization accuracy, rather than a simple linear superposition. Therefore, the ablation results indicate that the proposed modules are functionally complementary, and the final model achieves the best overall balance by jointly optimizing noise suppression, feature alignment, and edge-aware localization.
To further support this interpretation, we conducted a lightweight feature similarity analysis at the P3 level by computing the cosine similarity between defect-region features and background-region features after ROI average pooling, where a lower cosine similarity indicates better feature separability and less confusion between true defects and background textures. As shown in Table 5, the similarity decreases from 0.3629 in the baseline model to 0.3472 for the A + B configuration, and further to 0.2472, 0.2332, and 0.2186 for the A + C, B + C, and full (A + B + C) models, respectively. This trend suggests that the proposed module combinations progressively reduce feature confusion between defects and grinding-texture background. In particular, the full model achieves the lowest defect–background similarity, which provides feature-level evidence that the three modules are functionally complementary and jointly improve feature discriminability. This interpretation is also consistent with the feature heatmaps shown in Figure 10. Compared with the baseline model, which produces diffuse and blurred activations due to interference from complex grinding textures, FMSD-YOLO12 exhibits more concentrated responses on defect regions and sharper activations around subtle edges, further supporting the complementary effect of the proposed modules.
Table 5. Lightweight P3-level defect–background feature similarity analysis of different module combinations.
Figure 10. Feature heatmap comparison of different module combinations. A represents the SR-C3k2 module, B represents the CSFCN module, and FMSD-YOLO12 represents the final model incorporating the additional LSDECD module.

4.5. Sensitivity Analysis of the Density Parameter in SR-Conv

In the SR-C3k2 module, inspired by the optimal weighted convolution theory proposed by Cammarasana et al., we reshape the weight distribution of convolution kernels by introducing a two-dimensional spatial prior matrix Φ . According to their study, Φ is constructed via the outer product of a one-dimensional density vector α = d e n , 1.0 , d e n . Therefore, the hyperparameter den (density attenuation coefficient) directly controls the spatial attention distribution within the convolutional receptive field. To validate the rationality of the parameter selection and explore the optimal configuration, we conducted sensitivity analysis experiments by introducing SR-Conv into three key stages of the network (corresponding to the P3, P4, and P5 feature levels). Under identical training settings, both uniform den configurations and representative hierarchical scheduling strategies (as shown in Table 6) were systematically evaluated.
Table 6. Sensitivity analysis of the density parameter (den) configuration.

4.5.1. Configuration Strategies of Density Priors

To establish a scientifically grounded and robust baseline for the density parameter d e n , we adopted the empirical configuration space provided in the official implementation [49] of Cammarasana et al., selecting d e n ∈ 0.9 , 1.0 , 1.1 as core evaluation values. These values correspond to three distinct spatial priors: center-focused, uniform (standard convolution), and edge-enhanced distributions. Specifically, when d e n = 1.0 , the prior matrix Φ degenerates into an all-one matrix, which is equivalent to standard convolution with uniform aggregation. When d e n = 0.9 (<1.0), Φ exhibits a center-focused attenuation pattern, functioning as a low-pass filter that suppresses background noise. Conversely, when d e n = 1.1 (>1.0), the edge weights of the convolution kernel are amplified, leading to high-frequency enhancement effects. Based on these baseline values, we further designed two parameter configuration strategies: a uniform strategy and a hierarchical scheduling strategy. The uniform strategy evaluates the global consistency of spatial priors across all feature levels, while the hierarchical strategy assumes that different layers may require distinct feature extraction behaviors as the receptive field increases with network depth.

4.5.2. Results and Mechanism Discussion

As shown in Table 6, the configuration Uniform (0.9, 0.9, 0.9) achieves the best overall performance, with mAP@50 reaching 85.8%, significantly outperforming both the uniform baseline ( d e n = 1.0 , 84.2%) and the edge-enhanced strategy ( d e n = 1.1 , 82.3%). This result demonstrates that, for the dense high-frequency grinding textures on magnetic sheet surfaces, the center-focused soft attention induced by d e n = 0.9 effectively suppresses background interference and enhances sensitivity to subtle defects. In contrast, d e n = 1.1 tends to amplify irrelevant edge textures, leading to performance degradation.
Moreover, all hierarchical scheduling strategies that attempt to assign different filtering behaviors at different network depths fail to outperform the uniform configuration. This can be attributed to the cross-scale homogeneity of background noise in industrial magnetic sheet images. Specifically, relaxing the filtering constraint in deeper layers ( d e n > 1.0 ) may inadvertently reintroduce “pseudo-defects” that were not fully suppressed in earlier stages, thereby interfering with the subsequent semantic alignment process in the CSFCN module. Therefore, maintaining a globally consistent configuration with d e n = 0.9 provides the most effective solution for suppressing background noise and ensuring stable feature representation across scales. Accordingly, in this study, d e n is regarded as a task-specific hyperparameter rather than a universal constant, and its final setting is determined by combining prior empirical guidance with dataset-specific sensitivity analysis.

4.6. Comparative Experiments

To assess the effectiveness and deployment suitability of FMSD-YOLO12, we compared it with several mainstream detection algorithms. In addition to the Transformer-based Real-Time Detection Transformer (RT-DETR) and representative convolutional neural network (CNN)-based YOLO series models, two lightweight baselines, MobileNetV4-YOLO11 and YOLOX-Nano, were also included for a more comprehensive evaluation of the accuracy–efficiency trade-off. All models were trained and evaluated under identical dataset splits and hyperparameter settings. The quantitative results are summarized in Table 7.
Table 7. Performance comparison of FMSD-YOLO12 with mainstream and lightweight detection algorithms.
Overall, FMSD-YOLO12 achieves a favorable balance between detection accuracy and lightweight deployment on the self-constructed ferrite magnetic sheet dataset. The proposed model attains the best results on several key metrics, with mAP@50 reaching 86.4% and more stringent mAP@75 achieving 79.8%. Notably, compared with the baseline YOLOv12n, FMSD-YOLO12 improves mAP@75 by 3.7% (from 76.1% to 79.8%). This significant improvement indicates that the proposed model not only detects defects effectively but also generates bounding boxes that more precisely align with defect boundaries, which can be attributed to the CSFCN module and the DEConv operator. Compared with the parameter-heavy RT-DETR (which achieves a high Precision of 90.1% but a lower Recall of 81.5%), the proposed model demonstrates competitive robustness when handling cross-scale irregular defects while only requiring about 13% of its parameters (2.6 M vs. 19.9 M).
Compared with the lightweight baselines, FMSD-YOLO12 provides a more practical balance between detection accuracy and deployment efficiency for industrial inspection. While YOLOX-Nano possesses the smallest parameter size (0.9 M), its detection accuracy decreases noticeably, with mAP@50 and mAP@75 falling to 81.5% and 73.2%, respectively. Similarly, MobileNetV4-YOLO11 achieves higher FPS (290.6) but exhibits a substantial decrease in Recall (77.2%) and mAP@50-95 (67.6%). These results suggest that extremely lightweight designs can improve compactness, but may also weaken feature representation capability in complex industrial defect scenarios. In contrast, FMSD-YOLO12 maintains competitive efficiency (2.6M parameters) while delivering stronger overall detection performance, indicating that it achieves a favorable balance between computational cost and accuracy within the evaluated real-time industrial defect detection setting.
To further illustrate the detection characteristics of the proposed model in comparison with representative baselines, several representative detection results are visualized in Figure 11.
Figure 11. Visual detection examples of FMSD-YOLO12 and representative YOLO-series models. (Note: The colored bounding boxes denote different defect categories, where cyan, light blue, white, and dark blue correspond to LM, dot, smallbreak, and XB, respectively).
In terms of stable extraction of subtle features, as shown in the first column (LM defects) and the upper-right region of the third column (Smallbreak defects), all YOLO-based models are able to detect the targets, but the proposed model achieves higher confidence scores (both 0.93), significantly outperforming the baseline YOLOv12n (0.83 and 0.86) and other methods. This demonstrates that, with the assistance of the CFC mechanism, the model effectively prevents subtle defect features from being overwhelmed by complex background semantics, resulting in improved detection stability and accuracy. Regarding robustness against strong texture interference and multi-scale detection (as shown in the second column), the sample is dominated by high-frequency grinding textures and contains both small “Dots” and irregular “Smallbreaks”. The baseline YOLOv12n, as well as YOLOv11n and YOLOv8n, exhibit noticeable missed detections, while YOLOv9t produces low-confidence predictions. In contrast, the proposed model accurately detects all targets with high confidence, demonstrating that the SR-C3k2 module effectively suppresses texture noise and enhances multi-scale feature discrimination. For precise regression of irregular boundaries (as shown in the fourth column), conventional YOLO models tend to produce loose and redundant bounding boxes for highly irregular edge wear (XB). In contrast, driven by the differential edge enhancement of DEConv, the proposed model generates compact and well-aligned bounding boxes that closely match the defect contours. This observation provides intuitive visual evidence for the significant improvement in mAP@75 reported in the quantitative results.
Despite the strong performance of FMSD-YOLO12 across various scenarios, some limitations remain. Compared with Transformer-based models such as RT-DETR, which are effective at modeling complex global dependencies, the proposed model may encounter difficulties in certain extreme cases. As illustrated in Figure 12, while FMSD-YOLO12 achieves comparable localization performance in standard single-object scenarios (columns 1 and 2), it struggles with extremely small defects under severe texture interference (e.g., the tiny smallbreak in column 3) and defects with extremely weak edge features (e.g., edge wear in column 4), where RT-DETR can better capture such patterns due to its global attention mechanism.
Figure 12. Visual detection examples of FMSD-YOLO12 and RT-DETR. (Note: The colored bounding boxes indicate predicted defect categories. In the results of Ours, cyan, light blue, white, and dark blue boxes correspond to LM, dot, smallbreak, and XB, respectively. For RT-DETR, the box colors follow its own visualization settings, and the specific category is indicated by the label attached to each bounding box).
This observation also explains the higher Precision (90.1%) achieved by RT-DETR in Table 7. However, considering its significantly larger parameter size (19.9 M), FMSD-YOLO12 (2.6 M) achieves a more favorable trade-off by sacrificing only a small portion of performance in extreme cases while maintaining lightweight design and high inference speed. This balance makes it a more practical solution for real-world industrial scenarios that require low-cost and high-throughput deployment.

4.7. Cross-Domain Generalization on NEU-DET

To examine the cross-domain applicability of FMSD-YOLO12 in a different industrial inspection scenario, we evaluated the model on the public NEU-DET steel surface defect dataset [50]. As shown in Figure 13a–f, NEU-DET includes six defect categories from hot-rolled steel strips: crazing, inclusion, patches, pitted surface, rolled-in scale, and scratches. These defects share several challenges with ferrite magnetic sheet defects, such as complex background textures and large scale differences. The experimental results are presented in Table 8.
Figure 13. Six typical surface defect categories in the NEU-DET dataset.
Table 8. Performance evaluation of FMSD-YOLO12 against mainstream and lightweight detection algorithms on the NEU-DET dataset.
The comparison results demonstrate that FMSD-YOLO12 maintains strong competitiveness even without domain-specific prior adaptation to a new industrial material. Specifically, the proposed model achieves the highest Precision (86.2%) among all evaluated methods, outperforming the baseline YOLOv12n (81.2%) and YOLOv9t (84.2%). Furthermore, compared to ultra-lightweight designs, FMSD-YOLO12 shows stronger false-positive suppression capability. For example, MobileNetV4-YOLO11 yields a lower Precision of 69.3%, indicating reduced robustness in distinguishing defects from complex steel textures. This suggests that the combined feature extraction and calibration mechanisms contribute to more robust suppression of “pseudo-defects” under complex industrial backgrounds. In terms of overall detection accuracy, FMSD-YOLO12 achieves an mAP@50 of 83.9%, improving upon the baseline YOLOv12n (83.0%) by 0.9%. These results further validate the robustness and cross-domain applicability of the proposed model.
However, we also observe that FMSD-YOLO12 achieves lower Recall (73.4%) and mAP@75 (49.0%) on the NEU-DET dataset compared with generalization-oriented models such as YOLOv9t. This performance gap may be related to the task-oriented center-focused prior adopted in SR-Conv, whose optimal d e n setting was selected for ferrite magnetic sheet images with dense grinding textures. When directly transferred to a new domain without further re-calibration, the same prior may suppress diffuse or topology-variant defect edges more aggressively than desired, resulting in a slight reduction in Recall and high-IoU localization accuracy. These observations suggest that the task-oriented prior in SR-Conv is still partially scenario-dependent. When extending FMSD-YOLO12 to industrial scenes with substantially different surface textures, illumination conditions, or defect distributions, dataset-specific recalibration or adaptive prior learning may further enhance robustness. Such adaptation is also important under limited-data conditions, where the optimal prior configuration may be difficult to validate reliably.
Overall, although FMSD-YOLO12 is specifically optimized for ferrite magnetic sheet surface characteristics, the generalization experiments demonstrate that its core feature extraction and context-aware architecture still retain strong false-positive suppression. On the steel defect dataset, the proposed model not only maintains competitive real-time performance but also achieves the highest Precision (86.2%) among all compared methods, highlighting its robustness and practical potential for industrial surface defect inspection tasks. In future work, we will further investigate adaptive or learnable density priors in SR-Conv, together with more data-efficient training strategies, to improve robustness under varying texture, illumination, and limited-data conditions.

5. Conclusions

To address the major difficulties in ferrite magnetic sheet inspection, including severe grinding-texture disturbance, large defect-scale variation, and weak boundary perception, this study develops FMSD-YOLO12, an efficient defect inspection framework built upon YOLOv12. The proposed model introduces three targeted modifications to improve defect representation and deployment feasibility in industrial environments. First, the SR-C3k2 module is embedded into the backbone with a spatial density prior, enabling the model to reduce repetitive texture responses and strengthen the representation of subtle low-contrast defects. Second, the Context and Spatial Feature Calibration Network (CSFCN), consisting of Context Feature Calibration (CFC) and semantic-flow-guided Spatial Feature Calibration (SFC), is designed to alleviate spatial misalignment during multi-level feature fusion. Finally, the Lightweight Shared Detail-Enhanced Convolutional Detection (LSDECD) head combines cross-scale weight sharing and re-parameterized Detail-Enhanced Convolution (DEConv), improving the localization of weak and irregular boundaries without increasing deployment-stage computation.
Extensive experiments verify the effectiveness of FMSD-YOLO12. On the self-constructed ferrite magnetic sheet defect dataset, the proposed model achieves 86.4% mAP@50, 79.8% mAP@75, and 81.9% Recall. Additionally, it preserves a compact parameter size and reaches 197.7 FPS in inference-only speed, indicating a favorable trade-off between detection accuracy and processing speed. In addition, the cross-dataset evaluation on NEU-DET suggests a certain degree of cross-domain robustness, particularly in false-positive suppression, achieving the highest Precision of 86.2% among all compared methods.
Overall, within the scope of the evaluated industrial defect detection tasks, FMSD-YOLO12 achieves a favorable compromise among detection accuracy, localization quality, and model efficiency. Compared with extremely lightweight baseline models, it retains stronger recognition capability while keeping a compact model scale and real-time inference. Therefore, the proposed method offers a feasible approach for automated industrial inspection on edge-side devices, especially in scenarios involving subtle defects, irregular contours, and complex surface textures. For future work, we will explore more lightweight and efficient linear attention mechanisms to further improve robustness under challenging conditions. We also plan to deploy FMSD-YOLO12 on embedded edge devices using optimized inference engines and conduct long-term closed-loop validation in real-world production lines, thereby promoting its practical industrial application.

Author Contributions

Algorithm development and overall project direction were jointly managed by C.Z. and J.L. Software coding and subsequent simulation tests were executed by C.Z., H.Y. and R.W. participated in the establishment of the theoretical model and data interpretation. C.Z. was responsible for drafting the initial manuscript, which was then comprehensively reviewed and refined by J.L. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the National Natural Science Foundation of China under Grant No. 62573387, the Key R&D Program of Zhejiang (No. 2023C01062), Basic Public Welfare Research Program of Zhejiang Province (No. LGF22F030001) and the Fundamental Research Funds of Zhejiang Sci-Tech University (No. 24222091-Y).

Data Availability Statement

The dataset used in this study consists of two parts. The first part is a self-constructed dataset collected from real industrial production environments. Due to confidentiality and proprietary restrictions, this dataset is not publicly available. The second part is the publicly available NEU-DET dataset, which can be accessed online. The data supporting the findings of this study, including preprocessing and annotation details, are available from the corresponding author upon reasonable request.

Conflicts of Interest

Author J.L. was employed by Changshan Research Institute Co., Ltd. of Zhejiang Sci-Tech University. The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ABlockArea-Attention Block
ADCAngular Difference Convolution
APAverage Precision
ARA-NetAdaptive Rotation Attention Network
ARCAdaptive Rotated Convolution
ASPPAtrous Spatial Pyramid Pooling
BCEBinary Cross-Entropy
BiFPNBidirectional Feature Pyramid Network
BNBatch Normalization
CDCCentral Difference Convolution
CFCContext Feature Calibration
CNNConvolutional Neural Network
CSFCNContext and Spatial Feature Calibration Network
CSPCross-Stage Partial
CSPNetCross-Stage Partial Network
DCNv4Deformable Convolution v4
DEConvDetail-Enhanced Convolution
DFLDistribution Focal Loss
DSConvDepthwise Separable Convolution
F1-ScoreF1-Score
FMSD-YOLO12Ferrite Magnetic Sheet Defect Detection YOLOv12
FNFalse Negative
FPFalse Positive
FPNFeature Pyramid Network
FPSFrames Per Second
GFLOPsGiga Floating-Point Operations
GNGroup Normalization
HDCHorizontal Difference Convolution
HOGHistogram of Oriented Gradients
IoUIntersection over Union
LSDECDLightweight Shared Detail-Enhanced Convolutional Detection
mAPMean Average Precision
mAP@50Mean Average Precision at IoU = 0.50
mAP@50-95Mean Average Precision averaged over IoU thresholds from 0.50 to 0.95
NMSNon-Maximum Suppression
PPrecision
PANetPath Aggregation Network
ParamsNumber of Parameters in the Model
PSPPyramid Scene Parsing
RRecall
R-CNNRegion-based Convolutional Neural Network
RPAResidual Parallel Attention
RT-DETRReal-Time Detection Transformer
SFCSpatial Feature Calibration
SIFTScale-Invariant Feature Transform
SR-ConvSpatially Re-weighted Convolution
SR-C3k2Spatially Re-weighted C3k2 Module
SVMSupport Vector Machine
TPTrue Positive
VDCVertical Difference Convolution
YOLOYou Only Look Once

References

  1. Tahanian, H.; Aliahmadi, M.; Faiz, J. Ferrite permanent magnets in electrical machines: Opportunities and challenges of a non-rare-earth alternative. IEEE Trans. Magn. 2020, 56, 900120. [Google Scholar] [CrossRef] [Scilit]
  2. Du, Z.S.; Lipo, T.A. Cost-effective high torque density bi-magnet machines utilizing rare earth and ferrite permanent magnets. IEEE Trans. Energy Convers. 2020, 35, 1577–1584. [Google Scholar] [CrossRef] [Scilit]
  3. E. Farag, H.; Khamesee, M.B.; Toyserkani, E. Eddy current sensor probe design for subsurface defect detection in additive manufacturing. Sensors 2024, 24, 5355. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  4. Zhang, J.; Wan, H.; Sun, F.; Chen, X.; Jia, K.; Fan, L.; Cheng, L.; Xu, X.; Yan, X.; Yuan, P.; et al. Laser ultrasonic inspection of surface and subsurface defects in materials based on deep learning. Nondestruct. Test. Eval. 2024, 40, 4744–4763. [Google Scholar] [CrossRef] [Scilit]
  5. Li, L.; Liu, Z.; Zhao, H.; Xue, L.; Wu, J. A method for detecting bearing surface defects combining magnetic particle testing and deep learning. Appl. Sci. 2024, 14, 1747. [Google Scholar] [CrossRef] [Scilit]
  6. Fang, X.; Luo, Q.; Zhou, B.; Li, C.; Tian, L. Research progress of automated visual surface defect detection for industrial metal planar materials. Sensors 2020, 20, 5136. [Google Scholar] [CrossRef] [Scilit]
  7. Wu, Z.; Jiang, H.; Liu, S.; Liu, Y.; Yang, W. Conditional distribution-guided adversarial transfer learning network with multi-source domains for rolling bearing fault diagnosis. Adv. Eng. Inform. 2023, 56, 101993. [Google Scholar] [CrossRef] [Scilit]
  8. Wang, X.; Jiang, H.; Dong, Y.; Mu, M. Spatial-channel collaborative multi-scale graph interaction deep transfer learning for unsupervised rotating machinery fault diagnosis. Eng. Appl. Artif. Intell. 2026, 176, 114691. [Google Scholar] [CrossRef] [Scilit]
  9. Wang, X.; Jiang, H.; Zeng, T.; Dong, Y. An adaptive fused domain-cycling variational generative adversarial network for machine fault diagnosis under data scarcity. Inf. Fusion 2025, 126, 103616. [Google Scholar] [CrossRef] [Scilit]
  10. Zhao, Y.; Lv, W.; Xu, S.; Wei, J.; Wang, G.; Dang, Q.; Liu, Y.; Chen, J. DETRs Beat YOLOs on Real-time Object Detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 17–21 June 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 16965–16974. [Google Scholar]
  11. Ramos, L.T.; Sappa, A.D. A decade of You Only Look Once (YOLO) for object detection: A review. IEEE Access 2025, 13, 192747–192794. [Google Scholar] [CrossRef] [Scilit]
  12. Hussain, M. YOLO-v1 to YOLO-v8: The rise of YOLO and its complementary role in digital manufacturing and industrial defect detection. Machines 2023, 11, 677. [Google Scholar] [CrossRef] [Scilit]
  13. Wang, A.; Chen, H.; Liu, L.; Chen, K.; Lin, Z.; Han, J.; Ding, G. YOLOv10: Real-time end-to-end object detection. Adv. Neural Inf. Process. Syst. 2024, 37, 107984–108011. [Google Scholar]
  14. Tian, Y.; Ye, Q.; Doermann, D. YOLOv12: Attention-centric real-time object detectors. arXiv 2025, arXiv:2502.12524. [Google Scholar]
  15. Lowe, D.G. Distinctive image features from scale-invariant keypoints. Int. J. Comput. Vis. 2004, 60, 91–110. [Google Scholar] [CrossRef] [Scilit]
  16. Dalal, N.; Triggs, B. Histograms of oriented gradients for human detection. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), San Diego, CA, USA, 20–25 June 2005; IEEE: Piscataway, NJ, USA, 2005; pp. 886–893. [Google Scholar]
  17. Girshick, R.; Donahue, J.; Darrell, T.; Malik, J. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Columbus, OH, USA, 23–28 June 2014; IEEE: Piscataway, NJ, USA, 2014; pp. 580–587. [Google Scholar]
  18. Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. Adv. Neural Inf. Process. Syst. 2015, 28, 1–9. [Google Scholar] [CrossRef] [Scilit]
  19. Redmon, J.; Farhadi, A. YOLO9000: Better, Faster, Stronger. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 6517–6525. [Google Scholar]
  20. Wang, C.Y.; Liao, H.Y.M.; Wu, Y.H.; Chen, P.Y.; Hsieh, J.W.; Yeh, I.H. CSPNet: A New Backbone That Can Enhance Learning Capability of CNN. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), Seattle, WA, USA, 14–19 June 2020; IEEE: Piscataway, NJ, USA, 2020. [Google Scholar]
  21. Ultralytics. YOLOv8. Available online: https://docs.ultralytics.com/models/yolov8/ (accessed on 10 March 2025).
  22. Wang, C.Y.; Yeh, I.H.; Liao, H.Y.M. YOLOv9: Learning what you want to learn using programmable gradient information. In Proceedings of the European Conference on Computer Vision (ECCV), Milan, Italy, 29 September–4 October 2024; Springer: Berlin/Heidelberg, Germany, 2024; pp. 1–21. [Google Scholar]
  23. Ultralytics. YOLOv11. Available online: https://docs.ultralytics.com/models/yolo11/ (accessed on 10 March 2025).
  24. Qin, D.; Leichner, C.; Delakis, M.; Fornoni, M.; Luo, S.; Yang, F.; Wang, W.; Banbury, C.; Ye, C.; Akin, B.; et al. MobileNetV4: Universal models for the mobile ecosystem. In Proceedings of the European Conference on Computer Vision (ECCV), Milan, Italy, 29 September–4 October 2024; Springer: Berlin/Heidelberg, Germany, 2024; pp. 78–96. [Google Scholar]
  25. Megvii-BaseDetection. YOLOX: High-Performance Anchor-Free YOLO Detector. GitHub Repository. Available online: https://github.com/Megvii-BaseDetection/YOLOX (accessed on 22 April 2026).
  26. Ren, Z.; Fang, F.; Yan, N.; Wu, Y. State of the art in defect detection based on machine vision. Int. J. Precis. Eng. Manuf. Green Technol. 2022, 9, 661–691. [Google Scholar] [CrossRef] [Scilit]
  27. Huang, Y.; Huang, Z.; Jin, T. DEU-Net: A multi-scale fusion staged network for magnetic tile defect detection. Appl. Sci. 2024, 14, 4724. [Google Scholar] [CrossRef] [Scilit]
  28. Prunella, M.; Scardigno, R.M.; Buongiorno, D.; Brunetti, A.; Longo, N.; Carli, R.; Dotoli, M.; Bevilacqua, V. Deep learning for automatic vision-based recognition of industrial surface defects: A survey. IEEE Access 2023, 11, 43370–43423. [Google Scholar] [CrossRef] [Scilit]
  29. Luo, F.; Cui, Y.; Wang, X.; Zhang, Z.; Liao, Y. Adaptive rotation attention network for accurate defect detection on magnetic tile surface. Math. Biosci. Eng. 2023, 20, 18585–18607. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  30. Yu, B.; Li, Q.; Jiao, W.; Zhang, S.; Zhu, Y. SAB-YOLOv5: An improved YOLOv5 model for permanent magnetic ferrite magnet rotor detection. Mathematics 2024, 12, 957. [Google Scholar] [CrossRef] [Scilit]
  31. Niu, W.; Lv, C.; Zhang, E.; Wei, Z. YOLO-RDM: A high-accuracy and efficient algorithm for magnetic tile surface defect detection with practical applications. PLoS ONE 2025, 20, e0328815. [Google Scholar] [CrossRef] [Scilit]
  32. Ma, C.; Pan, Y.; Chen, J. Surface defect detection of magnetic tiles based on YOLOv8-AHF. Electronics 2025, 14, 2857. [Google Scholar] [CrossRef] [Scilit]
  33. Ma, S.; Zhao, X.; Wan, L.; Zhang, Y.; Gao, H. A lightweight algorithm for steel surface defect detection using improved YOLOv8. Sci. Rep. 2025, 15, 8966. [Google Scholar] [CrossRef] [Scilit]
  34. Wang, Y.; Sun, H.; Luo, K.; Zhu, Q.; Li, H.; Sun, Y.; Wu, Z.; Wang, G. A lightweight YOLOv11-based framework for small steel defect detection with a newly enhanced feature fusion module. Sci. Rep. 2025, 15, 34322. [Google Scholar] [CrossRef] [Scilit]
  35. Lin, T.Y.; Dollár, P.; Girshick, R.; He, K.; Hariharan, B.; Belongie, S. Feature pyramid networks for object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 2117–2125. [Google Scholar]
  36. Liu, S.; Qi, L.; Qin, H.; Shi, J.; Jia, J. Path aggregation network for instance segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Salt Lake City, UT, USA, 18–22 June 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 8759–8768. [Google Scholar]
  37. Li, M.; Wu, J.; Wang, X.; Chen, C.; Qin, J.; Xiao, X.; Wang, R.; Zheng, M.; Pan, X. AlignDet: Aligning pre-training and fine-tuning in object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2–6 October 2023; IEEE: Piscataway, NJ, USA, 2023; pp. 6866–6876. [Google Scholar]
  38. Li, X.; You, A.; Zhu, Z.; Zhao, H.; Yang, M.; Yang, K.; Tan, S.; Tong, Y. Semantic flow for fast and accurate scene parsing. In Proceedings of the European Conference on Computer Vision (ECCV), Glasgow, UK, 23–28 August 2020; Springer: Berlin/Heidelberg, Germany, 2020; pp. 775–793. [Google Scholar]
  39. Xiong, Y.; Li, Z.; Chen, Y.; Wang, F.; Zhu, X.; Luo, J.; Wang, W.; Lu, T.; Li, H.; Qiao, Y.; et al. Efficient deformable convnets: Rethinking dynamic and sparse operator for vision applications. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 17–21 June 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 5652–5661. [Google Scholar]
  40. Tang, H.; Li, Z.; Zhang, D.; He, S.; Tang, J. Divide-and-Conquer: Confluent Triple-Flow Network for RGB-T Salient Object Detection. IEEE Trans. Pattern Anal. Mach. Intell. 2025, 47, 1958–1974. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  41. Li, K.; Geng, Q.; Wan, M.; Cao, X.; Zhou, Z. Context and spatial feature calibration for real-time semantic segmentation. IEEE Trans. Image Process. 2023, 32, 5465–5477. [Google Scholar] [CrossRef] [Scilit]
  42. Yu, Z.; Zhao, C.; Wang, Z.; Qin, Y.; Su, Z.; Li, X.; Zhou, F.; Zhao, G. Searching central difference convolutional networks for face anti-spoofing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 14–19 June 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 5295–5305. [Google Scholar]
  43. Ding, X.; Zhang, X.; Ma, N.; Han, J.; Ding, G.; Sun, J. RepVGG: Making VGG-style convnets great again. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Nashville, TN, USA, 19–25 June 2021; IEEE: Piscataway, NJ, USA, 2021; pp. 13733–13742. [Google Scholar]
  44. Lin, T.Y.; Goyal, P.; Girshick, R.; He, K.; Dollár, P. Focal Loss for Dense Object Detection. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), Venice, Italy, 22–29 October 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 2980–2988. [Google Scholar]
  45. Cammarasana, S.; Patanè, G. Optimal density functions for weighted convolution in learning models. arXiv 2025, arXiv:2505.24527. [Google Scholar] [CrossRef] [Scilit]
  46. Cammarasana, S.; Patanè, G. Optimal weighted convolution for classification and denoising. arXiv 2025, arXiv:2505.24558. [Google Scholar]
  47. Liu, Y.; Shi, Y. VRU-YOLO: A small object detection algorithm for vulnerable road users in complex scenes. IEEE Access 2025, 13, 16584–16599. [Google Scholar] [CrossRef] [Scilit]
  48. Chen, Z.; He, Z.; Lu, Z.M. DEA-Net: Single image dehazing based on detail-enhanced convolution and content-guided attention. IEEE Trans. Image Process. 2024, 33, 1002–1015. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  49. Cammarasana, S. WeightedConvolution2.0. Available online: https://github.com/cammarasana123/weightedConvolution2.0 (accessed on 25 March 2026).
  50. He, Y.; Song, K.; Meng, Q.; Yan, Y. An end-to-end steel surface defect detection approach via fusing multiple hierarchical features. IEEE Trans. Instrum. Meas. 2020, 69, 1493–1504. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.