EAS-DETR: An Enhanced Real-Time Transformer with Sparse Attention and Global Context for PCB Defect Inspection
Abstract
1. Introduction
- 1.
- We reconstruct the feature extraction backbone by developing the C2f-EC module. By embedding efficient local–global context aggregation and convolutional gating mechanisms into a Cross Stage Partial (CSP) topology, the network is empowered to jointly capture local textures and global structural dependencies while maintaining efficient gradient flow.
- 2.
- We propose the Adaptive Sparse Attention-based Intra-scale Feature Interaction (ASAFI) module for the hybrid encoder. By adaptively fusing dense and sparse self-attention outputs, ASAFI effectively suppresses irrelevant background noise and actively redirects the network’s focus toward structurally sparse and minuscule defect regions.
- 3.
- We design SGO-FPN, an advanced feature pyramid network tailored for small object localization. Incorporating soft interpolation strategies and space-to-depth transformations, SGO-FPN mitigates cross-scale spatial misalignment and leverages high-resolution, early-stage features to preserve crucial fine-grained details.
2. Method
2.1. RT-DETR Baseline Framework
2.2. Overview of the Proposed EAS-DETR Algorithm
2.3. C2f-EC
2.4. ASAFI
2.5. SGO-FPN
3. Experimental Results and Analysis
3.1. Dataset
3.2. Experimental Environment
3.3. Evaluation Metrics
3.4. Comparative Experiments
3.4.1. Comparison with Baseline Models
3.4.2. Generalization Performance Across Different Datasets
3.5. Ablation Experiment
- 1.
- The original RT-DETR network as baseline.
- 2.
- Baseline combined with C2f-EC.
- 3.
- Baseline combined with ASAFI.
- 4.
- Baseline combined with SGO-FPN.
- 5.
- Baseline combined with C2f-EC and ASAFI.
- 6.
- Baseline combined with C2f-EC and SGO-FPN.
- 7.
- Baseline combined with ASAFI and SGO-FPN.
- 8.
- The complete EAS-DETR integrating all three improvements.
4. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
| PCB | Printed Circuit Board |
| HDI | High-Density Interconnect |
| AOI | Automated Optical Inspection |
| CNNs | Convolutional Neural Networks |
| YOLO | You Only Look Once |
| DETR | Detection Transformer |
| RT-DETR | Real-Time Detection Transformer |
| IoU | Intersection over Union |
| NMS | Non-Maximum Suppression |
| CSP | Cross Stage Partial |
| CGLU | Convolutional Gated Linear Unit |
| ELGCA | Efficient Local–Global Context Aggregation |
| AIFI | Attention-based Intra-scale Feature Interaction |
| CCFM | Cross-scale Feature Fusion Module |
| MHSA | Multi-Head Self-Attention |
| ASAFI | Adaptive Sparse Attention-based Intra-scale Feature Interaction |
| ASSA | Adaptive Sparse Self-Attention |
| SNI | Soft Nearest Neighbor Interpolation |
| SPDConv | Space-to-Depth Convolution |
| DCAM | Dual-domain Channel Attention Module |
| FSAM | Frequency–Spatial Attention Module |
| mAP | mean Average Precision |
| Params | Parameters |
| GFLOPs | Giga Floating-point Operations |
| SD | Standard Deviation |
References
- Papamatthaiou, S.; Menelaou, P.; El Achab Oussallam, B.; Moschou, D. Recent advances in bio-microsystem integration and Lab-on-PCB technology. Microsyst. Nanoeng. 2025, 11, 78. [Google Scholar] [CrossRef] [PubMed]
- Trautweiler, S.; Dietrich, S. Advancing IC substrate manufacturing: Overcoming challenges and exploring opportunities with 10 μm line/space technology. In Proceedings of the 25th European Microelectronics and Packaging Conference & Exhibition (EMPC), Grenoble, France, 16–18 September 2025; pp. 1–6. [Google Scholar] [CrossRef]
- Sankar, V.U.; Lakshmi, G.; Sankar, Y.S. A review of various defects in PCB. J. Electron. Test. 2022, 38, 481–491. [Google Scholar] [CrossRef]
- Heltzel, S.; Cauwe, M.; Bennett, J.; Rohr, T. Advanced PCB technologies for space and their assessment using up-to-date standards. CEAS Space J. 2023, 15, 89–100. [Google Scholar] [CrossRef]
- Ling, Q.; Isa, N.A.M. Printed circuit board defect detection methods based on image processing, machine learning and deep learning: A survey. IEEE Access 2023, 11, 15921–15944. [Google Scholar] [CrossRef]
- Wu, F.; Zhang, X.; Kuan, Y.; He, Z. An AOI algorithm for PCB based on feature extraction. In Proceedings of the 7th World Congress on Intelligent Control and Automation, Chongqing, China, 25–27 June 2008; pp. 240–247. [Google Scholar] [CrossRef]
- Dai, W.; Mujeeb, A.; Erdt, M.; Sourin, A. Soldering defect detection in automatic optical inspection. Adv. Eng. Inform. 2019, 43, 101004. [Google Scholar] [CrossRef]
- Girshick, R.; Donahue, J.; Darrell, T.; Malik, J. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the 2014 IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA, 23–28 June 2014; pp. 580–587. [Google Scholar] [CrossRef]
- Girshick, R. Fast R-CNN. In Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV), Santiago, Chile, 7–13 December 2015; pp. 1440–1448. [Google Scholar] [CrossRef]
- Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 39, 1137–1149. [Google Scholar] [CrossRef] [PubMed]
- Li, Y.T.; Guo, J.I. A VGG-16 based Faster RCNN model for PCB error inspection in industrial AOI applications. In Proceedings of the 2018 IEEE International Conference on Consumer Electronics-Taiwan (ICCE-TW), Taichung, Taiwan, 19–21 May 2018; pp. 1–2. [Google Scholar] [CrossRef]
- Hu, B.; Wang, J. Detection of PCB surface defects with improved Faster-RCNN and feature pyramid network. IEEE Access 2020, 8, 108335–108345. [Google Scholar] [CrossRef]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You only look once: Unified, real-time object detection. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 779–788. [Google Scholar] [CrossRef]
- Redmon, J.; Farhadi, A. YOLO9000: Better, faster, stronger. In Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; pp. 6517–6525. [Google Scholar] [CrossRef]
- Wang, C.Y.; Bochkovskiy, A.; Liao, H.Y.M. YOLOv7: Trainable Bag-of-Freebies Sets New State-of-the-Art for Real-Time Object Detectors. In Proceedings of the 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Vancouver, BC, Canada, 17–24 June 2023; pp. 7464–7475. [Google Scholar] [CrossRef]
- Wang, C.Y.; Yeh, I.H.; Liao, H.Y.M. YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information. In Computer Vision—ECCV 2024; Leonardis, A., Ricci, E., Roth, S., Russakovsky, O., Sattler, T., Varol, G., Eds.; Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2025; Volume 15089. [Google Scholar] [CrossRef]
- Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.E.; Fu, C.Y.; Berg, A.C. SSD: Single shot multiBox detector. In Computer Vision—ECCV 2016; Leibe, B., Matas, J., Sebe, N., Welling, M., Eds.; Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2016; Volume 9905, pp. 21–37. [Google Scholar] [CrossRef]
- Wang, J.; Xie, X.; Liu, G.; Wu, L. A lightweight PCB defect detection algorithm based on improved YOLOv8-PCB. Symmetry 2025, 17, 309. [Google Scholar] [CrossRef]
- Liu, L.J.; Zhang, Y.; Karimi, H.R. Defect detection of printed circuit board surface based on an improved YOLOv8 with FasterNet backbone algorithms. Signal Image Video Process. 2025, 19, 89. [Google Scholar] [CrossRef]
- Huang, J.; Zhao, F.; Chen, L. Defect detection network in PCB circuit devices based on GAN enhanced YOLOv11. Appl. Comput. Eng. 2025, 133, 128–134. [Google Scholar] [CrossRef]
- Carion, N.; Massa, F.; Synnaeve, G.; Usunier, N.; Kirillov, A.; Zagoruyko, S. End-to-end object detection with transformers. In Computer Vision—ECCV 2020; Vedaldi, A., Bischof, H., Brox, T., Frahm, J.M., Eds.; Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2020; Volume 12346. [Google Scholar] [CrossRef]
- Zhu, X.; Su, W.; Lu, L.; Li, B.; Wang, X.; Dai, J. Deformable DETR: Deformable transformers for end-to-end object detection. In Proceedings of the 9th International Conference on Learning Representations (ICLR), Vienna, Austria, 3–7 May 2021. [Google Scholar]
- Li, F.; Zhang, H.; Liu, S.; Guo, J.; Ni, L.M.; Zhang, L. DN-DETR: Accelerate DETR training by introducing query denoising. IEEE Trans. Pattern Anal. Mach. Intell. 2024, 46, 2239–2251. [Google Scholar] [CrossRef] [PubMed]
- Zhang, H.; Li, F.; Liu, S.; Zhang, L.; Su, H.; Zhu, J.; Ni, L.M.; Shum, H.Y. DINO: DETR with improved denoising anchor boxes for end-to-end object detection. In Proceedings of the 11th International Conference on Learning Representations (ICLR), Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
- Lv, W.; Xu, S.; Zhao, Y.; Wang, G.; Wei, J.; Cui, C.; Du, Y.; Dang, Q.; Liu, Y. DETRs beat YOLOs on real-time object detection. In Proceedings of the 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 16–22 June 2024; pp. 16965–16974. [Google Scholar] [CrossRef]
- Peng, J.; Fan, W.; Lan, S.; Wang, D. MDD-DETR: Lightweight detection algorithm for printed circuit board minor defects. Electronics 2024, 13, 4453. [Google Scholar] [CrossRef]
- Ji, L.; Huang, C.; Li, H.; Han, W.; Yi, L. MS-DETR: A real-time multi-scale detection transformer for PCB defect detection. Signal Image Video Process. 2025, 19, 203. [Google Scholar] [CrossRef]
- Madan, M.; Reich, C. Strengthening small object detection in adapted RT-DETR through robust enhancements. Electronics 2025, 14, 3830. [Google Scholar] [CrossRef]
- Zhang, D.H.; Hao, X.Y.; Liang, L.L.; Zhang, C.; Peng, Y. A novel deep convolutional neural network algorithm for surface defect detection. J. Comput. Des. Eng. 2022, 9, 1616–1632. [Google Scholar] [CrossRef]
- Noman, M.; Fiaz, M.; Cholakkal, H.; Khan, S.; Khan, F.S. ELGC-Net: Efficient local–global context aggregation for remote sensing change detection. IEEE Trans. Geosci. Remote Sens. 2024, 62, 4701611. [Google Scholar] [CrossRef]
- Shi, D. TransNeXt: Robust foveal visual perception for vision transformers. In Proceedings of the 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 16–22 June 2024; pp. 17773–17783. [Google Scholar] [CrossRef]
- Zhou, S.; Chen, D.; Pan, J.; Shi, J.; Yang, J. Adapt or perish: Adaptive sparse transformer with attentive feature refinement for image restoration. In Proceedings of the 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 16–22 June 2024; pp. 2952–2963. [Google Scholar] [CrossRef]
- Li, H. Rethinking features-fused-pyramid-neck for object detection. In Computer Vision—ECCV 2024; Leonardis, A., Ricci, E., Roth, S., Russakovsky, O., Sattler, T., Varol, G., Eds.; Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2025; Volume 15125. [Google Scholar] [CrossRef]
- Sunkara, R.; Luo, T. No more strided convolutions or pooling: A new CNN building block for low-resolution images and small objects. In Machine Learning and Knowledge Discovery in Databases; Amini, M.R., Canu, S., Fischer, A., Guns, T., Kralj Novak, P., Tsoumakas, G., Eds.; Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2023; Volume 13715. [Google Scholar] [CrossRef]
- Cui, Y.; Ren, W.; Knoll, A. Omni-kernel network for image restoration. In Proceedings of the 38th AAAI Conference on Artificial Intelligence, Vancouver, BC, Canada, 20–27 February 2024; pp. 1426–1434. [Google Scholar] [CrossRef]
- Zhang, Y.; Ye, M.; Zhu, G.; Liu, Y.; Guo, P.; Yan, J. FFCA-YOLO for small object detection in remote sensing images. IEEE Trans. Geosci. Remote Sens. 2024, 62, 5611215. [Google Scholar] [CrossRef]
- Liu, W.; Shi, L.; An, G. An efficient aerial image detection with variable receptive fields. Remote Sens. 2025, 17, 2672. [Google Scholar] [CrossRef]
- He, F.; Tang, S.; Mehrkanoon, S.; Huang, X.; Yang, J. A Real-time PCB Defect Detector Based on Supervised and Semi-supervised Learning. In Proceedings of the 28th European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning (ESANN 2020), Bruges, Belgium, 2–4 October 2020; pp. 527–532. [Google Scholar]
- Wang, J.; Yang, W.; Guo, H.; Zhang, R.; Xia, G.S. Tiny object detection in aerial images. In Proceedings of the 25th International Conference on Pattern Recognition (ICPR), Milan, Italy, 10–15 January 2021; pp. 3791–3798. [Google Scholar] [CrossRef]
- Zhu, P.; Wen, L.; Du, D.; Bian, X.; Fan, H.; Hu, Q.; Ling, H. Detection and tracking meet drones challenge. IEEE Trans. Pattern Anal. Mach. Intell. 2021, 44, 7380–7399. [Google Scholar] [CrossRef] [PubMed]













| Configuration | Description |
|---|---|
| Operating System | Ubuntu 22.04 |
| CPU | Intel(R) Xeon(R) Gold 6330 CPU @ 2.00GHz (14 vCPU) |
| GPU | NVIDIA GeForce RTX 3090 (24 GB) |
| RAM | 90 GB |
| Python Version | 3.10 |
| Deep Learning Framework | PyTorch 2.1.0 |
| CUDA Version | 12.1 |
| Model | P (%) | R (%) | (%) | mAP@0.5 (%) | mAP@0.5–0.95 (%) | Params (M) | GFLOPs |
|---|---|---|---|---|---|---|---|
| Faster-RCNN | 91.4 | 84.9 | 87.5 | 89.7 | 42.5 | 41.4 | 134.0 |
| YOLOv5n | 88.2 | 79.6 | 83.2 | 84.4 | 41.1 | 2.2 | 5.8 |
| YOLOv5s | 90.9 | 86.4 | 88.3 | 90.7 | 42.8 | 7.8 | 18.7 |
| YOLOv5m | 91.1 | 87.7 | 89.2 | 91.3 | 43.4 | 22.1 | 52.5 |
| YOLOv8n | 86.6 | 79.7 | 82.4 | 83.4 | 40.9 | 2.7 | 6.8 |
| YOLOv8s | 87.8 | 86.8 | 87.1 | 89.1 | 42.3 | 9.8 | 23.4 |
| YOLOv8m | 92.5 | 88.3 | 90.4 | 92.5 | 43.5 | 23.2 | 67.4 |
| YOLOv9s | 92.5 | 89.1 | 89.1 | 90.5 | 41.9 | 6.0 | 22.1 |
| YOLOv9m | 92.4 | 89.8 | 91.1 | 92.6 | 43.7 | 17.0 | 60.0 |
| YOLO11n | 92.1 | 76.8 | 83.2 | 85.5 | 41.8 | 2.6 | 6.3 |
| YOLO11s | 90.3 | 83.8 | 86.5 | 88.7 | 42.7 | 9.4 | 21.3 |
| YOLO11m | 91.0 | 88.5 | 89.6 | 90.7 | 43.4 | 20.0 | 67.7 |
| RTDETR-r18 | 89.6 | 89.1 | 89.3 | 88.1 | 39.7 | 19.9 | 57.0 |
| RTDETR-r34 | 87.4 | 83.5 | 85.3 | 86.6 | 34.6 | 31.1 | 88.8 |
| FFCA-YOLO | 92.6 | 89.1 | 90.8 | 91.8 | 43.9 | 2.3 | 17.4 |
| VRF-RTDETR | 92.4 | 90.5 | 91.4 | 91.2 | 43.3 | 13.5 | 44.3 |
| EAS-DETR (ours) | 91.4 | 91.9 | 91.5 | 93.0 | 44.1 | 14.6 | 59.0 |
| Model | Validation | P (%) | R (%) | (%) | mAP@0.5 (%) | mAP@0.5–0.95 (%) |
|---|---|---|---|---|---|---|
| RTDETR-r18 | Fold 1 | 89.6 | 89.1 | 89.3 | 88.1 | 39.7 |
| Fold 2 | 89.1 | 88.4 | 88.7 | 87.5 | 39.2 | |
| Fold 3 | 89.8 | 88.9 | 89.4 | 87.8 | 39.4 | |
| Fold 4 | 89.2 | 88.5 | 88.8 | 87.6 | 39.1 | |
| Fold 5 | 89.4 | 88.8 | 89.1 | 87.9 | 39.5 | |
| Mean ± SD | 89.42 ± 0.28 | 88.74 ± 0.29 | 89.06 ± 0.30 | 87.78 ± 0.24 | 39.38 ± 0.24 | |
| EAS-DETR | Fold 1 | 91.4 | 91.9 | 91.5 | 93.0 | 44.1 |
| Fold 2 | 91.1 | 91.5 | 91.3 | 92.8 | 43.8 | |
| Fold 3 | 91.6 | 91.8 | 91.7 | 92.9 | 43.9 | |
| Fold 4 | 91.2 | 91.4 | 91.2 | 92.7 | 43.7 | |
| Fold 5 | 91.3 | 91.6 | 91.4 | 92.8 | 44.0 | |
| Mean ± SD | 91.32 ± 0.19 | 91.64 ± 0.21 | 91.42 ± 0.19 | 92.84 ± 0.11 | 43.90 ± 0.16 |
| Datasets | Model | P (%) | R (%) | (%) | mAP@0.5 (%) | mAP@0.5–0.95 (%) |
|---|---|---|---|---|---|---|
| PCB | RTDETR-r18 | 89.6 | 89.1 | 89.3 | 88.1 | 39.7 |
| EAS-DETR | 91.4 | 91.9 | 91.5 | 93.0 | 44.1 | |
| DeepPCB | RTDETR-r18 | 96.4 | 95.6 | 96.0 | 97.9 | 67.1 |
| EAS-DETR | 97.7 | 96.9 | 97.3 | 98.5 | 73.0 | |
| AI-TOD | RTDETR-r18 | 90.2 | 87.5 | 88.7 | 87.6 | 37.5 |
| EAS-DETR | 93.9 | 93.4 | 93.6 | 93.4 | 49.3 | |
| VisDrone-DET | RTDETR-r18 | 49.5 | 34.9 | 39.6 | 34.9 | 19.1 |
| EAS-DETR | 54.3 | 44.7 | 48.0 | 42.4 | 24.0 |
| No. | C2f-EC | ASAFI | SGO-FPN | P (%) | R (%) | (%) | mAP@0.5 (%) | mAP@0.5–0.95 (%) | Params (M) | GFLOPs | FPS |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 89.6 | 89.1 | 89.3 | 88.1 | 39.7 | 19.9 | 57.0 | 86.93 | |||
| 2 | ✓ | 91.1 | 89.8 | 90.4 | 90.1 | 41.1 | 12.8 | 42.9 | 107.04 | ||
| 3 | ✓ | 90.9 | 89.8 | 90.3 | 90.6 | 39.3 | 20.7 | 57.8 | 100.80 | ||
| 4 | ✓ | 91.2 | 89.7 | 90.4 | 91.3 | 42.7 | 20.2 | 64.6 | 90.74 | ||
| 5 | ✓ | ✓ | 91.3 | 86.3 | 88.7 | 90.8 | 43.1 | 13.7 | 43.8 | 74.89 | |
| 6 | ✓ | ✓ | 90.9 | 89.3 | 90.1 | 91.1 | 41.5 | 13.8 | 58.1 | 67.73 | |
| 7 | ✓ | ✓ | 91.0 | 89.3 | 90.1 | 90.4 | 40.3 | 21.0 | 65.5 | 72.80 | |
| 8 | ✓ | ✓ | ✓ | 91.4 | 91.9 | 91.5 | 93.0 | 44.1 | 14.6 | 59.0 | 70.05 |
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. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Yan, Y.; Wu, R.; Ren, J. EAS-DETR: An Enhanced Real-Time Transformer with Sparse Attention and Global Context for PCB Defect Inspection. Electronics 2026, 15, 1662. https://doi.org/10.3390/electronics15081662
Yan Y, Wu R, Ren J. EAS-DETR: An Enhanced Real-Time Transformer with Sparse Attention and Global Context for PCB Defect Inspection. Electronics. 2026; 15(8):1662. https://doi.org/10.3390/electronics15081662
Chicago/Turabian StyleYan, Yuxin, Ruize Wu, and Jia Ren. 2026. "EAS-DETR: An Enhanced Real-Time Transformer with Sparse Attention and Global Context for PCB Defect Inspection" Electronics 15, no. 8: 1662. https://doi.org/10.3390/electronics15081662
APA StyleYan, Y., Wu, R., & Ren, J. (2026). EAS-DETR: An Enhanced Real-Time Transformer with Sparse Attention and Global Context for PCB Defect Inspection. Electronics, 15(8), 1662. https://doi.org/10.3390/electronics15081662
