Abstract:To address the issues of small differences between defects and background,as well as large variations within the same class of defects in defect semantic segmentation tasks,this paper proposes a surface defect detection algorithm based on Lightweight Convolutional Block Attention Transformer,named LCBAFormer.The proposed algorithm aims to enhance the accuracy of segmentation for various types of defects.Firstly,a Lightweight Convolutional Block Attention Module (LCBAM) is designed,which integrates channel attention and spatial attention modules to extract effective channel and spatial information.This enables the model to focus more on local defect feature information,enhance feature differences between defects,and mitigate variations within the same category of defects.Secondly,a lightweight Semantic Injection Module (SIM) is introduced,which gradually fuses multi-scale feature information and thereby improving the network's ability to locate and distinguish different defects.The experimental results show that on the NEU-Seg steel strip defect dataset and the magnetic tile defect dataset (MT-Defect),the proposed algorithm achieves mean Intersection over Union (mIoU) of 84.75% and 79.46%,mean Recall (mRec) rates of 92.29% and 87.50%,and mean F1 scores (mF1) of 91.52% and 88.08%,respectively.Additionally,the algorithm exhibits low computational complexity,with 1.03 and 2.65 GFLOPs (billion floating-point operations per second) on the NEU-Seg and MT-Defect datasets,respectively.Compared to mainstream methods,the proposed algorithm features fewer parameters and superior segmentation results,achieving a good balance between parameter count and detection performance.