收藏切换
Adaptive multi-scale fusion transformer for forging surface defect detection
收藏切换
Dan Liang1, 2, Shang Zhang1, 2, Huipan Guan1, 2
Opto-Electronic Engineering | 2026, 53(2) : 250242 - 1
Less
收藏切换
Opto-Electronic Engineering | 2026, 53(2): 250242-1
• Article •
Adaptive multi-scale fusion transformer for forging surface defect detection
Full
Dan Liang1, 2, Shang Zhang1, 2, Huipan Guan1, 2
Affiliations
  • 1College of Computer and Information Technology, China Three Gorges University, Yichang, Hubei 443002, China
  • 2Hubei Province Engineering Technology Research Center for Construction Quality Testing Equipment, China Three Gorges University, Yichang, Hubei 443002, China
Published: 2026-02-25 doi: 10.12086/oee.2026.250242
Outline
收藏切换
Objective

Forged parts are widely used as key load-bearing components in automotive, aerospace, shipbuilding, and heavy equipment industries. Their surface quality directly affects structural reliability and service safety. During forging and subsequent processing, surface defects such as cracks, inclusions, pores, oxide layers, and spot-like imperfections are frequently generated due to material heterogeneity, mold wear, and process instability. Magnetic particle inspection is commonly adopted for ferromagnetic forged parts because of its high sensitivity to surface and near-surface cracks. However, magnetic particle inspection images usually exhibit complex backgrounds, uneven illumination, magnetic trace interference, and weak texture contrast. These characteristics cause surface defects to present blurred boundaries, irregular shapes, and large scale variation. Slender cracks and tiny defects are especially difficult to detect accurately under real-time constraints. Existing convolutional neural network–based and Transformer-based detection models often show insufficient directional perception, limited contextual representation, and inadequate geometric sensitivity in bounding-box regression. As a result, detection accuracy and computational efficiency are difficult to balance in practical industrial inspection scenarios. The objective of this study was to develop a real-time forged-part surface defect detection model that enhances directional feature perception and contextual fusion capability, improves multi-scale feature alignment, and strengthens localization robustness for elongated defects, while maintaining high inference efficiency suitable for industrial deployment.

Methods

A real-time surface defect detection framework, named MCF-RTDETR, was constructed based on an improved RT-DETR architecture. Magnetic particle inspection images of heavy-duty truck steering knuckles were collected from an industrial production environment and manually annotated to establish a forged-part surface crack dataset. The dataset contained complex background structures and fine-scale defect patterns, providing realistic samples for model evaluation.

In the backbone network, a multi-gradient fusion convolution module was introduced to enhance directional edge representation. This module integrated four directional difference convolutions with one standard convolution to capture gradient responses along multiple orientations. Such design improved feature sensitivity to slender cracks and weakly textured defects. To avoid increased inference cost, convolutional re-parameterization was adopted during the inference stage, allowing the multi-branch structure to be equivalently transformed into a single convolution layer while preserving feature enhancement capability.

In the neck network, a context-aware recursive feature pyramid network was designed to address insufficient spatial–semantic alignment in conventional multi-scale fusion schemes. A rectangular self-calibration module was first employed to model directional contextual information by expanding receptive fields along horizontal and vertical directions, which strengthened anisotropic defect representation. Subsequently, a FuseBlockMulti module was used to realize semantic-guided alignment between shallow detail features and deep semantic features, enabling adaptive information interaction across different feature levels. Furthermore, a dynamic interpolation fusion mechanism was introduced to assign adaptive fusion weights to multi-scale features according to local contextual semantic strength. Through recursive fusion, feature consistency across scales was progressively refined, improving robustness under complex backgrounds and large scale variation.

For bounding-box regression, the original loss function was replaced with a Focaler-MPDIoU loss. This loss combined difficulty-aware sample weighting with multi-point distance geometric constraints, enhancing localization accuracy and boundary fitting ability for elongated and irregular defects. The entire detection framework was optimized in an end-to-end manner and evaluated under unified training and inference configurations.

Results and Discussions

Experimental results demonstrated that the proposed MCF-RTDETR achieved superior performance in forged-part surface defect detection. On the magnetic particle inspection dataset of heavy-duty truck steering knuckles, the proposed model obtained a mean average precision of 88.5%, which exceeded the RTDETR-r18 baseline by 2.3%. Meanwhile, computational complexity was reduced from 58.3 G to 33.5 G, and inference speed reached 137.2 f/s, indicating an effective balance between detection accuracy and computational efficiency.

Performance improvement was particularly evident for slender cracks and small-scale defects. Enhanced directional gradient perception reduced missed detections caused by weak edge responses, while context-aware recursive fusion suppressed background interference and improved defect-background discrimination. Ablation experiments confirmed the effectiveness of each proposed component. The multi-gradient fusion Convolution strengthened edge sensitivity without increasing inference overhead. The Context-Aware Recursive Feature Pyramid Network improved multi-scale feature consistency and spatial-semantic alignment. The Focaler-MPDIoU loss further enhanced bounding-box regression accuracy for defects with large aspect ratios.

Generalization capability was validated on the public GC10-DET dataset. The proposed model achieved a 2.8% increase in mean average precision compared with the baseline detector, demonstrating that the proposed feature enhancement and fusion strategies are transferable to different industrial surface defect detection scenarios. These results indicate that the proposed framework effectively integrates accuracy improvement with computational reduction, which is essential for real-time industrial inspection systems.

Conclusions

A context-aware multi-scale fusion real-time detection model for forged-part surface defects is presented. Directional gradient fusion, adaptive contextual feature integration, and geometry-sensitive regression jointly enhance detection robustness under complex backgrounds and severe scale variation. Experimental results confirm that the proposed approach improves detection accuracy while reducing computational complexity and maintaining high inference speed. The model shows strong generalization capability and practical applicability, providing an effective solution for automated forged-part surface defect inspection in industrial environments.

defect detection  /  RT-DETR  /  feature fusion  /  loss function
梁丹, 张上, 管慧攀. 自适应多尺度融合的Transformer锻件表面缺陷检测算法. 光电工程, 2026 , 53 (2) : 250242 -1 . DOI: 10.12086/oee.2026.250242
Dan Liang, Shang Zhang, Huipan Guan. Adaptive multi-scale fusion transformer for forging surface defect detection[J]. Opto-Electronic Engineering, 2026 , 53 (2) : 250242 -1 . DOI: 10.12086/oee.2026.250242
Year 2026 volume 53 Issue 2
149
57
Cite this Article
BibTeX
Article Info
doi: 10.12086/oee.2026.250242
  • Receive Date:2025-08-18
  • Online Date:2026-10-22
  • Published:2026-02-25
Article Data
Affiliations
History
  • Received:2025-08-18
  • Revised:2025-10-23
  • Accepted:2025-10-28
Affiliations
    1College of Computer and Information Technology, China Three Gorges University, Yichang, Hubei 443002, China
    2Hubei Province Engineering Technology Research Center for Construction Quality Testing Equipment, China Three Gorges University, Yichang, Hubei 443002, China

Corresponding:

References
Share
https://castjournals.cast.org.cn/joweb/oee/EN/10.12086/oee.2026.250242
Share to
QR

Scan QR to access full text

Cite this article
BibTeX
Citations
表12种不同金属材料的力学参数
科
Family
属数
Number of
genus
种数
Number of
species
占总种数比例
Percentage of
total species (%)
属
Genus
种数
Number of
species
占总种数比例
Percentage of total
species (%)
鹅膏菌科Amanitaceae 2 11 5.26 鹅膏菌属 Amanita 10 4.78
小菇科 Mycenaceae 2 12 5.74 丝盖伞属 Inocybe 5 2.39
多孔菌科 Polyporaceae 8 14 6.70 蜡蘑属 Laccaria 5 2.39
红菇科 Russulaceae 3 23 11.00 小皮伞属 Marasmius 6 2.87
小菇属 Mycena 11 5.26
光柄菇属 Pluteus 5 2.39
红菇属 Russula 17 8.13
栓菌属 Trametes 5 2.39
关闭全屏
  • BibTeX
  • EndNote
  • RefWorks
  • TxT