## 4 Detecting Chalking Position by Photographing and Analyzing Wall Surfaces
### Chalking-Position Detection Model
#### 4.2.2 Training  
As mentioned previously, in the present study, we aimed to detect the chalked areas of damage. Figure 3 shows an example of the photograph data used for training. We created a dataset for training and validation using a total of 3125 images of actual tunnels captured in 2016, 2017, and 2020. As shown in Figure 4, photographs were taken of the Fusa shield section No. 1 route (first headache) in 2016, the underground pipe section (second headrace) in 2017, and the Fusa shield section No. 2 route (first headache) in 2020. Therefore, the images were captured at different locations. Additionally, as shown in Figure 3, some images had multiple chalking positions. The total amount of data for each type of label used as training and validation data is presented in Table 1. No previous studies have involved the detection of chalked areas in headrace tunnels; however, in previous studies involving the detection of cracks in concrete structures, the number of data used for learning and validation ranged from several hundred to several tens of thousands ([PERSON] et al., 2014; [PERSON] et al., 2014; [PERSON] et al., 2014). Moreover, a wide variety of detection methods were employed, such as CNNs, encoder-decoder networks, segmentation, and object detection ([PERSON] et al., 2014; [PERSON] et al., 2014). In this study, YOLOv7--the object-detection method described above--was employed because the area marked with chalk was rectangular, and in contrast to cracks, the object to be detected was not continuous. The data generated in this manner were used to train YOLOv7. In the present study, of the 3125 chalking positions, 2479 positions--80% of the total, excluding the test data--were used as the training data, and the other 20%--totaling 614 positions--were used as the validation data. The corresponding numbers of images were 415 and 145, respectively. The image size was 2528 pixels \(\times\) 2528 pixels. An Nvidia GeForce RTX 3060 graphics processing unit was used for the training. The learning rate was set to 0.01, and stochastic gradient descent was adopted as the optimization method. The batch size was set to 2, and the amount of training data per epoch was set to be the same as the number of training data prepared. A total of 1000 training epochs were conducted. Figure 5 presents the losses of training data and validation data for each epoch. As shown, the loss decreased as the training progressed. If the number of training data is too small or the number of epochs is too large, overtraining may occur. When overtraining occurs, the loss of validation data often increases. As indicated by Figure 5, the training conducted in this study did not show signs of overtraining, and the training was conducted appropriately. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Class** & \multicolumn{2}{c}{**Number of Data**} & \multicolumn{2}{c}{**Example Images for Class**} \\ \hline White chalking position & 2479 & 614 \\ (Pitting corrosion: \textless{}3 mm) & 415 images & 145 images \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Training and validation data. Figure 4: Outline of the plan for extending the service life of the Kita–Chiba headrace tunnel. The accuracy of the trained model was tested using 415 images not present in the training data. In this study, the threshold for confidence, which indicates whether the bounding box used for detection contains an object, was set as 0.25. Mean average precision (mAP) is commonly used as an accuracy evaluation index in object detection [30; 34]. The mAP depends on the intersection over union (IoU), which is set at the time of validation, and the mAP value corresponding to IoU = 0.5 is often used. The mAP is the average value obtained by calculating the average precision (AP) for each type of object, but the only objects targeted for detection in this study were the corrosion positions; thus, the calculated AP value was used for evaluation as-is. We obtained AP = 0.9353 when the generally used IoU = 0.5 was set.