## 4 Results  
This study proposed an intelligent system based on CNN for detecting humidity in the red walls of historical buildings. In this study, two CNN models were trained for recognizing red walls and identifying the areas of walls that contained moisture. This study \begin{table}
\begin{tabular}{c c} \hline \hline
**CNN Hyperparameter** & **Value** \\ \hline Initial learning rate & 0.0001 \\ MaxEpoch & 100 \\ Batchsize & 70 \\ ValidationFrequency & 25 \\ LearnRateDropPeriod & 2 \\ LearnRateDropFactor & 0.00001 \\ Shuffle & Every epoch \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Hyperparameter settings used in this study. Figure 9: Overall moisture detection process. combined two CNN models and evaluated their results. To fairly evaluate the training results of the models, this study used _Accuracy_, _Precision_, _Recall_, and _F1 score_ as evaluation metrics, with their formulas shown in Equations (1)-(4). \[Accuracy=\frac{TP+TN}{TP+FP+FN+TN} \tag{1}\]  
\[Precision=\frac{TP}{TP+FP} \tag{2}\]  
\[Recall=\frac{TP}{TP+FN} \tag{3}\]  
\[F1\ score=\frac{2\times Precision\times Recall}{(Precision+Recall)} \tag{4}\]  
K-fold cross-validation partitions the dataset multiple times into training and validation subsets, thereby reducing the risk of evaluation bias caused by a single random split. This approach enhances the reliability and stability of a model's performance. To obtain more consistent and representative evaluation results, 5-fold cross-validation was adopted in this study. In this study, AlexNet, GoogLeNet [25], and InceptionV3 [26] were individually tested for detecting red walls from visible image and detecting moisture using thermal images, and their average accuracies are shown in Tables 5 and 6. Based on the results in Tables 5 and 6, AlexNet consistently demonstrated superior performance in both red wall and moisture detection. Accordingly, it was chosen as the classification model for this study. Furthermore, the overall system performance was evaluated using 100 pairs of thermal and visible images. After image preprocessing, the thermal images were processed by the moisture detection CNN model, and the visible images were processed by the red wall detection CNN model. The outputs from both models were integrated to produce the final results. The overall system achieved an accuracy of 91.18%. A comparative performance analysis with other methods is presented in Table 9. In this evaluation, 100 images were used to perform moisture detection using three approaches: a manual method, the methods from references [27; 28], and the proposed method in this study. The corresponding accuracy and processing time were recorded. The manual method required personnel with professional expertise to conduct the analysis. Although it achieved a high accuracy of 100%, it took approximately 1200 times longer than the proposed method. Compared to the method in [27], our approach demonstrated superior performance in both accuracy and computational efficiency. As the method in [28] also employed CNN-based detection, the difference in processing time between our method and theirs was relatively small. The schematic results of this study are shown in Figure 10. It input the images, which were divided into 12 blocks, and performed labeling and detection on each block individually. It separately used two CNN models for detecting red walls and detecting moisture, as shown in Tables 10 and 11. When both the red wall detection and moisture detection results were above 50%, this method labeled the area as a water-containing area of the red wall on the thermal image. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **Accuracy (\%)** & **Precision (\%)** & **Recall (\%)** & **F1 Score (\%)** \\ \hline
1-fold & 95.7 & 95 & 96 & 95 \\
2-fold & 91.49 & 91 & 91 & 91 \\
3-fold & 91.49 & 91 & 90 & 91 \\
4-fold & 96.17 & 86 & 84 & 85 \\
5-fold & 93.55 & 93 & 93 & 93 \\ Average & 93.68 & 91.2 & 90.8 & 91 \\ \hline \hline \end{tabular}
\end{table}