Detecting minute defects, such as spurs on the surface of a Printed Circuit Board (PCB), is extremely challenging due to their small size (average size < 20 pixels), sparse features, and high dependence on circuit topology context. The original Mosaic data augmentation method faces significant challenges with semantic adaptability when dealing with such tasks. Its unrestricted random cropping mechanism easily disrupts the topological structure of minute defects attached to the circuits, leading to the loss of key features. Moreover, a splicing strategy without domain constraints struggles to simulate real texture interference in industrial settings, making it difficult for the model to adapt to the complex and variable industrial inspection environment. To address these issues, this paper proposes a Context-aware and Domain-consistent Mosaic (CD-Mosaic) augmentation algorithm. This algorithm abandons pure randomness and constructs an adaptive augmentation framework that synergizes feature fidelity, geometric generalization, and texture perturbation. Geometrically, an intelligent sampling and dynamic integrity verification mechanism, driven by “utilization-centrality”, is designed to establish a controlled sample quality distribution. This prioritizes the preservation of the topological semantics of dominant samples to guide feature convergence. Meanwhile, an appropriate number of edge-truncated samples are strategically retained as geometric hard examples to enhance the model’s robustness against local occlusion. For texture, a dual-granularity visual perturbation strategy is proposed. Using a homologous texture library, a hard mask is generated in the background area to simulate foreign object interference, and a local transparency soft mask is applied in the defect area to simulate low signal-to-noise ratio imaging. This strategy synthesizes visual hard examples while maintaining photometric consistency. Experiments on an industrial-grade PCB dataset containing 2331 images demonstrate that the YOLOv11m model equipped with CD-Mosaic achieves a significant performance improvement. Compared with the native Mosaic baseline, the core metrics mAP@0.5 and Recall reach 0.923 and 86.1%, respectively, with a net increase of 8.3% and 8.8%; mAP@0.5:0.95 and APsmall, which characterize high-precision localization and small target detection capabilities, are improved to 0.529 (+3.0%) and 0.534 (+3.3%), respectively; the comprehensive metric F1-score jumps to 0.903 (+6.2%). The experiments prove that this method effectively solves the problem of missed detections of industrial minute defects by balancing sample quality and detection difficulty. Moreover, the inference speed of 84.9 FPS fully meets the requirements of industrial real-time detection.
Lai et al. (Wed,) studied this question.