DAM-Faster RCNN: few-shot defect detection method for wood based on dual attention mechanism

Sci Rep. 2025 Jul 2;15(1):22860. doi: 10.1038/s41598-025-05479-y.

Abstract

In wood defect detection, factors such as few-shot sample scarcity, diverse defect types, and complex background interference severely limit the model's recognition accuracy and generalization ability. To address the above issues, this paper proposes an improved Faster RCNN model based on a dual attention mechanism (DAM). The model integrates cross-attention and spatial attention modules to enhance the expression of key region features, suppresses texture noise interference; the improved Wood-Region Proposal Network (WRPs) module utilizes feature mean pooling and cross-layer fusion strategies to significantly improve the quality and robustness of candidate box generation; in addition, the Wood-Feature Reconstruction Head (WFRH) module effectively enhances the adaptability to new classes and few-shot defects through multi-branch classification and weighted fusion mechanisms. After synergistic optimization of all modules, the model demonstrates superior detection accuracy and category discrimination capability. Experimental results show that the proposed method achieves state-of-the-art performance on the PASCAL VOC and FSOD datasets, particularly in the identification of 17 types of wood defects, where AP50 and AP75 are improved by 25% and 7.9%, respectively, validating the significant advantages of the proposed DAM mechanism under few-shot and complex background conditions. The findings of this study provide practical technical references for intelligent and efficient few-shot detection in real-world wood quality inspection tasks.

Keywords: Cross-attention; Defect detection; Few-shot; Spatial attention; Wood.