# Lightweight Crack Automatic Detection Algorithm Based on TF-MobileNet
## 3 Crack Detection Method Based on TF-MobileNet  
### Network Structure  
In this study, we considered the characteristics of difficult deployment and slow inference speed of large-scale crack detection networks in practical engineering applications. We designed a lightweight network backbone, MobileNetV3 [27], combined with Bottleneck Transformer [28] for the crack feature extraction network. The aim was to satisfy the crack detection accuracy while being easily deployable to edge devices for real-time crack detection.  
The MobilenetV3 model is a renowned lightweight architecture that combines the depthwise separable convolutions from MobilenetV1 [29] with the Inverted Residuals, Linear Bottleneck, and SE (Squeeze-and-Excitation) modules from MobilenetV2 [30]. MobilenetV3 has not only enhanced the model's precision but also significantly decreased the inference time of the network compared to the previous two versions. In MobilenetV3, group convolution is utilized to decrease the network's computational complexity, with the number of groups equal to the number of channels in the network, effectively minimizing computation. Afterward, a \(1\times 1\) convolution is used to merge the channels. MobilenetV3 introduces the Bottleneck structure and the SE attention mechanism module, which automatically derive the significance of individual feature channels, promoting useful features and suppressing less useful ones. The intricate background and variability in pavement cracking characteristics pose a challenge, so we incorporated the Transformer structure in the backbone network to improve MobileNetV3. The multi-head Attention and Self-Attention of the Transformer enable the feature extraction network to increase focus on crack characteristics, enhancing the baseline for crack detection. In the feature fusion, we used Feature Pyramid Networks (FPN) as well as Path Aggregation Networks (PAN) [31]. Under the condition that the shallow location information did not affect the deep features, to augment feature representation at different scales, we integrate rich semantic information with superficial location details. We also incorporated the attention mechanism during the phase of feature fusion, and to make the model lightweight, we chose the SimAM [32] Parameter-free attention mechanism module. The incorporation of the attention mechanism made the model highlight the crack features and enhance the fusion effect. Finally, wechose Complete IoU Loss (CIoU) [33] as our localization loss function and Binary Cross Entropy Loss (BCELoss) as our classification loss function.  
Figure 1 depicted the detailed network architecture. The structural designs include a feature extraction network based on MobileNetV3. MobileNetV3 introduces Transformer architecture and SE (Squeeze-and-Excitation) attention mechanism modules, which automatically infer the importance of each feature channel. These mechanisms enhance the useful features while suppressing less relevant ones, allowing the TF-MobileNet feature extraction network to efficiently and quickly extract information from images. In the head section, the paper combines Feature Pyramid Network (FPN) and Path Aggregation Network (PAN) for feature fusion, which improves detection performance across various scenarios. Additionally, the C2f module from YOLOv8, SimAM attention mechanism, and Head-Attention module are incorporated to help TF-MobileNet generate better feature maps. The generated three feature maps have dimensions of 80 \(\times\) 80 \(\times\) 256, 40 \(\times\) 40 \(\times\) 256, and 20 \(\times\) 20 \(\times\) 512, respectively. For example, the 20 \(\times\) 20 \(\times\) 512 feature map can be understood as having 20 \(\times\) 20 pixels, with each pixel containing 512 pieces of information. Finally, image prediction is performed. Figure 1 clearly illustrates how these components are integrated into the entire network.