A Novel Pipeline Corrosion Monitoring Method Based on Piezoelectric Active Sensing and CNN

In this study, a piezoelectric active sensing-based time reversal method was investigated for monitoring pipeline internal corrosion. An effective method that combines wavelet packet energy with a Convolutional Neural Network (CNN) was proposed to identify the internal corrosion status of pipelines. Two lead zirconate titanate (PZT) patches were pasted on the outer surface of the pipeline as actuators and sensors to generate and receive ultrasonic signals propagating through the inner wall of the pipeline. Then, the time reversal technique was employed to reverse the received response signal in the time domain, and then to retransmit it as an excitation signal to obtain the focused signal. Afterward, the wavelet packet transform was used to decompose the focused signal, and the wavelet packet energy (WPE) with large components was extracted as the input of the CNN model to rapidly identify the corrosion degree inside the pipeline. The corrosion experiments were conducted to verify the correctness of the proposed method. The occurrence and development of corrosion in pipelines were generated by electrochemical corrosion, and nine different depths of corrosion were imposed on the sample pipeline. The experimental results indicated that the classification accuracy exceeded 99.01%. Therefore, this method can quantitatively monitor the corrosion status of pipelines and can pinpoint the internal corrosion degree of pipelines promptly and accurately. The WPE-CNN model in combination with the proposed time reversal method has high application potential for monitoring pipeline internal corrosion.


Introduction
Pipelines are the main choice for long-distance transportation of a large number of petroleum products and natural gas due to their high security, strong transmission capacity, low operating costs, and other advantages [1]. However, pipelines are faced with various threats, among which inner wall corrosion is one of the serious threats [2][3][4]. Rupture, leakage, and other problems caused by pipeline inner wall corrosion will lead to property loss and environmental pollution, and even endanger human life [5]. Therefore, it is of great practical significance and economic value to investigate the internal corrosion of pipelines through continuous and regular observations [6,7].
Traditional non-destructive testing methods (NDT) for pipeline corrosion include visual inspection, magnetic flux leakage detection, eddy current detection, ultrasonic tomography, and X-ray technology [8][9][10][11][12]. Visual inspection relies on the expertise of inspectors, and thus, its reliability of results is not guaranteed. Magnetic flux leakage detection requires magnetization of the pipeline, and far-field eddy current detection depends on the formation of eddy currents in the pipeline, thus, they are only appropriate for detecting ferromagnetic materials and conductive materials. These two detection unknown working conditions or application scenarios [37]. The Convolutional Neural Network (CNN) is one of the representative algorithms of deep learning, which can automatically extract waveform features and can learn inherent features of signals to perform more accurate classification and identification of fault diagnosis [10]. In recent years, CNNs have shown great potential in structural damage identification. Yang et al. proposed a vision-based automated method for the identification of the surface condition of concrete structures, which consisted of state-of-the-art pre-trained CNNs, transfer learning, and decision-level image fusion [38]. The proposed method was capable of accurately pinpointing the crack profile with wrong predictions of limited areas. Yang et al. improved the bird swarm algorithm to optimize the two-dimensional CNN, and the improved algorithm exhibited great performance in predicting the torsional strength of reinforced concrete (RC) beams [39]. Guo et al. developed a hierarchical CNN that extracted features automatically from raw vibration data and diagnosed bearing faults plus severity at the same time [40]. Peng et al. put forward a deeper residual one-dimensional CNN for adaptively learning fault features of the original vibration signal and obtained very high diagnostic accuracy for the fault diagnosis of wheelset bearings in high-speed trains [41]. However, if a CNN is used directly to classify original signals, the training of CNNs will become very challenging as the size of the original signal dataset increases. This will also give rise to an increase in training time and a higher requirement for model structure [42].
In this paper, a novel pipeline corrosion monitoring method based on wavelet packet energy (WPE) and CNN is proposed, which is denoted as WPE-CNN. Compared with other diagnostic methods, wavelet packet transform can continue to decompose the highfrequency components that are not decomposed by wavelet transform and extract the high-frequency features of the signal. Through this approach, the division of the signal in the full frequency band range is realized, and a more refined analysis of the signal is obtained [43]. The characteristic information of the original signal exists in each sub-band signal, and the signal characteristics can be further extracted by analyzing and determining the energy of each band. By using the sub-band energy obtained after wavelet packet decomposition as the input of the CNN model, the size of the data samples will also be diminished by a large proportion, thus reducing the complexity of the CNN model. Therefore, the WPE-CNN can not only further extract features and improve the accuracy of classification and recognition but also can greatly reduce the complexity of the CNN model and improve the efficiency of model training.
The piezoelectric active sensing with time reversal is utilized in this paper to quantitatively monitor the internal corrosion of pipelines. The specific arrangement of the experiment is as follows: First, the pipeline is corroded to different depths by electrochemical corrosion. After different corrosion depths on the PZT, the focused signal is collected by the time reversal method and is decomposed into sub-band energy by the wavelet packet. Then, a CNN is employed to convolve the wavelet packet energy, and the pipelines with different corrosion degrees are identified according to the output matrix. The rest of this paper is organized as follows: Section 2 explains the monitoring principle of the time reversal method and the classification principle of pipeline internal corrosion degree based on wavelet packet energy and the CNN model. Section 3 describes the experimental equipment, procedures, and results. Section 4 discusses the experimental results and compares them with other identification models. Section 5 summarizes and assesses the proposed method.

Time Reversal Technology
In applications, pipes usually work in a high-noise environment. Therefore, how to eliminate noise is the focus of pipeline corrosion monitoring. Time reversal can form a focus in a specific space and effectively improve the signal-to-noise ratio [44]. Therefore, the piezoelectric combined with the time reversal method can be used to monitor pipeline corrosion well. In this paper, two piezoelectric ceramic patches, labeled PZT1 and PZT2,

Time Reversal Technology
In applications, pipes usually work in a high-noise environment. Therefore, how to eliminate noise is the focus of pipeline corrosion monitoring. Time reversal can form a focus in a specific space and effectively improve the signal-to-noise ratio [44]. Therefore, the piezoelectric combined with the time reversal method can be used to monitor pipeline corrosion well. In this paper, two piezoelectric ceramic patches, labeled PZT1 and PZT2, installed on the surface of the pipeline, are used as actuators and sensors, as shown in Error! Reference source not found.. Figure 1. Time reversal process.
In the first step, the excitation signal generated by PZT1 is expressed as x(t) = Bδ(t). The corresponding pulse response function from PZT1 to PZT2 is expressed as h (t). Then the response signal of PZT2 is where B is the coefficient of the amplitude of the excitation pulse signal. Then, in the second step, the response signal is reversed in the time domain: Then, the reversed signal y1(−t) is applied to PZT1 as excitation again, and the focused signal y2(t) of PZT2 is where Rh(t) is the autocorrelation function of h(t).
According to the property of the autocorrelation function, when t = 0, the autocorrelation function Rh(t) has the maximum value: According to the above derivation and analysis, the spectrum of the autocorrelation function is the square of the spectrum of the original function. That is, after time inversion, the difference between the signal spectrum will be amplified, and the signal features will be easier to extract.

WPE-CNN Operating Principle
The method combining WPE and CNN proposed for pipeline corrosion identification mainly includes signal energy feature extraction and CNN classification. The structure of the method is shown in Error! Reference source not found.
First, the focused signals acquired by PZT2 after time reversal are decomposed into wavelet packets to obtain the energy characteristics of different frequency bands. Then, In the first step, the excitation signal generated by PZT1 is expressed as x(t) = Bδ(t). The corresponding pulse response function from PZT1 to PZT2 is expressed as h (t). Then the response signal of PZT2 is where B is the coefficient of the amplitude of the excitation pulse signal. Then, in the second step, the response signal is reversed in the time domain: Then, the reversed signal y1(−t) is applied to PZT1 as excitation again, and the focused signal y2(t) of PZT2 is where R h (t) is the autocorrelation function of h(t).
According to the property of the autocorrelation function, when t = 0, the autocorrelation function R h (t) has the maximum value: According to the above derivation and analysis, the spectrum of the autocorrelation function is the square of the spectrum of the original function. That is, after time inversion, the difference between the signal spectrum will be amplified, and the signal features will be easier to extract.

WPE-CNN Operating Principle
The method combining WPE and CNN proposed for pipeline corrosion identification mainly includes signal energy feature extraction and CNN classification. The structure of the method is shown in Figure 2.
First, the focused signals acquired by PZT2 after time reversal are decomposed into wavelet packets to obtain the energy characteristics of different frequency bands. Then, the data are divided into the training set, the validation set, and the testing set. The training data are input to CNN for training to obtain the classification model. Finally, the test data are input to the trained model for classification to obtain the final classification result.

WPE Operating Principle
Wavelet packet decomposition (WPD), a complete level-by-level decomposition of the original signal, aims to split the signal into successive low-and high-frequency components using a recursive filter-decimation operation, which has been proven to be a useful tool for non-stationary signal analysis [37]. The binary tree up to the third level wavelet packet decomposition of the original signal is shown in Figure 3. After each WPD, the characteristic information of the original signal is also present in each sub-band signal. Therefore, the distribution characteristics of the energy distributed in different sub-bands can be used as an important basis for signal identification.
Suppose the length of the original signal is N, then the data length of the discrete signal in the decomposed signal is reduced to 2 −k N, and the energy of the sub-band signal after the wavelet packet decomposition can be expressed as where k is the number of decomposition; m = 0, 1, 2 ..., 2 k − 1 represents the position number of the decomposition frequency band. The energy of the sub-band signals after wavelet packet decomposition is obtained and normalized.

WPE Operating Principle
Wavelet packet decomposition (WPD), a complete level-by-level decomposition of the original signal, aims to split the signal into successive low-and high-frequency components using a recursive filter-decimation operation, which has been proven to be a useful tool for non-stationary signal analysis [37]. The binary tree up to the third level wavelet packet decomposition of the original signal is shown in Figure 3.
the data are divided into the training set, the validation set, and the testing set. The ing data are input to CNN for training to obtain the classification model. Finally, t data are input to the trained model for classification to obtain the final classification

WPE Operating Principle
Wavelet packet decomposition (WPD), a complete level-by-level decomposi the original signal, aims to split the signal into successive low-and high-frequenc ponents using a recursive filter-decimation operation, which has been proven to be ful tool for non-stationary signal analysis [37]. The binary tree up to the third level w packet decomposition of the original signal is shown in Figure 3.  After each WPD, the characteristic information of the original signal is also p in each sub-band signal. Therefore, the distribution characteristics of the energy d uted in different sub-bands can be used as an important basis for signal identificat Suppose the length of the original signal is N, then the data length of the d signal in the decomposed signal is reduced to 2 −k N, and the energy of the sub-band after the wavelet packet decomposition can be expressed as where k is the number of decomposition; m = 0, 1, 2 ..., 2 k − 1 represents the p number of the decomposition frequency band. The energy of the sub-band signals after wavelet packet decomposition is ob and normalized. After each WPD, the characteristic information of the original signal is also present in each sub-band signal. Therefore, the distribution characteristics of the energy distributed in different sub-bands can be used as an important basis for signal identification.
Suppose the length of the original signal is N, then the data length of the discrete signal in the decomposed signal is reduced to 2 −k N, and the energy of the sub-band signal after the wavelet packet decomposition can be expressed as where k is the number of decomposition; m = 0, 1, 2, . . . , 2 k − 1 represents the position number of the decomposition frequency band.
The energy of the sub-band signals after wavelet packet decomposition is obtained and normalized.
E(x(t) k,m ) max is the maximum value of the energy signal in the decomposed band. E(x(t) k,m ) min is the minimum value of the energy signal in the decomposed band. E m is the energy value after normalization.
Remarkably, there are two crucial issues for achieving the best performance in the wavelet packet transformation: determining the optimal mother wavelet function, which is the first wavelet, and choosing the proper decomposition level of the signal. The value of the norm entropy l p calculated by the cost function in Equation (7) acts as the selection criteria to tackle the two issues mentioned above.

CNN Operating Principle
The structure of CNN in this paper is composed of an input layer, two convolution layers, two pooling layers, a full connection layer, a dropout layer, and an output layer. Among them, the function of the convolution layer is to adaptively extract the energy of sub-band signals after wavelet packet decomposition [45]. Adding a pooling layer after the convolution layer can reduce the sampling of the input features, extract significant features, and reduce the parameters that need training while retaining the dominant features [46]. Then, the dropout layer is used to prevent overfitting. Finally, the features extracted from the convolution layer and pooling layer are synthesized by connecting the neurons of the full connected layer in pairs.
The super parameters of the Convolutional Neural Network directly affect the efficiency and accuracy of the model, which needs to be adjusted by experience and repeated experiments. After many tests, the Convolution Neural Network model in this paper is shown in Table 1. The prediction results are output through the softmax classifier. In the CNN model proposed in this paper, the iterations are 200, the learning rate is 0.001, the dropout rate is 0.1, the activation function is Relu, and the loss function is categorical cross-entropy. The performance of the final trained CNN model needed to be evaluated by corresponding metrics [47]. Common evaluation metrics for classification tasks are true positive rate (TPR) and false positive rate (FPR) [48,49], which have the following equations: where TP indicates that a positive sample is correctly identified as a positive sample, TN indicates that a negative sample is correctly identified as a negative sample, FP indicates a false positive sample (which means that a negative sample is incorrectly identified as a positive sample), and FN indicates a false negative sample (which means that a positive sample is incorrectly identified as a negative sample).

Experimental Setup and Procedures
To verify the effectiveness of the proposed method, an experimental study was carried out. The experimental setup consists of a sample pipeline with two PZT patches mounted on the surface as actuator and sensor, respectively, a multifunctional data acquisition device (NIUSB-6361), and a laptop computer. The PZT patch was pasted on both sides of the outer surface of the pipeline sample using a quick-curing epoxy resin (brand name J-B WELD) to protect the pipeline from water corrosion.
To simulate the occurrence and evolution of pipeline internal corrosion, Figure 4 shows the electrochemical corrosion settings designed in this paper. The main parameters of experimental materials and devices are shown in Table 2. The graphite rod and sample pipeline were connected to the anode and cathode of an external DC power supply (China Delixi Electric). In addition, the output voltage of the electrochemical DC power supply was 12 V, and the output current was set to a constant value of 3 A. A 10%NaCl solution was used as the electrolytic solution.
sample is incorrectly identified as a negative sample).

Experimental Setup and Procedures
To verify the effectiveness of the proposed method, an experimental study was carried out. The experimental setup consists of a sample pipeline with two PZT patches mounted on the surface as actuator and sensor, respectively, a multifunctional data acquisition device (NIUSB-6361), and a laptop computer. The PZT patch was pasted on both sides of the outer surface of the pipeline sample using a quick-curing epoxy resin (brand name J-B WELD) to protect the pipeline from water corrosion.
To simulate the occurrence and evolution of pipeline internal corrosion, Error! Reference source not found. shows the electrochemical corrosion settings designed in this paper. The main parameters of experimental materials and devices are shown in Table 2.
The graphite rod and sample pipeline were connected to the anode and cathode of an external DC power supply (China Delixi Electric). In addition, the output voltage of the electrochemical DC power supply was 12 V, and the output current was set to a constant value of 3 A. A 10%NaCl solution was used as the electrolytic solution.   The corrosion monitoring test was performed every 5 h after the pipeline corrosion. The total corrosion time was 40 h. Therefore, 9 corrosion states were obtained, including no corrosion (0 h). The corrosion states are shown in Error! Reference source not found..  The corrosion monitoring test was performed every 5 h after the pipeline corrosion. The total corrosion time was 40 h. Therefore, 9 corrosion states were obtained, including no corrosion (0 h). The corrosion states are shown in Table 3. a precision of 0.01 mm. The inner diameter difference between adjacent corrosion periods is the corroded wall thickness per unit of time.
The Control and Data Acquisition (DAQ) program in LabVIEW was run on the computer to generate the pulse signal. The parameters of the pulse signal are shown in Table 4. The NIUSB-6361 converts the pulse signal into an analog signal to drive the PZT1. Subsequently, the signal propagates along the pipeline wall, and PZT2 acquires the response signal, which is reversed in the time domain. Then, the reversed signal is re-emitted, and the focused signal detected by PZT2 is acquired by the data acquisition (DAQ) program. The focused signals under different corrosion degrees are automatically stored by LabVIEW programming software.

Data Acquisition
The corrosion process of the sample pipeline from 0 to 40 h is shown in Figure 5. The relationship between the pipeline corrosion time and the corrosion wall thickness is shown in Figure 6. With the increase in corrosion time, the corrosion depth gradually increases.
After the corrosion every 5 h, the pipeline was cleaned and the inner diameter of th pipe wall was measured with a gauge caliper 323-134-95 mm (Three quantities, China with a precision of 0.01 mm. The inner diameter difference between adjacent corrosio periods is the corroded wall thickness per unit of time. The Control and Data Acquisition (DAQ) program in LabVIEW was run on the com puter to generate the pulse signal. The parameters of the pulse signal are shown in Tabl 4. The NIUSB-6361 converts the pulse signal into an analog signal to drive the PZT1. Sub sequently, the signal propagates along the pipeline wall, and PZT2 acquires the respons signal, which is reversed in the time domain. Then, the reversed signal is re-emitted, and the focused signal detected by PZT2 is acquired by the data acquisition (DAQ) program The focused signals under different corrosion degrees are automatically stored by Lab VIEW programming software.

Data Acquisition
The corrosion process of the sample pipeline from 0 to 40 h is shown in Figure 5. Th relationship between the pipeline corrosion time and the corrosion wall thickness i shown in Figure 6. With the increase in corrosion time, the corrosion depth gradually in creases.  The focused signals with nine corrosion degrees received by PZT2 are shown in Figure 7. However, the nine focused signals with different degrees of corrosion are slightly different in the time domain. It is impossible to classify the corrosion degree of the pipeline intuitively.

Wavelet Packet Energy Feature Extraction
The foremost task in the wavelet packet analysis is to make a choice of the most appropriate mother wavelet function, since the results of signals from different functions could be varied [50]. The Daubechies family (dbN), exhibiting the properties of asymmetric, orthogonal, and biorthogonal, was adopted as the candidate mother wavelet function in this case. The norm entropy l p calculated from Equation (7) helps to determine the most appropriate order N of the Daubechies family. The smaller the value of the norm entropy l p is, the better the order is. Moreover, the smaller norm entropy l p will lead to less calculation time. Table 5 lists the norm entropy l p of the candidate Daubechies families dbN, where the order N is from 1 to 9. As shown clearly in Table 5, db 5 results in the minimum of the cost function, which can be regarded as the best option for the mother wavelet function in this case [51,52]. Table 6 lists the value of the norm entropy l p after the wavelet packet decomposition at various decomposition levels from 1 to 9. As seen in Table 6, the db5 under five levels

Wavelet Packet Energy Feature Extraction
The foremost task in the wavelet packet analysis is to make a choice of the most appropriate mother wavelet function, since the results of signals from different functions could be varied [50]. The Daubechies family (dbN), exhibiting the properties of asymmetric, orthogonal, and biorthogonal, was adopted as the candidate mother wavelet function in this case. The norm entropy l p calculated from Equation (7) helps to determine the most appropriate order N of the Daubechies family. The smaller the value of the norm entropy l p is, the better the order is. Moreover, the smaller norm entropy l p will lead to less calculation time. Table 5 lists the norm entropy l p of the candidate Daubechies families dbN, where the order N is from 1 to 9. As shown clearly in Table 5, db 5 results in the minimum of the cost function, which can be regarded as the best option for the mother wavelet function in this case [51,52]. Table 6 lists the value of the norm entropy l p after the wavelet packet decomposition at various decomposition levels from 1 to 9. As seen in Table 6, the db5 under five levels

Wavelet Packet Energy Feature Extraction
The foremost task in the wavelet packet analysis is to make a choice of the most appropriate mother wavelet function, since the results of signals from different functions could be varied [50]. The Daubechies family (dbN), exhibiting the properties of asymmetric, orthogonal, and biorthogonal, was adopted as the candidate mother wavelet function in this case. The norm entropy l p calculated from Equation (7) helps to determine the most appropriate order N of the Daubechies family. The smaller the value of the norm entropy l p is, the better the order is. Moreover, the smaller norm entropy l p will lead to less calculation time. Table 5 lists the norm entropy l p of the candidate Daubechies families dbN, where the order N is from 1 to 9. As shown clearly in Table 5, db5 results in the minimum of the cost function, which can be regarded as the best option for the mother wavelet function in this case [51,52].  Table 6 lists the value of the norm entropy l p after the wavelet packet decomposition at various decomposition levels from 1 to 9. As seen in Table 6, the db5 under five levels of decomposition obtains the smallest l p compared to the others. In other words, the modeling performance under five levels of decomposition is better than others. Consequently, the Daubechies with order N = 5 was applied as the mother wavelet packet, which was decomposed up to five levels in this case. The energy of sub-band signals of 32 bands in the fifth layer was extracted from the low-frequency sub-band to high-frequency sub-band to obtain a set of 32-dimensional vectors. Through the feature extraction of wavelet packet energy, the differentiations of nine signals with different corrosion degrees were improved. However, the difference is still not obvious and difficult to distinguish intuitively, as shown in Figure 8. of decomposition obtains the smallest l p compared to the others. In other words, the modeling performance under five levels of decomposition is better than others. Consequently, the Daubechies with order N = 5 was applied as the mother wavelet packet, which was decomposed up to five levels in this case. The energy of sub-band signals of 32 bands in the fifth layer was extracted from the low-frequency sub-band to high-frequency sub-band to obtain a set of 32-dimensional vectors. Through the feature extraction of wavelet packet energy, the differentiations of nine signals with different corrosion degrees were improved. However, the difference is still not obvious and difficult to distinguish intuitively, as shown in Error! Reference source not found.. The signal energy is mostly concentrated between 10-25 segments, and there is almost no energy distribution between 0-10 and 25-32 signals. Since wavelet packet components with small energy are easily interfered by signal noise, these components can be ignored. It is also reasonable to take only 10-25 segments of wavelet packet components with large energy to approximate the original signal. Therefore, this paper intercepted 16 segments of the signal sub-band energy between 10 and 25 as the input vector of the CNN model, which can further improve the training efficiency and classification accuracy. The signal energy is mostly concentrated between 10-25 segments, and there is almost no energy distribution between 0-10 and 25-32 signals. Since wavelet packet components with small energy are easily interfered by signal noise, these components can be ignored. It is also reasonable to take only 10-25 segments of wavelet packet components with large energy to approximate the original signal. Therefore, this paper intercepted 16 segments of the signal sub-band energy between 10 and 25 as the input vector of the CNN model, which can further improve the training efficiency and classification accuracy.

Evaluation of WPE-CNN Model for Different Corrosion Degrees
The 16 segments of sub-band energy after wavelet packet decomposition were used as input vectors in the WPE-CNN model proposed in this paper for classifying nine kinds of pipeline corrosion degrees. There are 100 datasets for each corrosion degree, 60% of which were randomly selected as the training set, 20% as the verification set, and 20% as the testing set.
The training process of the WPE-CNN model for the pipeline corrosion degree is shown in Figure 9. After about 46 iterations, accuracy and loss values of the training and validation datasets were very stable, and the model started to converge. The accuracy rate reached 99.4% and the value of the loss function finally stabilized at around 0.056.

Evaluation of WPE-CNN Model for Different Corrosion Degrees
The 16 segments of sub-band energy after wavelet packet decomposition were used as input vectors in the WPE-CNN model proposed in this paper for classifying nine kinds of pipeline corrosion degrees. There are 100 datasets for each corrosion degree, 60% of which were randomly selected as the training set, 20% as the verification set, and 20% as the testing set.
The training process of the WPE-CNN model for the pipeline corrosion degree is shown in Figure 9. After about 46 iterations, accuracy and loss values of the training and validation datasets were very stable, and the model started to converge. The accuracy rate reached 99.4% and the value of the loss function finally stabilized at around 0.056. Under different corrosion degrees, Figure 10 shows the prediction results of the WPE-CNN model. The accuracy of each sample is 100%, 100%, 100%, 100%, 94.7%, 100%, 100%, 100%, and 90.9%. The total accuracy of the nine states is 98.30%. The method proposed in this paper has high accuracy in classifying the internal corrosion degree of pipelines.  Under different corrosion degrees, Figure 10 shows the prediction results of the WPE-CNN model. The accuracy of each sample is 100%, 100%, 100%, 100%, 94.7%, 100%, 100%, 100%, and 90.9%. The total accuracy of the nine states is 98.30%. The method proposed in this paper has high accuracy in classifying the internal corrosion degree of pipelines.

Evaluation of WPE-CNN Model for Different Corrosion Degrees
The 16 segments of sub-band energy after wavelet packet decomposition were used as input vectors in the WPE-CNN model proposed in this paper for classifying nine kinds of pipeline corrosion degrees. There are 100 datasets for each corrosion degree, 60% of which were randomly selected as the training set, 20% as the verification set, and 20% as the testing set.
The training process of the WPE-CNN model for the pipeline corrosion degree is shown in Figure 9. After about 46 iterations, accuracy and loss values of the training and validation datasets were very stable, and the model started to converge. The accuracy rate reached 99.4% and the value of the loss function finally stabilized at around 0.056. Under different corrosion degrees, Figure 10 shows the prediction results of the WPE-CNN model. The accuracy of each sample is 100%, 100%, 100%, 100%, 94.7%, 100%, 100%, 100%, and 90.9%. The total accuracy of the nine states is 98.30%. The method proposed in this paper has high accuracy in classifying the internal corrosion degree of pipelines.

Model Comparison
For comparison, the data after feature extraction were input to other commonly used models for classification, such as the SVM model and KNN model. The SVM process was performed with Python, with RBF as the kernel function; the parameter coefficient g of the kernel function was 0.625 and the penalty factor coefficient c was 0.6. K was 12 in the KNN process. In addition, the original data without feature extraction were input into the CNN model for classification.
To reduce experimental errors and improve the accuracy of experimental conclusions, the WPE-CNN, CNN, the WPE-SVM, and the WPE-KNN were trained 20 times to verify the accuracy of test samples, as shown in Figure 11. The final results show that the recognition accuracy of the WPE-CNN is between 98.12% and 99.40%, and the training time is 4.78 s. The recognition accuracy of the CNN is between 90.33% and 93.38%. The recognition accuracy of the WPE-SVM is between 88.13% and 91.30%. The recognition accuracy of the WPE-KNN is between 87.43% and 90.05%. The standard deviation of the accuracy of the WPE-CNN is 0.4533 in 20 repetitional trainings, which is the smallest between four methods. This fully indicates that the method proposed in this paper can effectively improve the identification accuracy of pipeline corrosion degree and has better stability than the CNN, WPE-SVM, and WPE-KNN.

Model Comparison
For comparison, the data after feature extraction were input to other commonly used models for classification, such as the SVM model and KNN model. The SVM process was performed with Python, with RBF as the kernel function; the parameter coefficient g of the kernel function was 0.625 and the penalty factor coefficient c was 0.6. K was 12 in the KNN process. In addition, the original data without feature extraction were input into the CNN model for classification.
To reduce experimental errors and improve the accuracy of experimental conclusions, the WPE-CNN, CNN, the WPE-SVM, and the WPE-KNN were trained 20 times to verify the accuracy of test samples, as shown in Error! Reference source not found.. The final results show that the recognition accuracy of the WPE-CNN is between 98.12% and 99.40%, and the training time is 4.78 s. The recognition accuracy of the CNN is between 90.33% and 93.38%. The recognition accuracy of the WPE-SVM is between 88.13% and 91.30%. The recognition accuracy of the WPE-KNN is between 87.43% and 90.05%. The standard deviation of the accuracy of the WPE-CNN is 0.4533 in 20 repetitional trainings, which is the smallest between four methods. This fully indicates that the method proposed in this paper can effectively improve the identification accuracy of pipeline corrosion degree and has better stability than the CNN, WPE-SVM, and WPE-KNN. The training times of the four models are shown in the Table 7. Compared with the CNN, the training efficiency of the WPE-CNN model was improved hundreds of times. Compared with the WPE-SVM and WPE-KNN, the WPE-CNN effectively improved the classification accuracy while consuming limited training time.

Conclusions
In this paper, a new method based on time reversal combining WPE and CNN is proposed to quantitatively identify pipeline internal corrosion. The proposed method has low cost, simple structure, short time consumption, and high accuracy. The major findings of the proposed approach can be summarized as follows: The training times of the four models are shown in the Table 7. Compared with the CNN, the training efficiency of the WPE-CNN model was improved hundreds of times. Compared with the WPE-SVM and WPE-KNN, the WPE-CNN effectively improved the classification accuracy while consuming limited training time.

Conclusions
In this paper, a new method based on time reversal combining WPE and CNN is proposed to quantitatively identify pipeline internal corrosion. The proposed method has low cost, simple structure, short time consumption, and high accuracy. The major findings of the proposed approach can be summarized as follows: 1.
The way of quantitatively monitoring the internal corrosion of pipelines by piezoelectric active sensing with time reversal can be considered as a novel and cost-effective approach.