## 5 Results and Discussion  
### Length Measurement Results and Discussion  
In this work, the designed CNN model was achieved in TENSORFLOW (Version 1.12.0, Google, Amphitheatre Pkwy, Mountain View, CA, USA) on a desktop with an intel core-i5 9400 CPU, 16 GB of RAM, and a 256 GB SSD. The deep learning model was trained for 10,000 iterations. The initial learning rate was set to 0.01, which decays by 0.001 every 100 iterations to avoid gradient disappearance caused by an excessive learning rate. The batch size was 100 and the training error was recorded every 100 iterations; the designed network achieved good convergence at 8000 iterations. Performance of the CNN model trained was evaluated on the testing dataset. The accuracy achieved on the testing dataset for the network was 99.23%, while the performance on the training dataset was also estimated and the achieved result was 99.68%. It was observed that the accuracy on the training dataset was slightly higher than that on the testing dataset. This is methodologically normal, since, for a network it, is better at identifying the seen samples. Anyway, the accuracy of the model is considerable. However, even an accurate A-scan identification is of little significance without the context from its surrounding area, since the sizing, estimation and decision-making of a defect is not only dependent on a single A-scan but the A-scans in a certain abnormal area. Figure 9, further, shows that the classification results of two tested specimens vary with the spatial position of the probe, where 0 denotes non-defect A-scan and 1 denotes defect A-scan. It can clearly be seen that the defect areas in both Joint1 and Joint2 have been well identified. It is worth noting that recognition results at the edge of some defects float back and forth between 0 and 1, e.g., part of the defects (D4 and D5) in Joint1, and almost all defects (D2, D3, D4, and D5) in Joint2. This may result from a low signal-to-noise ratio in the ultrasonic data, making the boundary between classes blurred. So, the features extracted from the signals at the edge of the defect by the proposed CNN can bebetween that of non-defect and defect, which leads to difficult decision-making for the CNN. This instability at the edge of the defect is exacerbated in Joint2, further confirming this suspicion. From the B-scan image in Figure 8b, the defect signal is so weak that it is barely distinguishable to the naked eye. Despite the slight instability, the CNN accurately identified the defect areas. Length of the defect can be automatically measured by the connected region solution algorithm based on the classification results corresponding to the probe positions. This algorithm can extract the non-zero regions of a binarized sequence. The classification results shown in Figure 9 constitute the sequence. Nonetheless, the instability mentioned above will affect the automatic process, which can make the algorithm mistake a small floating area at the edge of the defect for a small flaw. This drawback can be solved by setting a minimum size of the region. When the size of the connected region is greater than this size, it is extracted. Since the instability is random, the minimum size can be set to 1. Hence, the length of defect is obtained automatically, as listed in Table 3.  
Figure 9: The classification results of two tested specimens in the space of the probe positions: (**a**) the results of Joint1; (**b**) the results of Joint2. To evaluate the measurement performance of this deep learning model, the length values measured by it were compared with the designed values. Figure 10 shows the comparison results, where (a) and (b) are, respectively, the comparisons of Joint1 and Joint2, and (c) and (d) are, respectively, the deviations from the designed values corresponding to Joint1 and Joint2. It can be seen from Figure 10a,b that the measured values of defects in the two tested joints are both close to the designed values. The deviation of Joint1 is between \(-\)0.040 and +0.080, and the mean deviation is \(\pm\)0.074.