Attention-enhanced convolutional neural network-based steel atmospheric corrosion assessment method
By introducing an attention-enhanced convolutional neural network model with a dual attention mechanism, the limitations of traditional methods (time-consuming and labor-intensive) and traditional machine learning models (in handling complex nonlinear relationships and high-dimensional data) are overcome. This enables accurate prediction of steel corrosion rate and provides higher prediction accuracy and interpretability.
Patent Information
- Application Number
- CN202510929142.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-12-05
AI Technical Summary
In existing technologies, traditional machine learning algorithms lack the expressive power to handle complex nonlinear relationships and high-dimensional data, which makes it difficult for traditional machine learning methods to effectively solve complex nonlinear problems.
An attention-enhanced convolutional neural network (NEN) method for assessing atmospheric corrosion of steel is proposed. By introducing a dual attention mechanism, an NNN model is constructed, which overcomes the limitations of traditional machine learning models in complex nonlinear relationships and high-dimensional data, and achieves more efficient prediction of steel corrosion rate.
It achieves accurate prediction of steel corrosion rate, solves the problems of time-consuming and labor-intensive traditional methods and insufficient expressive power of traditional machine learning models, and provides higher prediction accuracy and interpretability.
Smart Images

Figure CN121075459A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of metal material corrosion prediction in atmospheric environment, and particularly relates to a steel atmospheric corrosion evaluation method based on an attention-enhanced convolutional neural network. BACKGROUND
[0002] Steel is widely used in various fields such as construction industry, machinery manufacturing industry, and transportation industry due to its convenient construction, high strength, and good plasticity. However, steel is prone to serious corrosion in atmospheric environment, which leads to degradation of its mechanical properties and further threatens people's life safety and economic property. Data shows that safety accidents caused by corrosion account for 31.8% and 25%-30% of all accidents in the United States and China, respectively; the total cost of corrosion worldwide is about 2.5 trillion US dollars, accounting for 3.4% of global GDP (2013). Therefore, accurate understanding and prediction of the corrosion rate of steel are of great significance for evaluating material life and reducing corrosion cost.
[0003] Traditional corrosion evaluation methods rely on long-term atmospheric exposure tests, accumulate a large amount of data, and study the corrosion behavior of steel through traditional mathematical analysis methods such as curve fitting and multiple linear regression. However, this method is time-consuming and labor-intensive, and the empirical theoretical model proposed may oversimplify the corrosion behavior due to basic assumptions, and is only effective for a certain type of steel or a certain environmental condition. In recent years, machine learning algorithms have provided a new way for corrosion prediction. Traditional machine learning algorithms such as grey correlation analysis, decision tree, random forest, and support vector machine have shown high prediction accuracy and robustness in the field of corrosion prediction. However, traditional machine learning methods still have certain limitations. On the one hand, they are difficult to capture the complex nonlinear relationship between input variables, and have insufficient modeling capability for high-dimensional data. On the other hand, traditional machine learning methods may also perform poorly under certain extreme conditions or when the data complexity is high.
[0004] Deep learning technologies such as convolutional neural networks have shown excellent performance in handling complex problems. Compared with traditional machine learning algorithms, deep learning can automatically extract deep features in data through hierarchical structure and effectively capture complex nonlinear relationships between variables. In addition, as an important element of deep learning, the attention mechanism can dynamically adjust the weight distribution of input variables, enhancing the accuracy and interpretability of the model, and is widely used to improve the performance of deep learning models such as convolutional neural networks. SUMMARY
[0005] The present application aims to overcome the deficiencies of the prior art, and provide a steel atmospheric corrosion evaluation method based on an attention-enhanced convolutional neural network, which can solve the problems of limited application range of empirical theoretical models, long time consumption of data acquisition, weak expression ability and generalization ability of traditional machine learning models, and poor interpretability, and can provide a more accurate and scientific prediction result.
[0006] The present application solves its technical problems by the following technical solutions: A steel atmospheric corrosion evaluation method based on an attention-enhanced convolutional neural network, the steps of the method are: S1, collecting atmospheric corrosion data of carbon steel, low alloy steel and weathering steel in a typical meteorological area, including meteorological environment, material composition, exposure time and corresponding corrosion rate, and constructing a multi-element corrosion data set; S2, normalizing the constructed multi-element corrosion data set, and dividing it into a training set and a test set according to a ratio of 80% and 20%; S3, introducing a double attention mechanism into a convolutional neural network to construct an attention-enhanced convolutional neural network model; S4, training the attention-enhanced convolutional neural network model using the training set, and optimizing the hyperparameters using a ten-fold cross-validation method; S5, evaluating the generalization ability of the trained attention-enhanced convolutional neural network model in an unknown data set using the test set, for predicting the corrosion rate of steel.
[0007] Moreover, the meteorological environment in S1 includes annual average relative humidity (%), annual average temperature (℃), rainfall (mm / month), rainwater pH (pH), sulfur dioxide deposition rate (mg / 100cm 2 ·d), and chloride deposition rate (mg / 100cm 2 ·d); the material composition includes the content of 13 chemical elements of C, Mn, S, P, Si, Cr, Cu, Ni, Mo, Nb, Al, Re, and V.
[0008] Moreover, the normalization in S2 adopts mean-variance normalization, which puts all atmospheric corrosion data into a distribution with a mean of 0 and a variance of 1, and the expression is: ; Wherein: is the atmospheric corrosion data, is the mean of the data, is the standard deviation of the data.
[0009] Moreover, S3 is specifically: S3.1 The input data first passes through four convolutional layers. Each layer includes a convolution operation, batch normalization, an activation function, and a Dropout layer. The convolution operation refers to each convolutional kernel sliding along the spatial dimension of the input data to extract local features. The output after the convolution operation is standardized by batch normalization to adjust the mean and variance of each channel, accelerating training and stabilizing the network. Then, the Tanh activation function is used to increase the non-linearity of the model to learn complex mapping relationships. Dropout is also applied after each layer to reduce overfitting by randomly discarding the output of some neurons. S3.2. Concatenate the outputs of the first 3 convolutional layers with the original input to help the model utilize the input data more efficiently and retain sufficient information in the deep structure. S3.3 In the fourth convolutional layer, the input weights are adjusted through channel attention and spatial attention mechanisms to help the model focus on more critical features; S3.4 After all convolutional layers, a global average pooling layer is introduced to reduce the dimensionality of the feature map, compressing the features of each channel into a scalar and reducing the dimensionality of the data. The features after global average pooling are further transformed by a fully connected layer. The fully connected layer gradually maps the features to the final output layer and adds non-linearity through ReLU and ELU activation functions. Finally, the prediction result is generated by the output layer, and the erosion rate is output.
[0010] Furthermore, in the S4 training process, the erosion rate is used as the target output, the remaining feature information is used as the model input, and smooth L1 loss is specified as the loss function, with RMSprop as the optimizer. ; In the 10x cross-validation process, the mean absolute percentage error (MAPE) of the validation set is used as the optimization objective. ; in: This is the actual value. is the predicted value, and n is the number of samples.
[0011] Furthermore, the evaluation metrics for generalization ability in S5 include mean absolute percentage error (MAPE), root mean square error (RMSE), mean absolute error (MAE), and squared error (R²). 2 ; ; ; ; .
[0012] The advantages and beneficial effects of this invention are as follows: 1. The application develops an attention-enhanced convolutional neural network model, which can quickly and accurately predict the corrosion rate of steel in atmospheric environment. On the one hand, it solves the problem of time-consuming and long test period in the traditional corrosion evaluation method based on a large number of long-term tests; on the other hand, it solves the limitations of traditional machine learning algorithms in dealing with complex nonlinear relationships and high-dimensional data.
[0013] 2. The application fully considers the influence of meteorological conditions, material composition and corrosion time characteristics on the corrosion degree of steel, and adjusts the weight of each feature by introducing a double attention mechanism, helping the model to extract the internal relationship between meteorological conditions, material composition and corrosion time, and focus on the most important features, further enhancing the solvability and prediction ability of the deep learning model.
[0014] 3. The application provides a new, fast and accurate prediction method for steel corrosion evaluation in atmospheric environment, and the technical advantages involved in the application can also provide method guidance for the application of deep learning in other fields. BRIEF DESCRIPTION OF DRAWINGS
[0015] Figure 1 is the flowchart of the application; Figure 2 is the structure diagram of the attention-enhanced convolutional neural network model of the application; Figure 3 is the prediction result diagram of the attention-enhanced network convolutional neural network model and the convolutional neural network model in the training set and the test set constructed by the application; Figure 4 is the SHAP value summary diagram of the corrosion rate prediction model of the attention-enhanced convolutional neural network constructed by the application. DETAILED DESCRIPTION
[0016] The application will be further described in detail below through specific embodiments, which are only descriptive and not limiting, and cannot limit the protection scope of the application.
[0017] As shown in Figure 1 An atmospheric corrosion evaluation method for steel based on an attention-enhanced convolutional neural network, the innovation of which lies in that the steps of the method are: Step S1: Collecting atmospheric corrosion data of carbon steel, low alloy steel and weathering steel in typical meteorological areas, including meteorological environment, material composition, exposure time and corresponding corrosion rate, and constructing a multivariate corrosion database based on the data.
[0018] In this embodiment, 698 sets of corrosion data are collected, which are mainly from 7 different atmospheric corrosion test sites in China, including Beijing, Qingdao, Wuhan, Jiangjin, Guangzhou, Qionghai and Wanning, which basically represent the typical climate conditions in China. The annual average relative humidity, annual average temperature, rainfall, rainwater pH, sulfur dioxide and chloride ion deposition rate of these areas are selected as the meteorological environment input of the model; there are 24 kinds of steel materials, including 15 kinds of weathering steels, 3 kinds of low alloy steels and 6 kinds of carbon steels, and the contents of 13 chemical elements C, Mn, S, P, Si, Cr, Cu, Ni, Mo, Nb, Al, Re and V are selected as the material composition input of the model. The detailed statistical results of the input and output characteristics of the multivariate corrosion database are shown in Table 1.
[0019] Table 1
[0020] Step S2: The collected data set is normalized, and the training set and the test set are divided according to the ratio of 80% and 20%; In order to prevent the influence of dimension and accelerate the convergence speed of the model, the features in the multivariate database are subjected to mean-variance normalization processing, and all the data are brought into the distribution with a mean of 0 and a variance of 1, and the expression is: ; Among them: is the atmospheric corrosion data, is the mean of the data, is the standard deviation of the data. Then the data in the multivariate database is randomly divided into two kinds, of which 80% of the data is used as the training set and 20% of the data is used as the test set. Most of the data is used for training to ensure that the model can be fully learned, and less data is used for testing to evaluate the performance of the model.
[0021] Step S3: A double attention mechanism is introduced into the convolutional neural network to construct an attention-enhanced convolutional neural network model. A reasonable and scientific model framework is the core of machine learning to effectively extract sample features and reveal the relationship between them and the target attributes. Therefore, according to the characteristics of the corrosion data, an advanced and efficient attention-enhanced convolutional neural network model is developed by using the Pytorch deep learning framework, and the specific structure is as shown in Figure 2 .
[0022] The model includes 4 convolutional layers, 1 pooling layer, 1 flattening layer, 2 fully connected layers and 1 output layer. Each convolutional layer extracts features through convolution operation, cooperates with batch normalization, activation function and Dropout to reduce overfitting; the pooling layer reduces the dimension of the feature map after convolution, and the flattening layer further converts multi-dimensional data into one dimension; the fully connected layer maps the features of the flattened data, and finally generates a prediction value through the output layer. Data is transmitted between layers through convolution, pooling, flattening and full connection, and features are gradually extracted and learned, and finally the prediction result is obtained.
[0023] First, the input features (meteorological environment, material composition, corrosion time) pass through 4 convolutional layers, each of which includes convolution operation, batch normalization, activation function and Dropout layer. Convolution operation refers to the sliding of each convolution kernel in the spatial dimension of the input data to extract local features; the output after convolution operation is standardized by batch normalization to adjust the mean and variance of each channel, accelerate training and stabilize the network; then, the Tanh activation function is used to increase the nonlinearity of the model to learn complex mapping relationships; Dropout is applied after each layer to reduce overfitting by randomly discarding the output of some neurons.
[0024] Further, the outputs of the first three convolutional layers are spliced with the original input to help the model more efficiently use the input data and still maintain sufficient information in the deep structure.
[0025] Further, in the fourth convolutional layer, the input is adjusted by channel attention and spatial attention mechanisms to help the model focus on more critical features.
[0026] Further, after all convolutional layers, a global average pooling layer is introduced to reduce the dimension of the feature map, compressing the features of each channel into a scalar and reducing the dimension of the data; the features after global average pooling are further converted by the fully connected layer, which gradually maps the features to the final output layer, and the ReLU and ELU activation functions are used to increase the nonlinearity; finally, the prediction result is generated by the output layer, and the corrosion rate is output. The detailed structure of the convolutional neural network model of the present application is shown in Table 2.
[0027] Table 2
[0028] Step S4: training the attention-enhanced convolutional neural network model constructed by using the training set samples, and optimizing the hyperparameters by using the ten-fold cross-validation method; The corrosion rate is taken as the target output, and the remaining feature information is taken as the input of the model for model training. The smooth L1 loss is specified As a loss function, it is a balance between L1 loss (absolute error) and L2 loss (squared error). By calculating the loss function, the model can understand its prediction error, and then update the parameters through the optimizer in the training process to reduce the error.
[0029] Further, RMSprop is specified as the optimizer, which is commonly used to handle optimization problems of non-stationary objectives. In the training process, RMSprop adaptively adjusts the learning rate of each parameter according to the feedback of the loss function, thereby accelerating the convergence and effectively preventing the problems of gradient explosion or gradient disappearance.
[0030] Further, the training set is used to perform ten-fold cross-validation on the model, and the average absolute percentage error of the validation set is used as the evaluation index. As an optimization target. The purpose of cross-validation is to repeatedly verify the performance of the model on the training set, helping to select a better hyperparameter configuration that can be generalized. The selection of hyperparameters is closely related to the performance of machine learning, such as learning rate, Batchsize, and training times, which control the learning effect of the model. The final optimized initial learning rate is 0.01, the Batchsize is 16, and the training times are 100.
[0031] Step S5: Use the test set samples to evaluate the generalization ability of the trained attention-enhanced convolutional neural network model in the unknown data set. The final model is used for predicting the corrosion rate of steel.
[0032] Further, the above trained and saved attention-enhanced convolutional neural network model is used to test its generalization ability in the unknown data test set. The evaluation indexes used are MAE, RMSE, MAE and R 2 , R 2 The closer to 1, the smaller the other indicators, indicating that the accuracy of the model is higher.
[0033] The prediction effect of the attention-enhanced convolutional neural network model proposed in the application and the single convolutional neural network model on the corrosion rate is as shown in Figure 3 The two models have high prediction accuracy on the training set and the test set, among which the squared error of the test set can reach 0.912 and 0.927 respectively, and the average absolute error can reach 3.67 and 3.36 respectively. The specific evaluation indexes are shown in Table 3. At the same time, the introduction of the attention mechanism improves the accuracy of the model in estimating the corrosion rate of steel. This enhanced performance is mainly due to the fact that the attention mechanism can effectively identify key features. From the specific performance evaluation indexes of the two models, it can be seen that the attention-enhanced convolutional neural network model is better than the convolutional neural network model in terms of each index, and the indexes MAE, RMSE, MAE and R 2They increased by 10.89%, 10.29%, 8.45%, and 1.64%, respectively.
[0034] Table 3
[0035] Furthermore, the attention-enhanced neural network model is explained. Although deep learning models perform well in predicting steel corrosion rates, they are often considered "black box" models, lacking a transparent explanation of the relationship between input features and the final prediction result. Therefore, the Shapley Additive Explanations (SHAP) method is used to explain the prediction mechanism of the convolutional neural network model with embedded attention. The SHAP method is based on cooperative game theory and quantifies the contribution of each input feature to the prediction result by calculating the Shapley value.
[0036] Furthermore, a summary graph of the SHAP values for attention-enhanced convolutional neural network models is shown below. Figure 4 As shown in the diagram, each point represents a sample, with its color corresponding to the color bar on the right, representing the magnitude of the feature value. The horizontal axis represents the SHAP value, with positive or negative values indicating the positive or negative impact of the input feature on the prediction result, respectively. The left vertical axis represents the feature names, arranged from top to bottom according to the degree of influence of the feature on the prediction result. It can be seen that among the external variables, corrosion time, rainwater pH, rainfall, relative humidity, and SO2 content are the main factors affecting the corrosion rate. Specifically, increases in corrosion time, rainwater pH, and rainfall have a negative impact on the corrosion rate of steel; increases in relative humidity and SO2 have a positive impact. Among the constituent elements of the material, the contents of Cu, Mo, Ni, P, and Cr have a significant impact on the corrosion rate, with higher contents corresponding to lower corrosion rates.
[0037] Although embodiments and drawings of the present invention have been disclosed for illustrative purposes, those skilled in the art will understand that various substitutions, variations and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the scope of the present invention is not limited to the contents disclosed in the embodiments and drawings.
Claims
1. A steel atmospheric corrosion evaluation method based on an attention enhanced convolutional neural network, characterized by: The steps of the method are: S1, collecting atmospheric corrosion data of carbon steel, low alloy steel and weathering steel in typical meteorological regions, including meteorological environment, material composition, exposure time and corresponding corrosion rate, and constructing a multi-corrosion data set; S2, normalizing the constructed multi-corrosion data set, and dividing it into a training set and a test set according to the ratio of 80% and 20%; S3, introducing a double attention mechanism in a convolutional neural network to construct an attention-enhanced convolutional neural network model; S4, training the attention-enhanced convolutional neural network model using the training set, and optimizing the hyperparameters using ten-fold cross-validation method; S5, evaluating the generalization ability of the trained attention-enhanced convolutional neural network model in unknown data set using the test set, for predicting the corrosion rate of steel.
2. The steel atmospheric corrosion evaluation method based on the attention enhanced convolutional neural network according to claim 1, characterized in that: The meteorological environment in the S1 includes annual average relative humidity (%), annual average temperature (°C), rainfall (mm / month), rainwater pH (pH), sulfur dioxide deposition rate (mg / 100cm 2 ·d) and chloride deposition rate (mg / 100cm 2 ·d); the material composition includes the contents of 13 chemical elements of C, Mn, S, P, Si, Cr, Cu, Ni, Mo, Nb, Al, Re, and V.
3. The method according to claim 2, wherein the method is characterized by: The normalization processing in S2 adopts mean-variance normalization, which puts all atmospheric corrosion data into a distribution with a mean of 0 and a variance of 1, and the expression is: ; where: is the atmospheric corrosion data, is the mean of the data, is the standard deviation of the data.
4. The steel atmospheric corrosion evaluation method based on the attention enhanced convolutional neural network according to claim 3, characterized in that: S3 specifically is: S3.1, the input data first passes through 4 convolutional layers, each layer contains convolution operation, batch normalization, activation function and Dropout layer, the convolution operation means that each convolution kernel slides in the spatial dimension of the input data to extract local features; the output after convolution operation is standardized by batch normalization to adjust the mean and variance of each channel, accelerate training and stabilize the network; then, the Tanh activation function is used to increase the nonlinearity of the model to learn complex mapping relationships; Dropout is also applied after each layer to reduce overfitting by randomly discarding part of the neuron output; S3.2, the outputs of the first three convolutional layers are spliced together with the original input to help the model more efficiently use the input data and still maintain enough information in the deep structure; S3.3, in the fourth convolutional layer, the input passes through channel attention and spatial attention mechanisms to adjust the weights, helping the model focus on more critical features; S3.4, after all convolutional layers, a global average pooling layer is introduced to reduce the dimension of the feature map, compressing the features of each channel into a scalar and reducing the dimension of the data; the features after global average pooling are further converted by a fully connected layer, which gradually maps the features to the final output layer, and the ReLU and ELU activation functions are used to increase the nonlinearity; finally, the prediction result is generated through the output layer to output the corrosion rate.
5. The steel atmospheric corrosion evaluation method based on the attention enhanced convolutional neural network according to claim 4, characterized in that: In the training process in S4, the corrosion rate is taken as the target output, the remaining feature information is taken as the input of the model, and the smooth L1 loss is specified as the loss function, and the RMSprop is used as the optimizer ; In the ten-fold cross-validation process, the mean absolute percentage error (MAPE) of the validation set is used as the optimization target, ; wherein: is the actual value, is the predicted value, n is the number of samples.
6. The method according to claim 5, wherein the method is characterized by: The evaluation index of the generalization capability in S5 adopts mean absolute percentage error MAPE, root mean square error RMSE, mean absolute error MAE, and square error R 2 ; ; ; ; 。
Citation Information
Patent Citations
Prediction method for corrosion rate in natural gas pipeline
CN119202558A
Product surface defect detection method and related hardware
CN119540221A