# Detecting Cracks in Aerated Concrete Samples Using a Convolutional Neural Network
## 3 Results and Discussion  
The model training graph is shown in Figure 5, where the ordinate shows the loss values, and the abscissa shows the various iterations. \begin{table}
\begin{tabular}{c c c} \hline
**Num** & **Parameter** & **Value** \\ \hline
1 & Number of photos in the training set & 2800 (70\%) \\ \hline
2 & Number of photos in the validation set & 800 (20\%) \\ \hline
3 & Number of photos in the test set & 400 (10\%) \\ \hline
4 & MiniBatchSize & 28 \\ \hline
5 & Number of epochs & 30 \\ \hline
6 & Number of iterations & 3000 \\ \hline
7 & Learning rate & 0.001 \\ \hline
8 & Solver & Adam solver \\ \hline \end{tabular}
\end{table} 
Table 1: Parameters for training the YOLOv4 convolutional neural network. Figure 4: YOLOv4 architecture. The loss function gives the error between the predicted and actual bounding box. The smaller the loss function, the better the trained network detects objects. To demonstrate the effectiveness of the developed algorithm for detecting cracks in aerated concrete samples, in this experiment, precision (\(P\)), recall (\(R\)), and average precision (\(AP\)) are used as model estimates. Precision and recall can be calculated using the formulas:  
\[\text{Precision }(P)=\frac{TP}{TP+FP} \tag{1}\]  
\[\text{Recall }(R)=\frac{TP}{TP+FN} \tag{2}\]  
Here, true positive (\(TP\)) is the correct detection made by the model;  
False positive (\(FP\)) is incorrect detection made by the detector;  
False negative (\(FN\)) is a true result missed (not detected) by the detector. To define \(AP\), an auxiliary metric called Intersection over Union (\(IoU\)) is needed. \(IoU\) is a good way to measure the degree of overlap between two bounding boxes--a predicted model and a real one. Schematically, the \(IoU\) calculation is shown in Figure 6, where the intersection area is divided by the union area between the true and predicted frames. \(AP@\alpha\) is the area under Precision-Recall Curve (AUC-PR) estimated at threshold \(\alpha\)_IoU_. The formula for the calculation is as follows:  
\[AP@\alpha=\int\limits_{0}^{1}P(R)\,dr \tag{3}\]  
Figure 5: Model training schedule. Figure 6: Computing the Intersection over Union. _AP@50_ and _AP@75_ values were calculated showing _AP_ values calculated at _IoU_ = 0.50 and _IoU_ = 0.75, respectively: _AP@50_ = 85% and _AP@75_ = 68%. Table 2 presents the main metrics characterizing the quality of the resulting model with the threshold values _IoU_ = 0.50 and _IoU_ = 0.75. Figure 6(a) or Figure 6(c) shows the input images, Figure 6(b) or Figure 6(d) shows the results of crack detection on aerated concrete samples using the YOLOv4 convolutional neural network. The results obtained meet the needs of the problems of detecting cracks in a building material and have practical applied value. Thus, creating our own empirical database of images of aerated concrete samples [47], training the model on our own data set obtained by simulating various shooting conditions, the rotation angle of object deformation, and light distortion using image processing methods, using our own augmentation algorithm to increase the number of images, and therefore, the expansion of the sample [48] made it possible to optimize the parameters of an intelligent model based on the YOLOv4 convolutional neural network, which has high precision in defect detection problems. The obtained precision of the model corresponds to the improved model (_AP_@50 = 84.06% and _AP_@75 = 67.85%) in [52]. It is also not inferior to the model for detecting cracks on the concrete surface proposed in [46] (76.4%) and exceeds the precision of the model for detecting and segmenting cracks on a surface with a random texture similar to marble (71.35%) [32]. This comparative analysis indicates the prospects of the developed model in the problems of defect detection, taking into account its subsequent improvement by expanding the training data set. Expanding the training sample by introducing additional shooting angles and lighting conditions, as well as a combination of various noises and effects, is planned.