Enhanced CBAM-YOLOv5s for Concrete Crack Detection in Complex Environments Using Attention Mechanism and Spatial Brightness Adjustment Algorithm
摘要
Concrete cracks pose a significant threat to the structural health of buildings. However, due to their large quantity, wide distribution, and complex backgrounds, traditional manual crack monitoring methods often fail to detect cracks efficiently and accurately. To address this challenge, this study proposes an improved CBAM-YOLOv5s algorithm for concrete crack detection. The algorithm incorporates a channel and spatial dual attention mechanism (CBAM) and integrates an image preprocessing denoising method based on the HSV space brightness adjustment algorithm. By embedding the CBAM module into the traditional YOLOv5s framework, the proposed method enhances the representation of crack features. Comparative experiments with traditional YOLOv5s and YOLOv8s demonstrate that the CBAM-YOLOv5s achieves an average detection accuracy of 96.2% on a custom crack dataset, representing a 2-percentage-point improvement over YOLOv5s, with faster response times. In practical applications, to address uneven illumination issues that affect image quality, the HSV space brightness adjustment algorithm is employed for denoising preprocessing, effectively mitigating the impact of shadows on crack recognition. Ultimately, the inference time per image is 6–8 ms, meeting the requirements for real-time detection.