ABSTRACT
The urban water supply network is part of the infrastructure that sustains the economic and social functions of cities and regions. Timely inspection and maintenance of the network can effectively reduce resource wastage and prevent accidents. Traditional manual detection methods are inefficient and can be based on subjective judgments. A classification model based on an improved ResNet34 network has been proposed to classify and detect various types of corrosion on the inner walls of pipes under challenging conditions. The introduction of the attention mechanism and multi-scale feature fusion modules further improved the model's effectiveness in classifying defects within the inner walls of pipes. The model can detect various types of pipeline corrosion with a detection accuracy of 98.61%. This accuracy is significantly superior to that achieved with traditional models such as ResNet34, AlexNet, MobileNet, and VGGNet.
HIGHLIGHTS
A deep learning model was developed for the classification of pipeline corrosion defects.
Good accuracy was achieved in the experiment.
Practical classification methods and technical support for pipeline damage detection are provided by this model.
INTRODUCTION
The urban water supply is a crucial aspect of urban infrastructure. With the continuous advancement of industrialization and urbanization, the population of cities has seen a marked increase. Consequently, water pipe networks have become more complex, with a higher laying density. In piping systems, steel and cast iron have been the primary materials used in metal pipelines for centuries. The water supply pipelines in most cities have a history of several decades, and the service life of some pipelines even exceeds 100 years (Barton et al. 2019). With an increase in the service life of pipelines, the probability of structural or functional defects also rises, leading to groundwater pollution, urban waterlogging, and other significant safety hazards (Lv et al. 2019). These issues often result in accidents, which can affect the environment, public facilities, and even the personal safety of residents (You et al. 2023b). Therefore, the issue of pipeline detection and maintenance is becoming an increasingly prominent concern (Adedeji et al. 2017). Categorizing corrosion on the inside of pipelines can reveal the cause of corrosion, whether it is due to water quality issues, a poor choice of pipeline materials, or other reasons. This can help to improve pipeline designs in order to prevent corrosion from occurring in the future. In addition, pipeline detection can inform assessments of the health of the pipeline, so that timely measures can be taken to repair or replace it. Inspection and timely repair of pipes with serious defects can not only reduce accidents such as blockage and overflow but also prolong the service life of pipes (Wang et al. 2021). Additionally, through effective corrosion monitoring, the high costs incurred by accidents and sudden maintenance can be reduced along with a reduction in the daily operation and maintenance costs. Given the large scale of water supply pipelines, efficient, automatic, and large-scale pipeline inspection has become an urgent requirement for pipeline facility construction and management (Zhou et al. 2022).
The existing detection technology has been a limiting factor affecting evaluations of the conditions of water supply pipelines. Lack of regular inspections, or delays in the inspection cycle, can lead to various issues in managing and maintaining water pipes (Wang et al. 2020). Currently, common pipeline detection methods include sonar detection (Nadimi et al. 2021), eddy current detection (Chu et al. 2021), magnetic flux leakage detection (Peng et al. 2020), and laser projection imaging detection (Mukherjee et al. 2022). However, compared to machine vision methods, conventional detection techniques cannot directly reveal damage to the internal surface of the pipeline. These methods also have lower automation levels and lower rates of damage identification with respect to machine vision methods. By utilizing digital image processing technology in computer vision, pipeline images can automatically be assessed. This technique can effectively address the aforementioned issues and establish a dependable framework for the safety assessment and maintenance of pipelines. Wang & Zhang (2014) designed a circular structured light detection system. The light emitted by the laser was controlled by adjusting the shape of the material surface and converted into bars of light containing three-dimensional information. This analysis can be used to obtain the coordinates of the inner wall of the pipeline, enabling the detection of pipeline deformation. Kannala et al. (2008) utilized a hyperboloid panorama camera to capture images of pipelines. This camera is capable of producing a 360° panoramic image of the inner wall. Given the low levels of light inside the pipeline and the complex environment, the SFM method relies on the selection and matching of feature points, which can be challenging, ultimately leading to reduced detection accuracy. Gunatilake et al. (2020) developed a set of mobile robot sensing systems that rely on RGB-Depth image detection to locate 3D images. They successfully implemented scanning, detection, location, and measurement of internal defects in pipelines with this technique. The system can achieve linear quantification of defects without a complicated calibration process through the directional correction of RGB-Depth images.
Traditional machine learning methods require the selection and extraction of artificial features before implementing damage identification through classifier design. Given that this method requires human intervention to create and extract features manually, this subjective element may play a role. Artificially created features are insensitive to changes, which makes it challenging to accurately represent the detailed features of high-level images. This limitation results in a notable decrease in feature recognition efficiency. In recent years, deep learning techniques have shown powerful capabilities in various fields. For example, Yeganeh et al. (2024) compared the performance of seven machine learning techniques in predicting water table levels and found that these techniques have significant advantages in identifying complex trends and nonlinear relationships. In addition, Mirboluki et al. (2024) successfully predicted the water table using improved deep learning and soft computing methods, demonstrating the significant advantages of the Long Short Term Memory Network-Grey Wolf Optimization (LSTM-GWO) hybrid model when dealing with complex time series data. It shows that deep learning models have great application potential in complex environments. Deep learning technology can be used to analyze internal and external surface defects in piping efficiently. Atha & Jahanshahi (2018) employed the ZFNet and VGG16 deep convolutional neutral networks (CNNs) to detect and assess the corrosion of metal surfaces, although the detection accuracy of these two models is relatively low. Ahuja et al. (2019) conducted a study on pipeline corrosion and classified four different types of corrosion using the Mask region-based CNN (He et al. 2017), achieving an average accuracy of 93.4%. Wang et al. (2021) proposed an intelligent recognition technology for damage detection in underground drainage pipes using a deep learning model. However, the detection speed and accuracy reported are both inadequate. You et al. (2023a) developed an automated detection and identification algorithm for joint defects in drainage pipes using the YOLOv5 object detection framework. This algorithm can identify staggered and broken joints of pipes, but its detection accuracy is low.
The main objective of this study is to propose a novel method to classify the inner wall corrosion of the water supply pipeline based on the internal video images obtained by endoscope and deep learning technology. The classic ResNet classification network is adopted to identify the corrosion types. The improved model can identify various types of corrosion defects on the inner wall of pipeline more accurately. As a reliable basis for staff to assess the health of the pipeline and determine whether the pipeline needs to be repaired and replaced, sudden accidents and losses caused by pipeline corrosion can be avoided.
METHODS
Convolutional neural networks
Machine learning has been widely used to detect structural damage (Salkhordeh et al. 2021), although this technique can often face difficulties in classification and recognition. Numerous algorithms can be used to solve these problems. In this study, a CNN is used to identify corrosion images. Compared to traditional neural networks, CNNs have a better ability to process images and sequential data, because they are able to learn the features in an image automatically and to extract the most useful information.
During the initial stages of the deployment of deep learning methods for defect detection, different approaches emerged, some of which are based on CNNs. Features of defects can be extracted from images based on a specific detection model. It identifies and classifies defects in images, enabling recognition, prediction, and decision-making based on these features. Existing surface defect classification networks include AlexNet (Krizhevsky et al. 2012), VGGNet, GoogLeNet (Szegedy et al. 2015), ResNet (He et al. 2016), and MobileNet (Howard et al. 2017).
ResNet
ResNet is an architecture developed to mitigate the challenges of gradient vanishing in the training of deep networks. Introduced by Kaiming He et al. in 2015, ResNet garnered exceptional results in the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) competition.
The main innovation of ResNet lies in introducing the concept of the Residual Block. Traditional neural networks learn the feature representation of input data by stacking layers. However, with the proliferation of network layers, the gradient tends to vanish during backpropagation, making it challenging to train the model effectively. To solve this problem, ResNet introduces cross-layer residual connections, which allow information to be transmitted directly from one layer to a subsequent layer, thus alleviating the issue of gradient vanishing. As a basic element of ResNet, the residual block has two primary branches: the main path and the residual path. The main path performs ordinary feature transformation, while the residual path directly adds the input to the output of the main path. This design enables the model to learn the residuals directly and accelerate the propagation of gradients.
Squeeze-and-excitation attention mechanism
In CNN architectures, convolutional layers and pooling layers are typically employed to extract features from images. However, the link between feature channels is not well modeled by this approach, as some channels have comparatively less effect on how well a task is performed. The SE operation introduced by this model aims to model clearly the relationship between channels. Firstly, the SE module utilizes global pooling to condense the input feature map channel into a single real number. This number represents the weight of the feature channel and is derived by pooling the two-dimensional features of the map, giving it a global receptive field. During the compression process, the original number of channels remains unchanged, while the feature dimension is compressed to 1 × 1 × C. After compression, the SE module learns to generate a channel weight vector using a fully connected layer and a nonlinear activation function. This weight vector is applied to each channel of the original feature map to weigh the features of the different channels.
The SE module is applied to the spatial information of the image, and it learns to distinguish between corroded and normal areas in the image. By highlighting corrosion-related areas in the image, the model can focus more on corrosion-related areas and ignore parts that are irrelevant for classification. By embedding the SE module into the ResNet34 network, the feature channel recalibration strategy of the SE module can be combined with ResNet34. This integration can effectively improve the recognition capability of the network.
Multi-scale feature fusion module
The multi-scale feature fusion (MSFF) module is a common structure in deep neural networks. Its main purpose is to process feature maps of different scales or resolutions in order to enhance the model's capacity to gather multi-scale information, to enhance the network's ability to process such information, and increase the generality of the model.
For this study, this module was integrated into the ResNet34, enhancing the comprehensive utilization of multi-layer features within the network. To determine the pixel value in the target image, the feature fusion module uses a bilinear interpolation method to explore fully the four real pixel values in the vicinity of the virtual point in the original image. By adjusting the smaller feature map to match the largest feature map, all feature maps have the same spatial dimension. Integrating feature maps from different depths using this feature fusion strategy helps to extract more information from the feature map, optimize the model's processing effect on image data, and enhance its capacity to capture multi-scale features. Image features at different scales may contain different levels and sizes of corrosion defect information. By capturing multi-scale information, these features can be fused together to help the network to adapt better to variations in corrosion defects at different scales, resulting in a more comprehensive feature representation. This network can then better differentiate between different types and sizes of corrosion defects, thus enhancing its ability to express information at different scales.
Improved ResNet34 model
SE–MSFF–ResNet34 model
Activation function
As an essential component of CNNs, the activation function is typically employed to determine the output of each neuron. Its main function is to introduce nonlinear mapping into neural networks, so that they can learn and express more complicated patterns and relationships. The activation function assumes a pivotal role in enhancing the expressive capacity of the neural network, addressing nonlinear problems, and facilitating the training and optimization of the model. It can help to eliminate single linear relationships during network training, enhance the nonlinear fitting capability of the network, and improve the model's expressive power. By activating the function, the neural network can model various curves to adapt better to the complex data distribution.
RESULTS AND DISCUSSION
Data acquisition
In this work, an industrial endoscopy-based detection system was used to obtain video images of the inside wall of a pipeline. Image frames were extracted from the captured video, and then images with corrosion defects were selected as the experimental dataset. For this paper, a total of 6,544 pipeline corrosion images were collected: 4,592 in the training set, 652 in the validation set, and 1,300 in the test set. The number of corrosion images occupied by each category is shown in Table 1.
Category . | Training set . | Validation set . | Test set . | Total . |
---|---|---|---|---|
Slight corrosion | 1,084 | 152 | 308 | 1,544 |
Pitting corrosion | 1,132 | 160 | 320 | 1,612 |
Areal corrosion | 1,192 | 172 | 336 | 1,700 |
Full corrosion | 1,184 | 168 | 336 | 1,688 |
Total | 4,592 | 652 | 1,300 | 6,544 |
Category . | Training set . | Validation set . | Test set . | Total . |
---|---|---|---|---|
Slight corrosion | 1,084 | 152 | 308 | 1,544 |
Pitting corrosion | 1,132 | 160 | 320 | 1,612 |
Areal corrosion | 1,192 | 172 | 336 | 1,700 |
Full corrosion | 1,184 | 168 | 336 | 1,688 |
Total | 4,592 | 652 | 1,300 | 6,544 |
By studying the material of the pipeline and the common types of damage to the pipeline inner wall, this research focused on corrosion defects on the inner walls of pipelines. Because pipelines are typically situated underground or in enclosed environments, the grayscale information in the captured images is often uneven. This results in blurred outlines and edges of corroded areas, making defects less noticeable against the background. Additionally, the small gray value difference between the corroded area and the background complicates feature extraction, impacting the accuracy of damage identification through feature recognition. Therefore, image denoising and enhancement operations were performed on the original pipeline images.
Experimental platform
The experiments were implemented using the PyTorch framework in the Python language with Windows 11. The Graphics Processing Unit (GPU) used was the NVIDIA GeForce RTX 3090. In this model, each training batch size is 16, and 200 epochs are trained.
Evaluating indicator
Accuracy, precision rate, and recall rate are typically chosen as the model evaluation metrics. The calculation formulas are as follows.
TP is the true positive rate, FP is the false positive rate, TN are true negatives, and FN are false negatives.
Experimental results
Model training results
To assess how the improved network impacted the performance of pipeline corrosion identification, we tested it with traditional models such as ResNet34, AlexNet, MobileNetv2, and VGGNet.
The final training results are given in Table 2, which shows that after 200 rounds of training, the improved algorithm developed for this study achieves the highest training accuracy and the lowest loss.
Results . | AlexNet . | VGGNet . | MobileNetv2 . | ResNet34 . | NewResNet34 . |
---|---|---|---|---|---|
Train accuracy | 0.98 | 0.97 | 0.97 | 0.98 | 0.99 |
Train loss | 0.08 | 0.09 | 0.07 | 0.07 | 0.04 |
Results . | AlexNet . | VGGNet . | MobileNetv2 . | ResNet34 . | NewResNet34 . |
---|---|---|---|---|---|
Train accuracy | 0.98 | 0.97 | 0.97 | 0.98 | 0.99 |
Train loss | 0.08 | 0.09 | 0.07 | 0.07 | 0.04 |
Classification results
In order to verify the generalization ability of the algorithm in this paper, the test set was then fed into the improved ResNet34. In order to highlight the classification ability of the new water supply pipeline model, its performance was again contrasted with traditional models such as ResNet34, AlexNet, MobileNetv2, VGGNet, the Support Vector Machines (SVM)-based pipe detection algorithm proposed in Zhou et al. (2021), and the convolutional neural network-based approach proposed in Zhao et al. (2022). The classification results are depicted in Table 3.
Model . | Acc (%) . | P (%) . | R (%) . |
---|---|---|---|
AlexNet | 96.76 | 96.83 | 96.70 |
VGGNet | 96.06 | 96.09 | 95.95 |
MobileNetv2 | 96.76 | 96.74 | 96.76 |
ResNet34 | 96.84 | 96.91 | 96.80 |
Zhou et al. (2021) | 96.31 | 96.29 | 96.23 |
Zhao et al. (2022) | 96.92 | 96.98 | 96.85 |
NewRestNet34 | 98.61 | 98.63 | 98.59 |
Model . | Acc (%) . | P (%) . | R (%) . |
---|---|---|---|
AlexNet | 96.76 | 96.83 | 96.70 |
VGGNet | 96.06 | 96.09 | 95.95 |
MobileNetv2 | 96.76 | 96.74 | 96.76 |
ResNet34 | 96.84 | 96.91 | 96.80 |
Zhou et al. (2021) | 96.31 | 96.29 | 96.23 |
Zhao et al. (2022) | 96.92 | 96.98 | 96.85 |
NewRestNet34 | 98.61 | 98.63 | 98.59 |
Bold values indicate that the result is the best in each experiment.
In Table 3, the improved ResNet34 model outperforms the other models in accuracy, precision, and recall. The accuracy, precision, and recall are as high as 98.16, 98.63, and 98.59%, respectively. The classification accuracy of the improved model is 1.85, 2.55, 1.85, 1.77, 2.3, and 1.69% higher than that of AlexNet, VGGNet, MobileNetv2, the traditional ResNet34 model, the SVM-based pipe detection algorithm proposed in Zhou et al. (2021), and the convolutional neural network-based approach proposed in Zhao et al. (2022), respectively, and the precision rate is improved by 1.8, 2.54, 1.89, 1.72, 2.34, and 1.65%, respectively, and recall rates increased by 1.89, 2.64, 1.83, 1.79, 2.63, and 1.74%, respectively. By optimizing the ResNet34 model on the basis of the ResNet34 model, the model can better capture the features of corrosion defects on the inner wall of the water pipe and improve the generalization ability of the model, thus performing well on the test set, which indicates that the model has a high reliability in practical applications.
The training phase focuses on the performance of the model on the training data, and the testing phase focuses on the performance of the model on the test data. The training accuracy of the algorithm in this paper is 99%, the testing accuracy is 98.61%, and the training and testing accuracies are similar. This indicates that the model has good generalization and excellent classification ability on different datasets.
To test the impact of the improvements proposed on the basic ResNet34 model, an ablation experiment was conducted. Table 4 displays various models and their respective modules. Model 1 is a ResNet34 model with an SE attention mechanism module; Model 2 uses the Leaky ReLU activation function instead of the previous one; Model 3 is a ResNet34 model with an MSFF module; Model 4 replaces the ReLU activation function in Model 1 with Leaky ReLU; in Model 5, an SE attention mechanism is added to Model 3; in Model 6, a Leaky RELU activation function is added to Model 3.
Model name . | SE . | Leaky ReLU . | Multi-scale feature fusion . |
---|---|---|---|
1 | √ | ||
2 | √ | ||
3 | √ | ||
4 | √ | √ | |
5 | √ | √ | |
6 | √ | √ |
Model name . | SE . | Leaky ReLU . | Multi-scale feature fusion . |
---|---|---|---|
1 | √ | ||
2 | √ | ||
3 | √ | ||
4 | √ | √ | |
5 | √ | √ | |
6 | √ | √ |
From Table 5, we can see the results of the ablation experiment, showing that an accuracy rate of 96.84%, a precision rate of 96.91%, and a recall rate of 96.80% can be achieved by using the original ResNet34, although with the improved ResNet34 model, all indicators have been significantly improved. The accuracy rate of the improved model is 98.61%, which is 1.77% higher than the original model. The precision rate is 98.63%, which is 1.72% higher, and the recall rate is 98.59%, which is an improvement of 1.79%.
Model . | Acc (%) . | P (%) . | R (%) . |
---|---|---|---|
ResNet34 | 96.84 | 96.91 | 96.80 |
1 | 98.07 | 98.12 | 98.02 |
2 | 97.15 | 97.25 | 97.10 |
3 | 97.53 | 97.55 | 97.51 |
4 | 98.30 | 98.31 | 98.28 |
5 | 98.53 | 98.54 | 98.28 |
6 | 97.45 | 97.54 | 97.39 |
This work | 98.61 | 98.63 | 98.59 |
Model . | Acc (%) . | P (%) . | R (%) . |
---|---|---|---|
ResNet34 | 96.84 | 96.91 | 96.80 |
1 | 98.07 | 98.12 | 98.02 |
2 | 97.15 | 97.25 | 97.10 |
3 | 97.53 | 97.55 | 97.51 |
4 | 98.30 | 98.31 | 98.28 |
5 | 98.53 | 98.54 | 98.28 |
6 | 97.45 | 97.54 | 97.39 |
This work | 98.61 | 98.63 | 98.59 |
Bold values indicate that the result is the best in each experiment.
The results illustrate that the improved ResNet34 model exhibits notable advancements in accuracy, precision, and recall, validating the efficacy of the method. These findings underscore the improved ResNet34 model's heightened generalization capability and robustness in the classification and recognition of defects on the inner walls of pipelines.
To verify the performance of the classification of the four different corrosion types for each model, their accuracies were compared for different sets of corrosion samples. The classification results are shown in Table 6.
Model . | Slight corrosion . | Pitting corrosion . | Areal corrosion . | Full corrosion . |
---|---|---|---|---|
AlexNet | 94.08 | 96.88 | 97.32 | 98.51 |
VGGNet | 93.42 | 91.88 | 98.81 | 99.70 |
MobileNetv2 | 97.70 | 95.31 | 95.24 | 98.81 |
ResNet34 | 95.39 | 96.25 | 97.02 | 98.51 |
Zhou et al. (2021) | 94.48 | 92.81 | 97.92 | 99.70 |
Zhao et al. (2022) | 95.45 | 93.75 | 99.40 | 98.81 |
1 | 96.71 | 96.88 | 99.70 | 98.51 |
2 | 95.72 | 96.25 | 97.62 | 98.81 |
3 | 97.70 | 95.31 | 97.92 | 99.11 |
4 | 98.03 | 96.88 | 99.70 | 98.51 |
5 | 97.04 | 97.50 | 100 | 99.40 |
6 | 96.05 | 95.31 | 98.21 | 100 |
This work | 98.03 | 98.12 | 100 | 98.21 |
Model . | Slight corrosion . | Pitting corrosion . | Areal corrosion . | Full corrosion . |
---|---|---|---|---|
AlexNet | 94.08 | 96.88 | 97.32 | 98.51 |
VGGNet | 93.42 | 91.88 | 98.81 | 99.70 |
MobileNetv2 | 97.70 | 95.31 | 95.24 | 98.81 |
ResNet34 | 95.39 | 96.25 | 97.02 | 98.51 |
Zhou et al. (2021) | 94.48 | 92.81 | 97.92 | 99.70 |
Zhao et al. (2022) | 95.45 | 93.75 | 99.40 | 98.81 |
1 | 96.71 | 96.88 | 99.70 | 98.51 |
2 | 95.72 | 96.25 | 97.62 | 98.81 |
3 | 97.70 | 95.31 | 97.92 | 99.11 |
4 | 98.03 | 96.88 | 99.70 | 98.51 |
5 | 97.04 | 97.50 | 100 | 99.40 |
6 | 96.05 | 95.31 | 98.21 | 100 |
This work | 98.03 | 98.12 | 100 | 98.21 |
Bold values indicate that the result is the best in each experiment.
The evaluation focuses on classification effectiveness of different corrosion types, including slight, pitting, areal, and complete corrosion (see Figures 6 and 7). The results indicate that the optimized classification model performs well in the classification of pipelines with slight corrosion, pitting corrosion, and areal corrosion, with an improved performance over other models. The classification accuracy rate of slight corrosion is 98.03%, that of pitting corrosion is 98.12%, and that of areal corrosion is 100%, indicating that the model used in this paper can completely judge the areal corrosion samples in this data set correctly, and the classification accuracy rate of complete corrosion is 98.21%. However, the classification effect of complete corrosion is slightly worse than the optimal algorithm among the seven models mentioned above. The improved ResNet34 model shows excellent performance in the classification of pipeline corrosion samples and provides practical classification methods for pipeline damage detection. Compared with other classification models, it can classify the inner wall corrosion defects more accurately and obtain excellent classification effect. Its superior performance brings prospects for practical applications in different corrosive environments, providing strong support for engineering practices in related fields.
CONCLUSIONS
An understanding of the corrosion defects in the inner walls of pipelines is of fundamental importance, in order to assess the health of the pipeline, to enable timely measures to be taken to repair or replace it, and to ensure the normal operation of the water supply system. An improved ResNet34 classification algorithm was proposed to identify corrosion defects on the inner wall of water pipes. By integrating the attention mechanism, the model directed more attention to useful information in the channel, thus improving its capability to extract image features from areas that were significantly degraded by corrosion while also suppressing irrelevant feature information. Meanwhile, capturing multi-scale information can enhance the ability of the network to express different scales. The Leaky ReLU function was used to improve the activity in negative intervals and to improve further the classification accuracy. According to the experimental results, the model achieved an accuracy of 98.61%, representing an improvement of 1.85, 2.55, 1.85, and 1.77% over AlexNet, VGGNet, MobileNetv2, and traditional ResNet34 models, respectively. The improved model showed remarkable results in accuracy and precision, demonstrating a significant advance over the original model and other conventional network models.
The improved model described in this paper introduces a new method for pipeline inner wall damage, which can more accurately identify the type of defects in the inner wall of the pipeline, reduce manual intervention in the process of identifying and classifying the damage in the inner wall of the pipeline, and improve efficiency. It provides a reliable basis for the scientific and rational operation of pipelines and the assessment of pipeline service life.
In future research, the severity of each corrosion defect will be assessed based on the classification results, which usually involves information including the depth, area, and location of the corrosion, so that the impact of the defect on the structural integrity of the pipeline can be better assessed. The performance of the model in other pipeline conditions may be affected due to differences in quality and between different pipeline systems. Therefore, the generalization ability of the model needs to be further verified in the following studies to ensure that it can be better applied to different pipeline systems.
DATA AVAILABILITY STATEMENT
Data cannot be made publicly available; readers should contact the corresponding author for details.
CONFLICT OF INTEREST
The authors declare there is no conflict.