SCFNet: A structure-aware and contrast-enhanced collaborative few-shot industrial defect detection method
摘要
Surface defect detection in gastroscope tubes is crucial for the manufacturing of endoscopic devices, yet it remains challenging in practice due to sample scarcity, complex defect morphologies, and ambiguous local feature representations. To address these issues, this paper proposes a structure-aware contrastive learning–driven few-shot defect detection framework. The core component is a Structure-Aware Enhancement Network, which strengthens structural discrimination through horizontal/vertical orientation modeling and cross-scale interaction, enabling the model to better distinguish defects with locally similar textures but different semantics. During fine-tuning, a Dynamic Multi-Scale Attention module is incorporated into the P3 and P4 feature levels to improve responsiveness to slender, strip-like regions. Experiments conducted on a private real-world gastroscope-tube defect dataset—covering five defect types (black spots, stains, bumps, cracks, and scratches) under {1, 3, 5, 10}-shot settings—demonstrate the effectiveness of the proposed method. The framework excels at distinguishing locally similar defects, such as black spots and bumps, and shows superior performance on slender, low-contrast defects, such as scratches. Under the 10-shot setting, it achieves 92.6% mean average precision and 94.2% average precision at 50% IoU, surpassing the strongest baseline by 2.9 and 2.0 percentage points, respectively, thereby validating its effectiveness in few-shot scenarios.