SHNet: A Lightweight Network Focusing on Shallow High-Resolution Features for PCB Defect Detection
Abstract
Automatic defect detection for printed circuit boards (PCBs) is crucial for manufacturing quality and reliability, yet remains challenging due to tiny defect sizes, low visual contrast, and deployment constraints. We propose SHNet, a lightweight YOLOv8s-based detector that emphasizes shallow high-resolution representations. Instead of relying on deep low-resolution features, SHNet removes the low-resolution detection head and uses the $16\times $ feature only as semantic guidance in the neck, reducing complexity while preserving fine structural cues. To enhance detection performance, we introduce three modules: the Multi-kernel Adaptive Module (MKAM) for scale-aware representation, the Spatial-Semantic Alignment Module (SSAM) for cross-layer feature alignment, and the Wavelet Enhancement Module (WEM) for strengthening weak defect responses in the frequency domain. Experiments show that SHNet improves mAP@0.5:0.95 by 9.1% and 20.8% over YOLOv8s on two datasets, respectively, while achieving a model size of only 2.3 MB with 87% fewer parameters and 56% fewer FLOPs. Code is available at https://github.com/Frieda73/SHNet