## 2 Materials and Methods
### Deep Learning Model Design  
A deep convolutional neural network based on the YOLOv2 framework was created in the Matlab Deep Learning Toolbox for automatic transverse crack detection. The network comprises a pair of subnetworks, a feature extraction network followed by a detection network. A pretrained convolutional neural network, ResNet-50, was used as a feature extractor, and transfer learning was applied to speed up the training process. The main advantage of transfer learning is skipping the time-consuming training steps where the learnable parameters (weights and biases) obtained from training the model over a large dataset are only fine-tuned to accommodate the network to classify a different target dataset. ResNet-50 is a variation of the residual network trained on more than one million images from the ImageNet database consisting of building (residual) blocks of convolutional layers with residual connections known as skip or shortcut connections. Through these connections, the input can skip the main branch of convolutional layers, providing a more straightforward path within the network, which helps to minimize the issue of vanishing gradients during the early stages of training. The residual blocks are then grouped into a stack and can be formally described:  
\[y_{l}(x,\ W) = f(h\left(x\right)+F(x,\ W)) \tag{1}\]  
where \(x\) is the input of the block, \(h\) is the shortcut function, \(F\) is the mapping carried out by a block of one or more consecutive convolutional layers, \(W\) is the weights of these convolutional layers, \(f\) is a Rectified Linear Unit (ReLU), and \(y\) is the mapping describing the residual block \(l\) as a function of the input \(x\) and the weights \(W\)[25]. The ResNet-50 architecture consists of an initial residual block followed by the basic residual blocks, also called bottleneck blocks, applied along the network. The initial block starts with the input layer of the image size of 224 \(\times\) 224 \(\times\) 3, followed by the convolutional layer. Convolution is a mathematical operation usually implemented as the cross-correlation function [26] and can be described as function \(S\) with filter (also called kernel) \(K\) over the two-dimensional image \(I\):  
\[S(i,\ j)=(I\ \times\ K)(i,\ j)=\sum_{m}\sum_{n}I(i+m,\ j+n)\ K(m,\ n) \tag{2}\]In machine learning terminology, the function \(S\) is referred to as a feature map. The first convolutional layer uses 64 filters of \(7\times 7\) pixels with a stride of 2, and thus produces 64 feature maps with half the lateral size of the input image. The features are then regularized through a batch normalization layer that performs the standardization of the input corresponding to the subtraction of the mean of the batch and the division by the standard deviation. A batch normalization layer independently normalizes a mini-batch of data for each channel across all observations, and the convolutional neural network is trained faster. The convolutional and batch normalization layers continue with a non-linearity by applying an activation function. The activation function is designed to resemble the behavior of real neurons and performs a non-linear transformation of the feature map, providing the input for the next convolutional layer. The widespread ReLU was used as an activation function. The ReLU function \(f\) returns the same value if the input \(x\) is positive and zero if the value is negative or null:  
\[f(x)= \begin{cases}x,&x>0\\ 0,&x\leq 0\end{cases} =max(0,\ x) \tag{3}\]  
The ReLU function rectifies the vanishing gradient problem and guarantees a high computation efficiency thanks to simple mathematical operations [27]. The initial residual block ends with a pooling layer, which reduces the spatial size of the convolved features and decreases the computational power to process the data. The ResNet-50 uses a max pooling layer returning the maximum value from the portion of an image covered by the \(3\times 3\) filter with a stride of 2.