# Crack Detection of Concrete Based on Improved CenterNet Model
## 2 CenterNet  
The CenterNet algorithm is a single-stage model without an anchor frame that was first proposed in 2019 [27]. The CenterNet algorithm has the characteristics of high precision, fast training speed, and a simple network structure. The principle of the CenterNet model is as follows: the center point of the target is used to replace the anchor frame, the peak value of the thermal map is used as the center point of the detection object, the threshold is then set for screening and comparison of the target center point, and, finally, the category information is obtained via regression using the image features [28]. The training process of CenterNet does not need to consider the anchor mechanism, nor does it need to set or postprocess hyperparameters in advance, significantly reducing the computational load on the entire network [29].  
The original CenterNet uses ResNet18, DLA-34, and Hourglass convolutional networks for feature extraction and then transfers the feature map to the detection module for processing. Finally, the target centre point and category, target length and width prediction, and centre point bias are transferred through the convolution operation. A schematic of the CenterNet algorithm is shown in Figure 1.  
The CenterNet algorithm model makes predictions through three convolution blocks: target centre point and category, target length and width prediction, and centre point bias. The loss function of the CenterNet algorithm consists of the loss function of the centre point and classification, loss function of the target frame size, and loss function of the centre point bias [31].  
Figure 1: Schematic diagram of CenterNet algorithm model [30].  
The loss function \(L_{k}\) of the centre point and classification is the focal loss function, and the calculation formula is shown in Equation (1) [32].  
\[L_{k}=-\frac{1}{N}\underset{xyc}{\sum}\left\{\begin{array}{l}(1-\hat{Y}_{xyc})^ {a}lg\ (\hat{Y}_{xyc}),\ Y_{xyc}=1\\ (1-\hat{Y}_{xyc})^{\beta}(\hat{Y}_{xyc})^{a}\times lg\ \ (g-\hat{Y}_{xyc}),\\ \text{others}\end{array}\right. \tag{1}\]  
In the above formula, the subscript k in the centre point and classification loss function \(L_{k}\) represent the kth input image, \(N\) represents the number of keypoints in the image, subscript \(xyc\) represents the positive and negative samples of the image, and \(Y_{xyc}\) represents the label of the true value.  
The centre point bias loss function \(L_{offset}\) adopts the \(L_{loss}\) function, and the calculation formula is shown in Equation (2) [33]:  
\[L_{offset}=\frac{1}{N}\underset{p}{\sum}\left|\hat{O}_{\widetilde{p}}-(\frac{ p}{R}-\widetilde{P})\right| \tag{2}\]  
In the above formula, \(P\) is the coordinate of the true value of the original image target, and R is the subsampling multiple.  
The \(L_{loss}\) function is used for the target frame size loss function \(L_{size}\). The calculation formulas are shown in Equation (3) [34], where \(S_{k}\) represents the size of the original target frame.  
\[L_{size}=\frac{1}{N}\underset{k=1}{\sum}\left|\hat{S}_{pk}-S_{k}\right| \tag{3}\]  
The final loss function was obtained by multiplying the loss function of the centre point by the classification, the loss function of the target frame size, and the loss function of the centre point bias by the corresponding coefficients, as shown in Equation (4). \(L_{k}\) represents the central point loss function, \(L_{size}\) represents the the size loss function, and \(L_{off}\) represents the offset loss function; the setup is \(\lambda_{size}=0.1\) and \(\lambda_{off}=1\).  
\[L=L_{k}+\lambda_{size}L_{size}+\lambda_{off}L_{off} \tag{4}\]