Corrosion Prediction in the Oil Industry Using Deep Learning Techniques
International Journal of Robotics and Control Systems Vol. 4 No. 3 (2024) 1013-1036
Abstract
Corrosion presents a significant challenge in the oil industry, causing both immediate and long-term damage. Effective early prediction and monitoring of corrosion are crucial to mitigating economic losses and environmental impacts. However, traditional methods for predicting and detecting corrosion are often time-consuming and inefficient. This study leverages convolutional neural networks (CNNs) within a deep learning framework to develop two automated detection models for internal and external corrosion. These models can extract hierarchical features directly from raw pixel data, enhancing prediction accuracy and efficiency. Our dataset, provided by the Iraqi Oil Company, includes drone-captured images (162 photos: 91 depicting corrosion and 71 showing no signs of corrosion) and ultrasonic sensor readings (250 rows of oil pipeline thickness measurements). We assess the performance of our CNN models using metrics such as accuracy, precision, recall, and F-score, and we perform regression analysis to evaluate prediction errors. This research introduces two innovative systems: a 2D CNN for classifying the presence or absence of external corrosion, and a 1D CNN for assessing internal corrosion levels, identifying areas with the highest corrosion rates, and estimating the remaining operational lifespan based on these rates. Additionally, we develop a user-friendly interface for these systems. Comparative analysis demonstrates the superior efficiency of our proposed approach over traditional and alternative methods. Our findings advance the understanding of artificial intelligence applications in corrosion prediction, offering robust models to prevent unexpected corrosion failures. Future work will explore the integration of additional factors, such as humidity and temperature sensors, to further enhance the system's accuracy and reliability.
1.Introduction
Oil and gas are the crucial resources that power over 50% of the world's energy consumption at present [1]. Pipelines transport these two essential commodities from one location to another [2]. Oil and gas pipelines predominantly use steel, a material highly susceptible to corrosion [3]. Corrosion has a substantial impact on nearly all sectors of the economy and industry, including oil and gas pipelines [4].
The corrosion of pipelines used for transferring oil and gas resources poses a significant economic danger [5], [6]. Corrosion, in addition to high operating pressures, can greatly diminish the lifespan of oil and gas pipelines [7], [8] and compromise their structural integrity [9]. While there are various grades of carbon steel available for oil and gas pipelines, such as A, B, or C, as specified by ASTM A-53 and A-106 and API Standard 5L [10], the failures of high-strength low-alloy (HSLA) API 5L X grades of pipeline steel (X42-X100) are the most frequently documented in the literature [11]-[13]. The corrosion that occurs on the outer surface of oil and gas pipelines can cause significant damage over time. However, this type of corrosion is generally overlooked compared to interior corrosion, which receives the most protection in practice. The combination of corrosion and internal material faults can lead to the abrupt and catastrophic failure of pipelines [14]. Controlling corrosion, whether it be internal or external, is vital to ensuring the integrity of oil and gas pipelines.
The exponential expansion of the Iraqi oil and gas sector necessitates the augmentation of pipeline infrastructure, leading to heightened levels of operational and managerial intricacy. Ensuring the integrity of this infrastructure is crucial due to its possible negative environmental effects and substantial financial implications. During the early stages of production, corrosion poses a significant risk to the integrity of oil and gas pipelines. The unrefined blend obtained from the geological formation, consisting of interconnected water, organic acids, and diverse dissolved gases like carbon dioxide (CO2) and hydrogen sulfide (H2S), generates a corrosive atmosphere for steel. Although there is a good understanding of corrosion causes and better procedures for detecting corrosion, industry studies consistently indicate that both internal and exterior corrosion are major factors contributing to pipeline failure.
It is important to highlight that the average economic damage resulting from pipeline disasters is substantial [15]. During the last thirty years, pipeline mishaps in the United States have caused around $7 billion in property damage, resulting in the deaths of over 500 individuals and causing injuries to thousands. An instance of a pipeline explosion occurred in the community of San Bruno, California, USA, on September 6, 2010, resulting in the deaths of eight individuals and causing injuries to over fifty more. On July 26, 2010, a pipeline fault in Michigan, USA, resulted in the spillage of about 840,000 gallons of crude oil into the Kalamazoo River. The catastrophe incurred an estimated cost of $800 million [16]. The factors contributing to pipeline degradation are many. Fig. 1 depicts a pie chart presenting data on the primary reasons contributing to pipeline failure, including pipeline corrosion, human negligence, errors during installation and erection work, manufacturing process problems, and external influences [17]. According to these statistics, it is difficult to completely prevent pipeline incidents because the causes of failures come from various sources. Monitoring pipeline corrosion is crucial for mitigating the environmental impact of oil spills and ensuring the proactive maintenance of pipelines. Hence, it is viable to reduce the frequency of losses, accidents, and other substantial societal and environmental consequences resulting from oil pipeline failures due to corrosion.
As for the Iraqi oil industry The Wars and other conflicts caused protracted interruptions in Iraq from the 1980s to the 2000s. However, since 2009, international money has developed oil fields in southern Iraq, and as of October 2019, Iraq's capacity to produce oil has rebounded to about 3.7 MMBPD. The Iraqi government wants to see a rise in crude oil production, as this is their primary sector. Since the Iraqi economy is entirely dependent on the oil industry, most probably reach 6.0 million barrels per day by 2024 in order to maintain stable national income and to keep bolstering the country's financial resources. The process of exporting oil from Iraq's southern fields—Rumaila, West Qurna, Majnoon, Zubair field, and others-to other countries is done by sea. The pipelines that carry oil from the well to the field and then to sea ports in Iraq for example (Khor Al-Amaya), Jordan's Red Sea ports, and Turkey's ports are the carrier's middle link. The pipeline network spans thousands of kilometers throughout Iraq as shown in Fig. 2 [18].
The inspection of in-service piping in the oil and gas industry remains a complex procedure, requiring precise examination and analysis of numerous elements prior to devising subsequent courses of action. Consequently, it is necessary to implement all the introduced concepts, tools, methods, and recommended practices. Every stage of the inspection procedure is critical, as the information and reports produced at each stage impact the determination of the inspection interval. Nonetheless, as evidence of the inspection's execution, a substantial quantity of data and reports will be produced due to the inspection's complexity and volume. The inspector may also disregard certain inspections as a result of fatigue and tension brought on by the heavy workload throughout the inspection process. Consequently, incorrect identification of corrosion and other damage mechanisms present in the piping system may occur, potentially resulting in an accident.
Hence, the objective of this study is to introduce a robust mechanism for extracting corrosion characteristics from a given dataset. This dataset comprises images and ultrasonic sensor readings used as input to train a convolutional neural network (CNN) specifically for this task. The algorithm relies on authentic data obtained from credible sources, such as the Iraqi Oil Company. We built two models of convolutional neural networks, one of which (2DCNN) classifies images from the drone related to corrosion based on their presence or absence. We calculated the evaluation parameters for this network. Next, we designed another network (1DCNN) that utilizes ultrasonic sensor readings for regression, predicting corrosion location, estimating the pipeline's useful lifespan, and calculating all error rates. We considered all standards for data classification and collection methods to ensure they aligned with the American Petroleum Institute API 570 standards.
1.1.The Main Contributions of the Paper are Summarized as Follows
The advancements in Artificial Intelligence (A.I.) for object recognition can be mostly credited to the rise of deep learning artificial neural networks. Deep learning, a prominent area of artificial intelligence, emulates the cognitive processes of the human brain to analyze data and perform tasks such as object detection, speech recognition, and pattern generation for decision making. Deep learning has emerged as the logical advancement from "shallow networks" to neural networks with multiple layers, capable of progressively transforming representations (such as data and images) from simple to complex, by increasing the depth of the layers [19]. The initial stage in maintaining structures for corrosion protection is doing a visual check. Currently, humans are primarily responsible for gathering qualitative data. Although these inspectors possess certification and experience, the effectiveness of this time-consuming approach is subjective and heavily reliant on the expertise and qualifications of the individual.
Due to the advancements observed in the field of artificial intelligence across various domains, we present below the most significant contributions made in this research:
- Predictive maintenance, which involves early detection of corrosion rates and classification of corrosion types according to existing standards in oil companies, reduces the costs associated with the failure of oil facilities due to this factor.
- Identifying the points of corrosion at high rates reduces inspection operations, as does performing preventive treatments quickly and with high accuracy.
- non-destructive techniques to assess corrosion and calculate the remaining life of crude oil pipes and tanks. These techniques include using images of corrosion from drones in difficult-to-reach places and readings from ultrasonic sensors provided by specialized oil companies.
- We have developed two neural networks (1DCNN and 2DCNN) for different tasks. One of them relies on analyzing incoming images and classifying them to identify the presence and absence of corrosion. The other network uses sensor readings for the purpose of determining the location of the highest point of corrosion as well as predicting the remaining lifespan of the pipeline or oil tank.
The following sections are organized as follows:
Section 2: In this section, we provide theoretical background and more information on four main topics: external corrosion, internal corrosion, convolutional neural networks (CNN), and the American Petroleum Institute (API), as well as the ways to find corrosion in oil transmission line and the most important factors to calculate. Section 3: Presents a comprehensive collection of computational models and equations that govern the process of detecting corrosion. Section 4: Explain how to find and follow pipeline corrosion, including how to collect data, process it in two types of convolutional neural networks, and evaluate the system using parameter outputs. Section 5: In order to determine whether corrosion was present or not, we display the results of all classification and regression operations, as well as the location of the higher rate of corrosion, in accordance with the API standards that govern these operations. Additionally, we present the graphical interface model for the operation. Section 6: This section encompasses the presentation of all the constraints encountered during the project, followed by a comparison with other works. Additionally, it addresses the challenges faced during the implementation process and provides specific recommendations for future endeavors.
2.Theoretical Background
The problem of corrosion is a common one in oil installations and can be divided into two parts: external corrosion and internal corrosion. Based on the data provided by the relevant oil companies, we will use two types of convolutional neural networks to solve these two problems. These two types will be explained, and all parameters for evaluating the proposed system will be calculated. We relied on the American Petroleum Institute API 570 standards related to the corrosion factor.
This section briefly discusses external corrosion, internal corrosion, we will use convolutional neural network models (CNN) and gather evaluation metrics, and the standards of the American Petroleum Institute (API).
2.1.External Corrosion
A succinct summary There is a scarcity of literature that includes thorough review articles [20]-[23] and technical studies [24] on the exterior corrosion of both bare and coated oil and gas pipelines. In 2009, Noseworthy [25] conducted a study on the external corrosion of pipes that had been coated and protected against corrosion using cathodic protection. The study included many real-world industrial cases. In 2021, Kim et al. [26] released a review article on the elements that influence the exterior corrosion of underground coated steel pipes. Despite the existence of mitigation measures such as coating, lining, and cathodic protection [27]-[29], which are suggested standard procedures for preventing external corrosion of oil and gas pipelines, there are still regular reports of pipeline failures. However, these materials offer limited insights into the mechanisms and timing of external corrosion in pipes. External corrosion of oil and gas pipelines is a damaging mechanism that occurs over time. The extent of external corrosion is significantly influenced by the age of the pipeline and the presence and effectiveness of external protective measures. Typically, it is averted through the use of coatings and cathodic protection (CP) systems. In certain areas of Iraq, older natural gas pipelines lack proper coating and are either uncoated or just have coal tar or enamel wrap coatings [30]. The corrosion of uncoated oil and gas pipelines can begin when the protective oxide coating on their external surface is locally damaged, removed, or destabilized by elements in the soil that promote corrosion. In addition, mechanical forces such as crevice corrosion and localized corrosion contribute to exterior corrosion [31]-[34]. The outer layer of the submerged oil and gas pipeline, which is in contact with the surrounding earth, might experience many forms and types of corrosion. Crevice corrosion commonly occurs in crevices [35], pitting corrosion can result in leaks, holes, and gouges on the outer surface of pipes [36], and galvanic corrosion causes uniform loss of material [37], [38]. In addition, the outer surface of underground oil and gas pipelines frequently experiences stress corrosion cracking (SCC) as a result of the combined effects of tensile forces and other corrosion mechanisms [39]. Steel pipelines can have abrupt, catastrophic fractures as a result of stress corrosion cracking (SCC).
We used two-dimensional convolutional neural networks to analyze the images of corroded oil facilities provided by drones, with the aim of extracting features from these images, particularly those difficult to reach by traditional inspection methods. We then used these images as inputs to the network. We improved the architecture of this network by adjusting certain parameters to achieve the highest accuracy results, and we calculated all network evaluation parameters, which we will explain later.
2.2.Internal Corrosion
Corrosion requires the presence of an electrolyte, such as water, which is connected with crude oil during production operations. Different ionic species, known to cause corrosion, may contaminate this water. Due to its high groundwater content, Iraqi oil is classified as a wet oil, which causes the pipelines to get wet when the water comes into contact with their walls. Once this occurs, the physical and chemical characteristics of the water, the presence of sediments, and the amount of oxygen influence the rate of corrosion. Even when the water content of the oil or product is as low as 0.1%, extensive corrosion in low areas at moderate speeds has led to the failure of many pipelines. Water tends to collect in low areas that are normally difficult to reach. The small amounts of water in pipeline crude and products make it extremely difficult to gather samples for testing. Internal corrosion can result in decreased production since the accumulation of corrosion by-products in the pipeline might pose a significant risk to people, assets, and the environment in the case of a through-wall failure [40]. Currently, we employ multiple corrosion models to directly assess the interior corrosion of pipelines. However, these models are subject to certain limitations. It lacks the ability to assess the rate at which corrosion occurs and identify the areas with the most severe corrosion, as well as calculate the remaining lifespan of the pipe. These are the primary corrosion issues that pose challenges to the transmission pipelines for crude oil and products. The corrosion mechanisms can occur at a rapid rate, posing a threat to pipelines by causing leaks within a few months if not properly managed. The ultrasonic sensor probes enable the direct observation of corrosion growth in its original location [41]. Furthermore, one can track upsets, which provide prompt indications of system alterations. Therefore, we can make precise and reliable evaluations and prevent unexpected events and potential hazards by quantifying the real rates of corrosion in a system. This, in turn, allows for a more efficient allocation of resources, such as using pipeline thickness gauges [42]. For this type of corrosion, our neural networks were created that relies on the inputs of ultrasonic sensors. These sensors were installed at specific points in the oil pipeline. Corrosion rates and the operational lifespan of the pipe were also calculated according to the standards of the American Petroleum Institute. The network was trained on these inputs. Regression operations were performed, and all error rates were calculated. After this, an interface for our system was designed for the purpose of facilitating the task for users.
2.3.Convolutional Neural Networks (CNN)
In the domain of deep learning, the convolutional neural network (CNN) is widely recognized as the most renowned and often utilized method [43]-[48]. An advantage of CNN over its predecessors is its ability to autonomously detect relevant features without human supervision [49]. Several domains, including computer vision [50], voice processing [51], and face recognition [52], have widely utilized convolutional neural networks (CNNs). Similar to traditional neural networks, the neuronal structure of human and animal brains served as the basis for the design of CNNs. More precisely, an intricate arrangement of cells composes the visual cortex in a cat's brain. CNN replicates this arrangement [53]. Good fellow et al. [54] outlined three primary advantages of the Convolutional Neural Network (CNN): comparable representations, limited interactions, and parameter sharing. CNNs utilize shared weights and local connections to effectively utilize the 2D structures of input data, such as visual signals, in contrast to traditional fully connected (FC) networks. This method employs a minimal number of parameters, streamlining the training process and enhancing the network's speed. This is identical to the cells seen in the visual cortex. These cells have the ability to perceive only tiny parts of a scene, rather than the entire scene. In other words, they extract the local correlation present in the input, similar to local filters over the input. A common type of CNN that looks a lot like the multi-layer perception (MLP) has a lot of convolution layers, then sub-sampling (pooling) levels, and finally fully connected (FC) layers.
The design of a conventional two-dimensional convolutional neural network (2DCNN) specifically targets the spatial characteristics found in 2D images. It achieves this by utilizing locally connected convolutional filters with tied weights, which operate on multiple pixels simultaneously instead of individual pixels [55], [56]. This approach enhances the detection of inter dependencies among pixels, leading to improved performance. A 2DCNN initially transforms the 2D input data into 3D data, defining dimensions for width, height, and depth. We set the depth to 1 for a one-band picture and 3 for a three-band image, which represents the red, green, and blue channels. Next, we acquire a feature map by repeatedly applying convolution operators to sub-regions of the entire image. This process involves the addition of a bias term, followed by the application of a nonlinear activation function.
We can represent CNN’s layers for the convolutional layer process as shown in Equation (1).
Where : the number of layers; represent component; : represent weight; : represent basis.
Equation (2) represents the maximum pooling procedure, which we can mathematically expressly using the following formula.
Where denotes the process of performing the pooling operation.
Equation (3) represents a (FC) layer that is using to sorts the hidden features that come from the kernel into groups. [57].
However, when dealing with 1D time-series data, such as the dataset mentioned in this research, the 1DCNN (1-Dimensional Convolutional Neural Network) is typically a more optimal selection [58]. Fig. 3 illustrates the distinction between 2DCNN and 1DCNN. Applying 2DCNN to a 2D image yields a 2D image. On the other hand, applying 1DCNN to a 1D image or a numerical dataset produces a 1D image. The convolutional filter of 1DCNN operates on one-dimensional data, enabling it to discern and scrutinize the interrelationships among various elements in the data.
2.4.American Petroleum Institute (API)
The API is the official national trade association that represents every aspect of the natural gas and oil sector in the United States. It encompasses over 650 firms engaged in various parts of the petroleum industry, including production, refining, and distribution. The association's objective is to advocate for safety in the worldwide oil and gas industry and to shape public policy to support a robust and sustainable US oil and gas sector. The API was established in 1919 as a regulatory body responsible for establishing and enforcing standards. Over the course of its initial century, API has formulated over 700 standards aimed at improving operational and environmental safety, efficiency, and sustainability. While API's main concentration is on domestic matters, their work has gradually extended to encompass an increasing international aspect. As a result, API is now globally acknowledged for its diverse range of programs. API collaborates annually with prominent industry subject-matter experts to uphold its collection of more than 800 standards and recommended practices. API standards aim to enhance the efficiency and cost-effectiveness of industry experts' operations, ensure compliance with legislative and regulatory requirements, prioritize health and safety, and preserve the environment. Iraqi oil firms adhere to the corrosion calculation guidelines set by the American Petroleum Institute (API), namely the API 570 standard.
2.5.Methods for Detecting the Corrosion
Given the points mentioned earlier, we will utilize the 1DCNN method to analyze the ultrasonic sensor dataset of the oil company. We made extensive efforts to gather a substantial amount of data to improve the system's performance. The 2DCNN algorithm is specifically designed to handle images captured by drones from the same source, particularly in remote locations that are challenging to access for manual inspection processes. The work was conducted in multiple stages, outlined as follows: (1) The data was classified after being labeled and filtered again to improve the accuracy of the images. The images were then divided into a training set and a validation set. (2) The dataset was trained using 2CNN with the help of Anaconda Navigator and MATLAB R2023b for classification and regression, respectively. (3) All classification parameters and regression were calculated to evaluate the system's performance. Subsequently, we converted the aforementioned code into an intuitive environment by utilizing MATLAB Designer, a graphical user interface, thereby improving its accessibility and usability.
3.Mathematical Model
Corrosion can be defined as “an attack on a metallic material through reaction with its surrounding medium” [59]. For metals, the most common type of corrosion is wet corrosion, where the surrounding medium is typically water containing different dissolved substances. An electrochemical reaction typically transforms water into an electrolyte on the metal's surface. An electrochemical reaction is a chemical reaction that entails the transfer of electrons through a common medium, an electrolyte, between the materials and substances involved. We refer to this reaction as an oxidation reaction for metals [60]. A typical oxidation reaction for some theoretical metal, M, is shown in equation (4), where it is observed that the metal “loses” electrons, . In this reaction, n is the number of electrons, and indicates that the metal, , becomes a positively charged ion after oxidation.
3.1.Governing Equations
The equation is in accordance with the API 570 standard related to the corrosion of oil pipelines, through which corrosion rates are calculated in the short and long term, as well as calculating the remaining operational life of the pipes as a result of corrosion and classifying corrosion into four levels, noting that these standards are used in Iraqi oil and gas companies. These assumptions are reflected in Equations (5) and (6).
1. The short term () corrosion rate of piping circuits shall be calculated from the following formula:
Where T is the thickness of the pipeline and is read using ultrasonic thickness gauges at certain points that are set according to the standards previously reviewed around the pipe. And the unit of is (mm/year).
2. The long term (.) corrosion rate of piping circuits shall be calculated from the following formula:
also, the unit of L.T is (mm/year).
Most codes recommend calculating both the long-term and short-term corrosion rates. We calculate the short-term corrosion rate by measuring the amount of metal lost between the last two thickness readings at a TML (thickness measurement location). We determine the long-term corrosion rate by calculating the metal loss between the initial and final thickness measurements at a specific time. We do this using a technique known as Total Metal Loss (TML).
Due to the frequent changes in inspection process conditions over the equipment's lifespan, the short-term corrosion rate is typically a more accurate representation of the current conditions. However, the accuracy of the corrosion rate is more likely to be compromised when there are imprecise thickness readings. The corrosion rate over a long period of time is minimally influenced by imprecise measurements of thickness.
In remaining-life estimations, the corrosion rate typically considered is the higher value between the long-term and short-term rates. Depending on the short- or long-term, corrosion rates are classified into four categories:
- Low if corrosion rate less than (0.025)
- Moderate if corrosion rate between (0.025 ˗ 0.12)
- High if corrosion rate between (0.13 ˗ 0.25)
- Severe if corrosion rate larger than (0.25)
Remaining Life Calculations:
The remaining life at a specific thickness measurement location is the length of time remaining until this point corrodes to the retirement thickness.as show in Equation (7).
Where is required is thickness measurement by design formals before corrosion allowance and manufacture tolerance are added. Note when installing new piping systems or modifying existing ones, it is necessary to use one of the following methods to establish the expected corrosion rate. This will allow us to predict the remaining material thickness at the time of the next inspection.
- The client can determine the corrosion rate of a piping circuit by analyzing data on piping systems made of the same material and used under similar conditions.
- If data for the same or similar service is unavailable, one can calculate the corrosion rate for a pipe circuit using the owner's or user's experience or published statistics on piping systems in comparable service.
- If none of the methods mentioned in Item (1) or Item (2) we can determine the corrosion rate, conduct the initial thickness measurements of the piping system within 3 months of service using nondestructive techniques. Corrosion monitoring instruments, such as corrosion coupons or corrosion probes, might be helpful in determining the time of these thickness measurements. We will take successive measurements at suitable intervals until we determine the corrosion rate.
For Current Piping Systems Corrosion rates must be computed either in the short-term or the long-term. For the short-term calculation, data from the two most recent inspections will be utilized. For the purposes of long-term calculation, the wall thicknesses obtained from the most recent and original (or nominal) inspections should be utilized. Typically, it is advisable to utilize the higher of these two rates for estimating the remaining lifespan and determining the subsequent inspection interval.
4.Method Pipeline Corrosion Detection and Localization
This study is divided in two parts first one focus on visually detecting corrosion (external corrosion) by using 2DCNN.Corrosion is the deterioration of a metal and can be visually identified by its color. Therefore, the first method uses traditional computer vision techniques to extract parts of images that include corrosion, based on their color It was obtained via drones for places that cannot be reached due to their location this data used for classification if there is corrosion or not After that, all parameters related to this classification are calculated .The second part focuses on (internal corrosion) by employs 1DCNN, deep learning computer vision algorithms focus on the dataset that obtained from ultrasonic sensors to read the thickness of multi points on pipeline after that corrosion rates were calculated for each point. by the function of the regression, we can determine the location of the highest corrosion in the pipe, in addition to calculating the remaining operational life of that pipe, as well as evaluating the corrosion rate. Note that all the data was provided by Iraqi oil companies. Fig. 4 displays the suggested methodology flowchart for employ CNN to classification of corrosion.
4.1.External corrosion (Data Collection)
Supervised learning uses 'labeled data' to train neural networks. The data, which may consist of an image, will contain information about the presence or absence of corrosion in that image. Generally, a larger amount of training data results in higher accuracy in deep learning. Research has shown that utilizing a larger amount of training data is more effective than using more properly labeled data to create supervised learning models, as long as there are not many instances of wrong labeling of the training data, also known as adversarial labeling [61]-[63]. To establish a robust and comprehensive correlation between the inputs and desired outputs, a sufficient quantity of data is required. Labeling vast quantities of data is the initial and crucial stage in creating precise deep learning models, especially when a publicly accessible dataset is not available. This research involves categorizing the dataset into two distinct groups: corrosion and no corrosion. The complete dataset comprises a total of 162 photos, consisting of 91 images depicting corrosion and 71 images showing no signs of corrosion. Professionals specializing in corrosion engineering obtained the photographs from the Iraqi oil company and analyzed them.
4.1.1.Data Exploration
We divided the complete dataset into three parts: 70% for training, 20% for validation, and 10% for testing. The three groups of datasets exhibit the same ratio of corrosion and no corrosion, with 56.2% of the photos depicting corrosion and 43.8% depicting no corrosion, as illustrated in Fig. 5. Next, these images were processed through the pixel normalization and data augmentation.
4.1.2.Normalization of Pixels
In the case of image data, the pixel values are whole numbers that range from 0 to 255. When neural networks analyze inputs with greater weight values, their learning process decelerates. Normalizing pixels involves scaling the integer values to a range of 0 to 1. This technique optimizes computational efficiency and is considered very beneficial.
4.1.3.Data Augmentation
Data augmentation might be necessary if the training data is insufficient to create a model that can be applied broadly. So, it might be beneficial to consider implementing various approaches. One possible approach is to over sample the data, which involves generating additional data points that are similar to the training data. However, this can potentially result in over-fitting, as generating excessively similar data points in the training set can negatively impact performance during testing. Additionally, we implemented several image augmentations, including zooming in, sheering, horizontal flipping, and vertical flipping. Implementing data augmentation is a valuable technique to increase the amount of data in the current dataset and introduce slight modifications and variations to prevent the model from becoming too specialized to the training data.
4.1.4.Modelling
The optimal performance model we discovered consists of four 2D convolutional layers, each of which is then followed by a max-pooling layer. In addition, we incorporated a drop-out layer following each max-pooling layer in order to mitigate over fitting to the training dataset. Eventually, after undergoing flattening, it is inputted into a fully connected layer that employs ReLU activation. Finally, we employed the sigmoid activation function to estimate the output probabilities for this binary classification task. As depicted in Fig. 6.
We utilized Jupyter Notebook within the Anaconda Navigator, specifically employing Python 3.7, in conjunction with TensorFlow 2.1 and Keras libraries. The system functioned on the Windows 11 operating system, utilizing an Intel i9 and nvidia geforce gtx 1650. All classification parameters were calculated based on the following equations.
Equations (8), (9), (10), (11), and (12) are utilized to assess the classification efficacy of different methods and additional variables.
TP, TN, FP, and FN represent the acronyms for true positive, true negative, false positive, and false negative respectively, we obtained an accuracy of training of about 86.81%.
4.2.Internal Corrosion (Data Collection)
Advancing to the next stage, we enhanced our methodology to not only classify the existence or nonexistence of external corrosion but also to estimate the location with the most significant rate of internal corrosion on the pipeline and assess the remaining lifespan of the pipeline. We classified the corrosion into four levels using MATLAB 2023b, incorporating regression methods, particularly CNN regression. This cutting-edge technology enables us to estimate uninterrupted numerical values, such as the precise position and rate of corrosion in a transmission line.
4.2.1.Data Collection
The oil field operator collected the data using ultrasonic sensors installed along the length of the oil pipe. We divided these sensors into three groups (A, B, and C): group A at 2.5 km, group B at 5 km, and group C at 7.5 km. The company operating the oil field approved these distances based on their engineering examination standards. Each group comprises four sensors. Four sensors were placed around the perimeter of the oil pipe at each of 12 o’clock, 3 o’clock, 6 o’clock, and 9 o’clock to read the thickness periodically. The thickness of the oil pipe at those points was read from each sensor, The size of the collected datasets is (250 rows of pipeline thickness obtained from sensors) and on the basis of these readings, the corrosion rate was calculated for each point. As for the slope, it can predict the highest corrosion rate according to the criteria of API 570, classify this corrosion, locate the sensor that indicates the highest wear rate, and calculate the remaining operational lifespan of the pipeline based on these rates. Table 1 shows the sample of this data that was gathered.
| Sensor’s location | Initial wall Thickness (mm) | Sensors Group A (mm) | Sensors Group B (mm) | Sensors Group C(mm) |
|---|---|---|---|---|
| 12 o’clock | 12 | 11.880 | 11.760 | 11.977 |
| 3 o’clock | 12 | 11.975 | 11.890 | 11.770 |
| 6 o’clock | 12 | 11.750 | 11.976 | 11.880 |
| 9 o’clock | 12 | 11.976 | 11.900 | 11.745 |
Based on the ultrasonic sensor readings from the previous table, Table 2 shows the corrosion rates for one year and Table 3. show the remaining lifespan if these rates persist. The American Petroleum Institute's standards guided all calculations.
Important remark All ultrasonic thickness sensors require calibration based on the sound velocity in the material under measurement. Coatings exhibit a distinct speed of sound compared to metal, so it is essential to exclude them from the measurement. By utilizing several echoes, the measurement process effectively eliminates all coatings, regardless of their thickness, up to 6 mm. The used probe is a 2.25 MHz probe that is effective for inspecting highly corroded metal. The resolution of the device is 0.1 mm (0.005 inch), and its accuracy is ±0.1 mm (0.005 inch). The device sends out an ultrasonic pulse that passes through both the coating and the metal, then bounces back from the wall behind. Only a fraction of the reflected sound wave passes through the coating each time it resonates within the metallic material. The temporal intervals between the minor reverberations provide information on the temporal intervals of the reverberations within the metallic material, which are indicative of the thickness of the metal. The gauge will automatically interpret the echoes and calculate the thickness. The 2.25 MHz probe has a wide measurement range, which is generally considered suitable for most applications. This technology is commonly known as the automatic measurement verification system, as depicted in the Fig. 7.
| Sensor’s location | C.R GroupA (mm/year) | C.R Group B (mm/year) | C.R Group C (mm/year) |
|---|---|---|---|
| 12 o’clock | 0.120 | 0.240 | 0.023 |
| 3 o’clock | 0.025 | 0.110 | 0.023 |
| 6 o’clock | 0.250 | 0.024 | 0.120 |
| 9 o’clock | 0.024 | 0.100 | 0.255 |
| Sensor’s location | R.L GroupA (year) | R.L Group B (year) | R.L Group C (year) |
|---|---|---|---|
| 12 o’clock | 49 | 24 | 260 |
| 3 o’clock | 239 | 54 | 25 |
| 6 o’clock | 23 | 249 | 49 |
| 9 o’clock | 249 | 59 | 23 |
4.2.2.1DCNN Regression Architecture
Developed a one-dimensional CNN model specifically tailored to learn the correlation between input data from ultrasonic sensors and the corrosion rate of an oil pipelines.
- Input layer: Specify the dimensions of the data input in this layer. We possess a total of twelve columns. Denotes the recorded data from the sensors.
- Convolution layer: we used dual-layer each of it is contains of a set of filters 16 (3x3) whose parameters need to be learned. The height and weight of the filters are smaller than those of the input volume. Each filter is convolved with the input volume to compute an activation map made of neurons.
- Relu layer: It is a non-linear activation function used in multi-layer neural networks or deep neural networks. Two layers of ReLU were used for our system.
- Fully connected layer: A neural network with a fully connected layer connects each input node to each output node. Not all nodes in a convolutional layer have connectivity. We are using two layers of FC; these layers consist of a singular neuron that produces a value representing the predicted level of corrosion.
- Regression layer: The aim of regression is to identify how the input variable (explanatory variable) influences the output variable (response variable). Typically, we employed regression tasks, such as the prediction of continuous variables like the corrosion rate error.
Following the planning of CNN's structure. Follow the steps in the 1DCNN flow chart in Fig. 8 to process the dataset.
4.2.3.Regression Process
The next step involves splitting the dataset into a 70% training set and a 30% testing set after loading it into the input layer. This allows for evaluating the model's performance and measuring its accuracy. Utilize regression techniques, specifically 1D CNN regression, to predict the rate and location of corrosion and calculate the operating life based on these results, just like a data scientist would. We have the capability to project continuous numerical values using advanced technology. Just like a data scientist, we employed CNN regression and calculated various metrics to assess the precision of our forecasts. as represented by equations (13), (14), (15), (16), and (17).
1. Mean square error (MSE)
2. Root mean square error (RMSE)
3. Mean Absolute Error (MAE)
4. Root Mean Absolute Error (RMAE)
5. Relative Error (RAE)
Where: is number of samples; is the actual target value; is the predicated value
Through the computation of these metrics, we can thoroughly assess the effectiveness of our CNN regression model in accurately predicting the location of corrosion and estimating the lifespan of pipelines. This enables us to assess the precision and enhance the regression training procedure.
4.2.4.MATLAB App Designer
We have completed the regression training and computed the system parameters. The code underwent a transformation process to create a user-friendly platform using MATLAB App Designer. We chose this approach due to its recognized ability to enhance accessibility and usability. App Designer, with its user-friendly graphical user interface (GUI), enables the development of interactive MATLAB apps. Fig. 9 illustrates the completed final design.
The first field represents the initial thickness of the pipe before corrosion, and the second field represents the time period over which the inspection was performed. The other fields represent the inputs of the sensors to read the thickness of the pipe after it has been exposed to corrosion, according to the points where these sensors were installed. When you press the scan button, the highest corrosion rate will be calculated based on the API 570 standard equations, as well as the classification of this corrosion (LOW, MODERATE, HIGH, SEVERE), determining the location of this corrosion, and calculating the remaining operational life.
5.The Results
The progress of training our deep learning model (2DCNN) for external corrosion across each epoch is shown in Fig. 10. The model terminated prematurely at epoch 40 out of a total of 100 epochs when the selected performance metric, which aims to minimize loss, ceased to show any further improvement. To address this issue, we can introduce a delay in the trigger mechanism based on the desired number of epochs without any observed improvement. We can achieve this by adjusting the level of "tolerance." For this particular scenario, we assigned a value of 7 to the variable patience.
From the chart on the left, it is evident that as the number of epochs rises, the lines representing validation loss and training loss converge. This indicates that our model does not exhibit significant overfitting or underfitting. In the chart on the right, the line representing the accuracy scores for training and validation gradually comes together and reaches a point of near equality towards the conclusion.
The AUC value of our test reaches 93.31%, indicating that our top-performing CNN model effectively ranks the data by its class in the test set Fig. 11. show the ROC curve and Confusion Matrix.
The aim of this research is to get a high recall rate for the detection of corrosion. This is crucial since any instances of missed corrosion data or delayed treatment can result in the catastrophic breakdown of structures, leading to the loss of resources or lives. The highest-performing model in our study achieved a recall rate of 85.86%, confirming exceptional accuracy in detecting corrosion. The confusion matrix, as seen in Fig. 11, indicates that our model accurately categorized the rate of true positives and true negatives at 46.70% and 40.11%, respectively, in the test set. Simultaneously, the rate of false positives and false negatives is 8.79% and 4.4%, respectively, indicating that our model performed adequately in identifying whether an image exhibits corrosion or not. All these parameters are calculated as shown in Table. 4.
After achieving high accuracy in the classification step, the next phase employs a one-dimensional convolutional neural network (1DCNN). Fig. 12 demonstrates a favorable level of accuracy in both the training and testing phases. The validation root mean square error (RMSE) is 0.05567, and the method chapter gives a full analysis of how well the CNN regression model predicts the rate of internal corrosion in oil pipelines. This evaluation involves measuring all parameters related to the regression topic. This enables us to assess performance and make necessary enhancements. Improve training outcomes by ensuring that the dataset is both balanced and varied and by increasing the size of the dataset.
| Parameters | Value |
|---|---|
| Accuracy | 0.8681 |
| Precision | 0.8947 |
| Recall | 0.8586 |
| Specificity | 0.8795 |
| F1-Score | 0.8763 |
Fig. 13 displays the visualized predictions. The horizontal axis corresponds to the actual values, while the vertical axis, or y-axis, corresponds to the predicted values. We observe that the regression line intersects above the diagonal line, symbolizing the ideal prediction. Fig. 14 displays the visualized predicted value aligning with the true value, indicating a commendable evaluation performance of our CNN model.
Throughout this procedure, we made alterations to various training parameters, including the quantity of layers, learning rate, epoch, and batch size, in order to attain the most optimal results. Prior to model construction, data preprocessing is essential. Preprocessing the data prior to feeding it into the neural network expedites the convergence of weight parameters, leading to optimal performance. We conducted an evaluation of the system's overall performance and computed the parameters for assessment, as shown in Table 5. Data examination processes using GUI shown in Fig. 15.
| Parameters | Value |
|---|---|
| Mean Square Error | 0.00311 |
| Root Mean Square Error | 0.19530 |
| Mean Absolute Error | 0.00993 |
| Root Mean Absolute Error | 0.09966 |
| Relative Error | 0.00040 |
6.Conclusion
This study aims to create two models of networks (2DCNN for external corrosion) and (1DCNN for internal corrosion) while previous research has focused on one of them only, internal corrosion or external corrosion. We relied on real data provided to us by companies specialized in the oil field, whether in the form of pictures of corrosion or reading ultrasonic sensors of pipe thickness.as mentioned in the methodology section we used the two-dimensional neural network (2D CNN) for classification to examine the presence or absence of external corrosion from the images provided via drones especially to the places that are difficult to reach we labeled these images, upload it to our 2DCNN model, and tune parameters to get the best performance possible for the CNN model after obtaining all the parameters responsible for evaluating the network, we moved to the next stage we use one-dimensional neural network for regression to calculate the corrosion rates for each sensor and determine where the highest percentage of corrosion is located, then this percentage is relied upon for the purpose of calculating the remaining life of the oil pipe.
6.1.Limitations of Our Work
This study suggests constructing a deep learning model utilizing the Convolutional Neural Network (CNN) approach to automatically learn and identify corrosion behaviors. The results validate that the applied deep learning Convolutional Neural Network (CNN) algorithm is a highly promising technique for the automatic identification of corrosion. Our model can effectively identify corrosion problems with high precision by providing a diverse range of corrosion images. An automated corrosion detection model with high accuracy can decrease the expenses associated with corrosion inspections and minimize the risk to people's lives. Despite the effectiveness of this study in early detection of corrosion, whether internal or external, there are still some limitations, which are:
- The process of gathering data from ultrasonic devices or drones takes a long time, so this work needs a lot of data history about the study topic before using it.
- The classification, localization, and prediction results of corrosion detection will not be as accurate if the data set or number of sensors is not enough.
- External factors could cause the sensors to record wrong information, which could lead to a false result.
- If one of the devices malfunctions, it could lead to the entry of incorrect information, disrupting corrosion detection and other processes that rely on it.
6.2.Comparison with Previous Research
The use of deep learning techniques does not require the installation of additional equipment or high human resources, so this method reduces the costs of traditional projects and also reduces human intervention, which over time may lead to some unintended errors. This method also contributes to reducing the time required to detect corrosion and make Proactive maintenance. This technique is easier to understand than most others used in this field, and it gives very accurate results for both corrosion rate and location.
6.3.The primary Obstacles Encountered in this Study
- Sparse Data Challenges: The data of pipeline corrosion, especially related to detecting corrosion, frequently contains gaps and inconsistencies. Convolutional neural networks (CNNs) necessitate a substantial amount of data to achieve optimal performance. And also, Insufficient data can lead to models exhibiting overfitting or poor generalization.
- One limitation of class imbalance of data is that the distribution of corrosion and non-corrosion events is often unbalanced. Convolutional neural networks can face difficulties when dealing with imbalanced datasets, leading to biased predictions or decreased efficiency in detecting corrosion.
- Data requirement: Initially, during the research, the quantity of data needed to accurately represent corrosion (in the form of images or a dataset from pipeline inspection) was unknown.
6.4.The Following are Recommendations for Further Study in this Field
There is a possibility of further enhancement in the next work. In order to enhance the overall accuracy of the model, it is vital to augment both the quantity and diversity of the dataset. Previous research in corrosion detection observed that an artificial intelligence model requires 65,000 labeled images to achieve accuracy comparable to human level [64].
The labeled images have a significant impact on the model training when considering model accuracy. The quality of image tagging directly influences the rate at which the model improves in accuracy. Identifying corrosion is a profoundly difficult task. Experts with comprehensive knowledge of the various materials involved are required to proficiently annotate corrosion photographs of superior quality. Furthermore, it requires the expertise of specialists to evaluate the distinction between substances that could potentially be brown or red paint and the process of corrosion.
Increasing the number of ultrasonic sensors along oil pipelines or crude oil tanks is necessary for the purpose of increasing the accuracy of the results of this system. It is also possible to include additional sensors, whether temperature or humidity sensors, and operate them in accordance with the standards of the American Petroleum Institute.
Author Contribution: All authors contributed equally to the main contributor to this paper. All authors read and approved the final paper.
Funding: This research received no external funding.
Conflicts of Interest: The authors declare no conflict of interest.
References
Original publication: International Journal of Robotics and Control Systems. CC BY-SA 4.0. This reading version reformats the supplied article for browser presentation and converts TeX equations to MathML.
Publication information
Published: 2024-06-25