# A Rapid Bridge Crack Detection Method Based on Deep Learning
## 2 Materials and Methods
### The Architecture of YOLOv5  
YOLOv5 is an efficient target detection algorithm [37]. Similar to previous generations of Yolo algorithms, YOLOv5 adopts the concept of grids, that is, the image is divided into multiple meshes, each of which is responsible for predicting one or more objects. Each grid can produce prediction boxes (i.e., anchor), and templates for three prediction boxes are generally pre-stored. The anchor has a preset width, height, coordinates, and confidence level. The confidence level indicates the probability that an object is present in the mesh. When the mesh in which anchor is located has objects, the confidence level is 1, and vice versa is 0. If we regard the difference between the width and height of anchor and the difference of coordinates as losses, and the binary cross entropy as a loss of confidence, then the problem of target detection will be greatly simplified into a simple regression prediction and classification problem. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer** & **Output Shape** & **Parameter** \\ \hline Reshape\_1 & (1 \(\times\) 1 \(\times\) 100) & 0 \\ Conv2D\_transpose\_1 & (4 \(\times\) 4 \(\times\) 1024) & 1,639,424 \\ BN\_1 & (4 \(\times\) 4 \(\times\) 1024) & 4096 \\ Activation\_1 & (4 \(\times\) 4 \(\times\) 1024) & 0 \\ Conv2D\_transpose\_2 & (8 \(\times\) 8 \(\times\) 512) & 8,389,120 \\ BN\_2 & (8 \(\times\) 8 \(\times\) 512) & 2048 \\ Activation\_2 & (8 \(\times\) 8 \(\times\) 512) & 0 \\ Conv2D\_transpose\_3 & (16 \(\times\) 16 \(\times\) 256) & 2,097,408 \\ BN\_3 & (16 \(\times\) 16 \(\times\) 256) & 1024 \\ Activation\_3 & (16 \(\times\) 16 \(\times\) 256) & 0 \\ Conv2D\_transpose\_4 & (32 \(\times\) 32 \(\times\) 128) & 524,416 \\ BN\_4 & (32 \(\times\) 32 \(\times\) 128) & 512 \\ Activation\_4 & (32 \(\times\) 32 \(\times\) 128) & 0 \\ Conv2D\_transpose\_5 & (64 \(\times\) 64 \(\times\) 64) & 131,136 \\ BN\_5 & (64 \(\times\) 64 \(\times\) 64) & 256 \\ Activation\_5 & (64 \(\times\) 64 \(\times\) 64) & 0 \\ Conv2D\_transpose\_6 & (128 \(\times\) 128 \(\times\) 32) & 32,800 \\ BN\_6 & (128 \(\times\) 128 \(\times\) 32) & 128 \\ Activation\_6 & (128 \(\times\) 128 \(\times\) 32) & 0 \\ Conv2D\_transpose\_7 & (256 \(\times\) 256 \(\times\) 1) & 513 \\ Activation\_7 & (256 \(\times\) 256 \(\times\) 1) & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The complete network structure of the generator. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer** & **Output Shape** & **Parameter** \\ \hline Conv2D\_1 & (128 \(\times\) 128 \(\times\) 64) & 1088 \\ BN\_1 & (128 \(\times\) 128 \(\times\) 64) & 256 \\ Leaky Relu\_1 & (128 \(\times\) 128 \(\times\) 64) & 0 \\ Conv2D\_2 & (64 \(\times\) 64 \(\times\) 128) & 131,200 \\ BN\_2 & (64 \(\times\) 64 \(\times\) 128) & 512 \\ Leaky Relu\_2 & (64 \(\times\) 64 \(\times\) 128) & 0 \\ Conv2D\_3 & (32 \(\times\) 32 \(\times\) 256) & 524,544 \\ BN\_3 & (32 \(\times\) 32 \(\times\) 256) & 1024 \\ Leaky Relu\_3 & (32 \(\times\) 32 \(\times\) 256) & 0 \\ Conv2D\_4 & (16 \(\times\) 16 \(\times\) 512) & 2,097,664 \\ BN\_4 & (16 \(\times\) 16 \(\times\) 512) & 2048 \\ Leaky Relu\_4 & (16 \(\times\) 16 \(\times\) 512) & 0 \\ Conv2D\_5 & (8 \(\times\) 8 \(\times\) 1024) & 8,389,632 \\ BN\_5 & (8 \(\times\) 8 \(\times\) 1024) & 4096 \\ Leaky Relu\_5 & (8 \(\times\) 8 \(\times\) 1024) & 0 \\ Conv2D\_6 & (4 \(\times\) 4 \(\times\) 1) & 16,385 \\ Flatten\_1 & 16 & 0 \\ Dense\_1 & 1 & 17 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The complete network structure of discriminator. Figure 3 shows the YOLOv5 architecture used in this study. YOLOv5 mainly consists of Backbone network, Neck network and Head network. The Backbone part is mainly used for feature extraction and continuous reduction of feature map. The fusion of shallow graphic features and deep semantic features is performed by Neck network and the Head network is the classifier and regressor of YOLOv5. The main modules of YOLOv5 include Focus, CBL, CSP1_X, CSP2_X and SPP.