## 4 Convolutional Neural Network
### Classification CNN
#### 4.1.3 Results  
By adopting an 80-20% training-test data ratio, there are 1280 training cases and 320 test cases for each of the six corrosion types. The classification results obtained from the proposed CNN model are summarized in Table 3. Table 3 demonstrates that the proposed model consistently achieves prediction accuracies higher than 0.93 in both the training and test datasets, with the lowest accuracy of 0.934 observed in the training dataset for \(\mathrm{G_{ex}}\). It is noted that the model performs better in the test dataset than the training dataset, with accuracy rates of each corrosion type in the test dataset higher than or equal to the rates in the training dataset. This may be due to the regularization techniques, such as dropout, adopted in the CNN model. Although these techniques can prevent overfitting, they may also introduce noise or uncertainty during training, which could temporarily degrade the model's performance on the training data while improving the generalization and performance on the test data [45]. Notably, 32 cases in the training dataset and one case in the test dataset have been misclassified, resulting in a misprediction rate of 0.34% (33/9600 = 0.34%), demonstrating the excellent accuracy of the developed model. Figure 8 illustrates the distribution of mispredictions in the training dataset across different categories. For instance, 65.6% (i.e., 21) of misclassified training cases belong to the \(\mathrm{G_{ex}}\) category. Among these, four cases are misclassified as \(\mathrm{P_{in}}\), and 17 cases are misclassified as \(\mathrm{P_{ex}}\). Furthermore, six out of the 33 cases have misclassified locations (internal/external surface of the pipe), i.e., two \(\mathrm{P_{ex}}\) cases misclassified as \(\mathrm{P_{in}}\), and four \(\mathrm{G_{ex}}\) cases misclassified as \(\mathrm{P_{in}}\). Note that the model achieves better classification accuracy for \(\mathrm{P_{in}}\), \(\mathrm{P_{ex}}\), \(\mathrm{PIC_{in}}\), and \(\mathrm{PIC_{ex}}\) than for \(\mathrm{G_{in}}\) and \(\mathrm{G_{ex}}\). The values of \(d_{g}/t\) included in the entire dataset for all six types of corrosions are 20, 30, 40, 60, and 80%, while the values of \(d_{p}/t\) included in the entire dataset are 20, 30, 40, 50, 55, 60, 70 and 80%. The wider range of the corrosion depth for cases involving pinholes (i.e., \(\mathrm{P_{in}}\), \(\mathrm{P_{ex}}\), \(\mathrm{PIC_{in}}\), and \(\mathrm{PIC_{ex}}\)) compared to the cases involving general corrosion (\(\mathrm{G_{in}}\) and \(\mathrm{G_{ex}}\)) allows the model to learn a richer set of features and variations associated with pinhole corrosion, making the model more adept at distinguishing between different types and severity of pinhole corrosion. All of the 28 misclassified cases in the \(\mathrm{G_{in}}\) and \(\mathrm{G_{ex}}\) categories involve relatively shallow corrosions, among which 26 cases have \(d_{g}/t\) = 20% and two cases have \(d_{g}/t\) = 40%. The distribution of the 28 misclassified cases by \(w_{g}/l_{g}\) is shown in Figure 9. Figure 9 indicates that the classification CNN model is less accurate for wide general corrosions with \(w_{g}/l_{g}\) larger than 1.67. It is also noteworthy that the developed model is less accurate for cases containing external corrosions (i.e., \(\mathrm{G_{ex}}\), \(\mathrm{P_{ex}}\), and \(\mathrm{PIC_{ex}}\)) than for cases involving internal corrosions (i.e., \(\mathrm{G_{in}}\), \(\mathrm{P_{in}}\), and \(\mathrm{PIC_{in}}\)). A potential explanation is that the model input (i.e., the MFL signal map) for external defects has less pronounced features because the variation in \(\mathbf{B}\) due to the metal-loss defect on the external pipe surface is smaller than that caused by the internal metal-loss defect as the external defect is farther away from the sensor than the internal defect. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**Category No. ** & **Category** & **Total** & **Train** & **Test** & \ \begin{tabular}{c} **Misprediction** \\ **in Train** \\ \end{tabular}  &