Petroleum pipeline leakage monitoring and early warning method based on deep learning
By combining semi-supervised variational autoencoder and improved DeiT model, self-supervised learning and teacher-student mechanisms are adopted to solve the problems of insufficient data and model overfitting in oil pipeline leakage monitoring, achieving more efficient and accurate leakage monitoring and early warning.
Patent Information
- Application Number
- CN202510334023.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-06-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing oil pipeline leakage monitoring technology has the problems of high sensor layout cost, high sensor failure rate, inaccurate monitoring data, and weak processing capabilities of traditional data analysis methods for high-dimensional data and complex modes. In addition, deep learning models perform poorly with a small amount of labeled data, are prone to overfitting, and lack multi-model fusion and joint optimization capabilities.
Using deep learning-based oil pipeline leakage monitoring and early warning methods, combined with semi-supervised variational autoencoder and improved DeiT model, potential features and leakage mode features are extracted to generate early warning signals by introducing self-supervised learning, teacher-student mechanisms and multi-model joint optimization.
It improves the accuracy and robustness of oil pipeline leakage monitoring, can effectively train with a small amount of labeled data, avoid overfitting, improves the generalization ability of the model, and improves adaptability and accuracy in complex scenarios.
Smart Images

Figure CN120083931A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of oil pipelines, and in particular to an oil pipeline leakage monitoring and early warning method based on deep learning. Background Art
[0002] As the global demand for oil energy continues to grow, the transportation mission of oil pipelines has become increasingly arduous, and the safety of pipelines has also received increasing attention. Oil pipeline leakage will not only lead to energy waste, but also cause serious pollution to the environment and even threaten personnel safety. Therefore, oil pipeline leakage monitoring and early warning have become particularly important. Existing oil pipeline leakage monitoring technologies can be roughly divided into two categories: sensor-based monitoring methods and data analysis-based monitoring methods.
[0003] The sensor-based monitoring method is one of the most common technical means for oil pipeline leak detection. Its principle is to arrange various sensors along the pipeline to monitor the environmental changes inside or around the pipeline in real time, such as changes in a series of physical quantities such as pressure, temperature, and flow. When these parameters fluctuate abnormally, the system will sound an alarm to indicate that there may be a leak. However, this method also has some significant defects. First, the sensor layout cost is high, and the sensor is prone to failure during long-term operation, resulting in loss or inaccurate monitoring data. Secondly, traditional sensor monitoring methods can usually only detect local anomalies in the pipeline and cannot fully and accurately reflect the leakage situation of the entire pipeline. It is prone to underreporting and false alarms.
[0004] On the other hand, monitoring methods based on data analysis have gradually become a research hotspot in recent years. This method uses data-driven technology, combined with a large amount of monitoring data, to conduct data mining and analysis, thereby achieving accurate prediction of pipeline leakage. Traditional data analysis methods mostly rely on manual feature extraction and traditional machine learning algorithms, such as support vector machines and decision trees. However, the performance of these methods is limited by data quality and feature selection, and their processing capabilities for high-dimensional data and complex patterns are relatively weak, making it difficult to cope with complex changes in real-time monitoring.
[0005] In recent years, deep learning technology has made significant progress in computer vision, natural language processing and other fields, and has also provided new ideas for oil pipeline leakage monitoring. Deep learning can effectively process high-dimensional data by automatically extracting complex features from the data, and has strong advantages in small sample learning and feature representation. In particular, the introduction of technologies such as variational autoencoders and self-attention mechanisms has further improved the performance of deep learning in processing complex data. By building an adaptive deep learning model, more efficient pipeline leakage pattern recognition and anomaly detection can be achieved, thereby improving the accuracy and real-time performance of leak detection.
[0006] However, although the application of deep learning in oil pipeline leakage monitoring has made certain progress, the existing technology still has some problems. First, the training of deep learning models usually requires a large amount of labeled data, and the acquisition of labeled data is often costly and difficult to obtain, especially in the specific field of oil pipelines, where leakage incidents do not occur frequently, resulting in the difficulty of training data to meet the data volume requirements of deep learning models. Secondly, traditional deep learning methods perform poorly when faced with a small amount of labeled data, which can easily lead to overfitting problems and affect the generalization ability of the model. In addition, most of the current pipeline leakage detection methods based on deep learning use a single model for training and lack the ability of multi-model fusion and joint optimization, resulting in their adaptability and accuracy in complex scenarios still need to be improved.
[0007] To address these problems, the present invention proposes a deep learning-based oil pipeline leakage monitoring and early warning method, which combines a semi-supervised variational autoencoder with an improved DeiT model. By introducing self-supervised learning, a teacher-student mechanism, and multi-model joint optimization, the accuracy and robustness of oil pipeline leakage monitoring can be effectively improved. This method can not only perform effective training with a small amount of labeled data, but also generate early warning signals through the joint learning of potential features and leakage pattern features, thereby providing more reliable technical support for the safe operation of oil pipelines. Summary of the invention
[0008] One purpose of the present invention is to propose a deep learning-based oil pipeline leakage monitoring and early warning method, which can provide an efficient and scientific optimization solution in oil pipeline leakage monitoring, bringing significant technical value and economic benefits to practical applications.
[0009] A deep learning-based oil pipeline leakage monitoring and early warning method according to an embodiment of the present invention includes the following steps:
[0010] S1. Obtain oil pipeline monitoring data and perform preprocessing;
[0011] S2. Construct a semi-supervised variational autoencoder, use unsupervised learning methods to mine the potential structure of unlabeled data, and combine it with a small amount of labeled data for supervised training;
[0012] S3, using semi-supervised variational autoencoder to learn the representation of oil pipeline monitoring data and extract potential features;
[0013] S4. The generated latent features are input into the improved DeiT model. The DeiT model extracts pipeline leakage pattern features by introducing self-attention mechanism and image transformation network for small sample learning.
[0014] S5. Optimize the self-supervised learning ability of the DeiT model by introducing a teacher-student mechanism. The teacher model trains the student model by generating pseudo-labels;
[0015] S6. Jointly optimize the semi-supervised variational autoencoder and the DeiT model. Through joint training, make the latent features mined by the semi-supervised variational autoencoder match the leakage pattern features extracted by the DeiT model, and generate early warning signals based on the trained semi-supervised variational autoencoder and DeiT model;
[0016] S7. Determine whether leakage occurs according to the early warning signal, analyze the monitoring results, and generate a final leakage monitoring report in combination with the early warning signal.
[0017] Optionally, S1 includes the following steps:
[0018] S11. Obtain oil pipeline monitoring data, including pressure, flow, and temperature data, and perform denoising processing using wavelet transform;
[0019] S12. Perform outlier detection, remove abnormal data points, and supplement missing data using interpolation;
[0020] S13. Normalize the processed oil pipeline monitoring data.
[0021] Optionally, S2 includes the following steps:
[0022] S21. Construct a semi-supervised variational autoencoder. The semi-supervised variational autoencoder performs a non-linear mapping on the input data x to obtain the probability distribution q(z|x) of the latent space z;
[0023] S22. In the semi-supervised variational autoencoder, use an unsupervised learning method to mine the latent structure of unlabeled data, and use the latent variable z to characterize the latent pattern of the input data by maximizing the variational lower bound:
[0024]
[0025] where ELBO represents maximizing the variational lower bound, px|z) is the likelihood of the reconstructed data generated by the decoder, and D KL q(z|x)∥p(z) is the Kullback-Leibler divergence between the latent space distribution qz|x) and the prior distribution p(z);
[0026] S23. Combine a small amount of labeled data y, optimize the decoder part of the VAE model by minimizing the reconstruction error and using a supervised training method:
[0027]
[0028] Among them, represents the reconstruction error, x represents the input data, z represents the latent space variable, and p(x|z) represents the probability of the reconstructed data generated by the decoder.
[0029] Optionally, S3 includes the following steps:
[0030] S31. Use a semi-supervised variational autoencoder to perform representation learning on the preprocessed monitoring data, map the input data x to the latent space, and generate the conditional probability distribution q(z|x) of the latent variable through the encoder;
[0031] S32. Extract the latent feature z of the input data;
[0032] S33. Regularize the latent feature z using the Kullback-Leibler divergence:
[0033]
[0034] Among them, q(z|x is the latent space distribution, and p(z) is the prior distribution.
[0035] Optionally, S4 includes the following steps:
[0036] S41. Input the latent feature z generated by the semi-supervised variational autoencoder into the improved DeiT model. The DeiT model uses a multi-head self-attention layer to perform weighted aggregation on the latent feature to obtain the output feature
[0037]
[0038] Among them, W o is the linear transformation weight of the final output, represents the result of each attention head, h is the number of heads, and Concat. represents the concatenation operation;
[0039] The result of each attention head is calculated as:
[0040]
[0041] Among them, Q is the query vector, K is the key vector, V is the value vector, and d k is the dimension of the key vector, and softmax(.) is the normalization function;
[0042] S42. Perform linear transformation and position encoding on to generate a new feature representation z vit :
[0043]
[0044] Among them, Linear. performs a linear transformation on the input feature z, and PE is the positional encoding;
[0045] S43. Through introducing an image transformation network for multi-scale learning, perform convolutional operations on z vit to obtain feature maps of multiple scales
[0046]
[0047] Among them, Conv i (.) represents the i-th layer convolutional operation, is the multi-scale feature obtained by the i-th layer convolutional operation;
[0048] Concatenate the feature maps of different scales to obtain the final multi-scale feature
[0049]
[0050] Among them, Concat. represents the concatenation operation;
[0051] S44. Perform further pattern analysis on the final multi-scale feature to extract the key patterns of leakage and obtain the final pipeline leakage pattern feature
[0052]
[0053] Among them, W f is the weight matrix of the fully connected layer.
[0054] Optionally, the S5 includes the following steps:
[0055] S51. Optimize the self-supervised learning ability of the DeiT model by introducing a teacher-student mechanism. The teacher model is used to generate pseudo-labels to guide the output of the student model The teacher model minimizes the difference between the two by guiding the student model to learn in the multi-dimensional feature space;
[0056] The output of the teacher model is:
[0057]
[0058] Among them, W t is the weight matrix of the teacher model, b t is the bias term, is the multi-scale feature generated by the DeiT model, d teacheris the feature dimension output by the teacher model, and softmax(.) is the normalization function;
[0059] The output of the student model is:
[0060]
[0061] where W s is the weight matrix of the student model, b s is the bias term, d student is the feature dimension output by the student model, and softmax. is the normalization function;
[0062] S52. Construct the loss function between the output of the student model and the pseudo-label of the teacher model and use the weighted cross-entropy loss function to measure the difference between the two:
[0063]
[0064] where N is the dimension of the feature vector, α i and β i are the weighting coefficients, is the output of the teacher model in the i-th dimension, is the output of the student model in the i-th dimension;
[0065] S53. By introducing the teacher-student mechanism, further optimize the learning ability of the DeiT model in the case of lack of sample data.
[0066] Optionally, the S6 includes the following steps:
[0067] S61. Jointly optimize the semi-supervised variational autoencoder and the DeiT model, and the objective loss function for joint training is:
[0068]
[0069] where, is the reconstruction error of the semi-supervised variational autoencoder, is the cross-entropy loss of the DeiT model, and λ is the weighting coefficient;
[0070] The reconstruction error of the semi-supervised variational autoencoder is:
[0071]
[0072] KLThe Kullback-Leibler divergence of the latent variable z is q(z|x)∥p(z), and β is the regularization hyperparameter;
[0073] The DeiT model is optimized by minimizing the cross-entropy loss:
[0074]
[0075] where, and are the outputs of the teacher and student models in the i-th dimension respectively, and N is the dimension of the feature vector;
[0076] S62. During the joint training process, update the parameters of the semi-supervised variational autoencoder and the DeiT model:
[0077]
[0078] where η is the learning rate, is the gradient of the loss function of the semi-supervised variational autoencoder with respect to the parameter W vae and is the gradient of the loss function of the DeiT model with respect to the parameter W deit ;
[0079] S63. Based on the latent feature z extracted by the trained semi-supervised variational autoencoder and the leakage pattern feature extracted by the trained DeiT model,
[0080]
[0081] where W f is the fusion weight matrix, is the fused feature;
[0082] Process the fused feature through a fully connected layer to generate an early warning signal
[0083]
[0084] where W e is the weight matrix of the fully connected layer, b e is the bias term, σ is the Sigmoid activation function, is the early warning signal.
[0085] Optionally, the S7 includes the following steps:
[0086] S71. According to the early warning signal judge whether leakage occurs by setting a threshold θ. When the early warning signal When it is greater than the threshold value θ, the pipeline leakage warning is triggered and the alarm signal y is output alarm ;
[0087] S72. Further analyze the monitoring results by combining the historical data and real-time monitoring data of the pipeline with early warning signals. Generate a final leak monitoring report.
[0088] The beneficial effects of the present invention are:
[0089] (1) The present invention provides an oil pipeline leakage monitoring and early warning method based on deep learning, which can effectively solve the deficiencies in the prior art and has significant beneficial effects. First, the present invention combines a semi-supervised variational autoencoder and an improved DeiT model. By performing in-depth representation learning on the monitoring data, the present invention can mine potential structures from massive unlabeled data, thereby greatly improving the learning ability of the model with a small amount of labeled data. Compared with traditional deep learning methods, the present invention can effectively utilize a small amount of labeled data and a large amount of unlabeled data, avoiding the overfitting problem caused by insufficient data and improving the generalization ability of the model.
[0090] (2) The present invention introduces a self-attention mechanism and an image transformation network into the improved DeiT model, which enables the model to better perform small sample learning and extract pattern features of oil pipeline leakage. Through the self-attention mechanism, the model can automatically focus on important areas in the monitoring data, enhancing the ability to recognize leakage patterns, while the image transformation network can perform effective pattern recognition and transformation in a variable monitoring environment, improving the model's adaptability to different leakage situations.
[0091] (3) The present invention adopts a teacher-student mechanism to optimize the self-supervised learning ability of the DeiT model. Under this mechanism, the teacher model assists the training of the student model by generating pseudo labels, so that the model can still have strong learning ability in the absence of real labeled data. This optimization method effectively improves the self-supervised learning efficiency of the model, so that the model can still obtain high-quality training when labeled data is scarce. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0093] Figure 1 This is a flow chart of a deep learning-based oil pipeline leakage monitoring and early warning method proposed by the present invention;
[0094] Figure 2This is a training flow chart of the DeiT model in the oil pipeline leakage monitoring and early warning method based on deep learning proposed in the present invention. DETAILED DESCRIPTION
[0095] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.
[0096] refer to Figure 1 - Figure 2 , a method for monitoring and early warning of oil pipeline leakage based on deep learning, comprising the following steps:
[0097] S1. Obtain oil pipeline monitoring data and perform preprocessing;
[0098] S2. Construct a semi-supervised variational autoencoder, use unsupervised learning methods to mine the potential structure of unlabeled data, and combine it with a small amount of labeled data for supervised training;
[0099] S3, using semi-supervised variational autoencoder to learn the representation of oil pipeline monitoring data and extract potential features;
[0100] S4. The generated latent features are input into the improved DeiT model. The DeiT model extracts pipeline leakage pattern features by introducing self-attention mechanism and image transformation network for small sample learning.
[0101] S5. The self-supervised learning ability of the DeiT model is optimized by introducing a teacher-student mechanism. The teacher model trains the student model by generating pseudo labels.
[0102] S6. Jointly optimize the semi-supervised variational autoencoder and the DeiT model, match the latent features mined by the semi-supervised variational autoencoder with the leakage pattern features extracted by the DeiT model through joint training, and generate an early warning signal based on the trained semi-supervised variational autoencoder and the DeiT model;
[0103] S7. Determine whether a leak occurs based on the early warning signal, analyze the monitoring results, and generate a final leak monitoring report based on the early warning signal.
[0104] In this implementation, S1 includes the following steps:
[0105] S11, obtaining oil pipeline monitoring data, including pressure, flow, and temperature data, and performing denoising processing using wavelet transform;
[0106] S12, perform outlier detection, remove abnormal data points, and use interpolation to supplement missing data;
[0107] S13. Normalize the processed oil pipeline monitoring data.
[0108] In this embodiment, S2 includes the following steps:
[0109] S21. Construct a semi-supervised variational autoencoder, which obtains the probability distribution q(z|x) of the latent space z by performing a non-linear mapping on the input data x.
[0110] S22. In the semi-supervised variational autoencoder, use an unsupervised learning method to mine the latent structure of the unlabeled data, and utilize the latent variable z to characterize the latent pattern of the input data by maximizing the variational lower bound:
[0111]
[0112] Among them, ELBO represents maximizing the variational lower bound, p(x|z) is the likelihood of the reconstructed data generated by the decoder, and D KL q(z|x)∥p(z) is the Kullback-Leibler divergence between the latent space distribution q(z|x) and the prior distribution p(z).
[0113] S23. Combine a small amount of labeled data y, and optimize the decoder part of the VAE model by minimizing the reconstruction error and using a supervised training method:
[0114]
[0115] Among them, represents the reconstruction error, x represents the input data, z represents the latent space variable, and p(x|z) represents the probability of the reconstructed data generated by the decoder.
[0116] In this embodiment, S3 includes the following steps:
[0117] S31. Use a semi-supervised variational autoencoder to perform representation learning on the preprocessed monitoring data, map the input data x to the latent space, and generate the conditional probability distribution q(z|x) of the latent variable through the encoder.
[0118] S32. Extract the latent feature z of the input data.
[0119] S33. Regularize the latent feature z using the Kullback-Leibler divergence:
[0120]
[0121] Among them, q(z|x) is the latent space distribution and p(z) is the prior distribution.
[0122] In this embodiment, S4 includes the following steps:
[0123] S41. Input the latent feature z generated by the semi-supervised variational autoencoder into the improved DeiT model. The DeiT model uses a multi-head self-attention layer to perform weighted aggregation on the latent feature to obtain an output feature
[0124]
[0125] where W o is the linear transformation weight of the final output, represents the result of each attention head, h is the number of heads, and Concat. represents the concatenation operation;
[0126] The result of each attention head is calculated as follows:
[0127]
[0128] where Q is the query vector, K is the key vector, V is the value vector, and d k is the dimension of the key vector, and softmax(.) is the normalization function;
[0129] S42. Perform a linear transformation and positional encoding on to generate a new feature representation z vit :
[0130]
[0131] where Linear. is a linear transformation of the input feature z, and PE is the positional encoding;
[0132] S43. Through the introduction of an image transformation network for multi-scale learning, perform convolution operations on z vit at different scales to obtain feature maps at multiple scales
[0133]
[0134] where Conv i (.) represents the i-th layer convolution operation, is the multi-scale feature obtained from the i-th layer convolution operation;
[0135] Concatenate the feature maps at different scales to obtain the final multi-scale feature
[0136]
[0137] where Concat. represents the concatenation operation;
[0138] S44. Perform further pattern analysis on the final multi-scale features to extract the key patterns of leakage and obtain the final pipeline leakage pattern features
[0139]
[0140] where W f is the weight matrix of the fully connected layer
[0141] In this embodiment, S5 includes the following steps
[0142] S51. Optimize the self-supervised learning ability of the DeiT model by introducing a teacher-student mechanism. The teacher model is used to generate pseudo-labels to guide the output of the student model The teacher model minimizes the difference between the two by guiding the student model to learn in the multi-dimensional feature space
[0143] The output of the teacher model is
[0144]
[0145] where W t is the weight matrix of the teacher model, b t is the bias term, is the multi-scale feature generated by the DeiT model, d teacher is the feature dimension output by the teacher model, and softmax(.) is the normalization function
[0146] The output of the student model is
[0147]
[0148] where W s is the weight matrix of the student model, b s is the bias term, d student is the feature dimension output by the student model, and softmax. is the normalization function
[0149] S52. Construct a loss function between the output of the student model and the pseudo-label of the teacher model and use a weighted cross-entropy loss function to measure the difference between the two
[0150]
[0151] where N is the dimension of the feature vector, α i and β i are the weighting coefficients is the output of the teacher model in the i-th dimension, is the output of the student model in the i-th dimension;
[0152] S53. By introducing a teacher-student mechanism, further optimize the learning ability of the DeiT model in the case of lack of sample data.
[0153] In this embodiment, S6 includes the following steps:
[0154] S61. Jointly optimize the semi-supervised variational autoencoder and the DeiT model, and the objective loss function for joint training is:
[0155]
[0156] where, is the reconstruction error of the semi-supervised variational autoencoder, is the cross-entropy loss of the DeiT model, and λ is the weighting coefficient;
[0157] The reconstruction error of the semi-supervised variational autoencoder is:
[0158]
[0159] where, logp(x|z) is the log-likelihood of the reconstructed data obtained by the decoder, and D KL q(z|x)∥p(z) is the Kullback-Leibler divergence of the latent variable z, and β is the regularization hyperparameter;
[0160] Optimize the DeiT model by minimizing the cross-entropy loss:
[0161]
[0162] where, and are the outputs of the teacher and student models in the i-th dimension respectively, and N is the dimension of the feature vector;
[0163] S62. During the joint training process, update the parameters of the semi-supervised variational autoencoder and the DeiT model:
[0164]
[0165] where, η is the learning rate, is the gradient of the loss function of the semi-supervised variational autoencoder with respect to the parameter W vae , is the gradient of the loss function of the DeiT model with respect to the parameter W deit ;
[0166] S63. The latent feature z extracted from the trained semi-supervised variational autoencoder and the leakage pattern feature extracted from the trained DeiT model are fused:
[0167]
[0168] where W f is the fusion weight matrix, is the fused feature;
[0169] The fused feature is processed through a fully connected layer to generate an early warning signal
[0170]
[0171] where W e is the weight matrix of the fully connected layer, b e is the bias term, σ is the Sigmoid activation function, is the early warning signal.
[0172] In this embodiment, S7 includes the following steps:
[0173] S71. According to the early warning signal it is determined whether leakage occurs by setting a threshold θ. When the early warning signal is greater than the threshold θ, a pipeline leakage warning is triggered and an alarm signal y alarm is output;
[0174] S72. The monitoring results are further analyzed, and a final leakage monitoring report is generated by combining the early warning signal according to the historical data and real-time monitoring data of the pipeline.
[0175] Example:
[0176] In an example, in a certain oil pipeline, during the operation of the oil pipeline, the early detection of leakage events is crucial for preventing environmental pollution and economic losses. In order to improve the accuracy and response speed of leakage monitoring, an oil company decides to apply the deep learning-based oil pipeline leakage monitoring and warning method of the present invention for practical applications.
[0177] The oil pipeline is located in an important oil transportation corridor in a certain province, with a total length of about 500 kilometers, passing through multiple cities and complex terrain areas. Due to the heavy transportation tasks of the pipeline, leakage incidents occur from time to time, posing certain risks to the environment and enterprises. In this context, using traditional sensor monitoring methods is not only costly, but also the problems of sensor failures and false alarms are relatively serious, making it difficult to achieve real-time and accurate monitoring of the entire pipeline section. Therefore, the company decided to introduce deep learning technology and adopt a method combining a semi-supervised variational autoencoder and a DeiT model to conduct all-round monitoring and leakage warning of the pipeline.
[0178] First, the system collects various monitoring data along the oil pipeline, including parameters such as pressure, temperature, flow rate, and vibration. Then, the system constructs a semi-supervised variational autoencoder model. At this stage, the system first uses unlabeled data to train the variational autoencoder to extract the potential structure in the data, and combines a small amount of labeled data for supervised training. In this way, the system can improve the model's ability to identify pipeline leaks in the case of insufficient labeled data. After several rounds of training, the variational autoencoder model shows good results in extracting leakage features and can accurately identify leakage signals caused by abnormal fluctuations of physical quantities such as pressure and temperature.
[0179] Then, the system uses the trained semi-supervised variational autoencoder to perform representation learning on the pipeline monitoring data and extract potential features. These potential features not only include the normal operation mode of the pipeline but also cover possible leakage modes. Through this process, the model can automatically identify the feature patterns of different types of leakage modes, greatly improving the data processing efficiency. Subsequently, the system inputs the generated potential features into the improved DeiT model for few-shot learning. This model can accurately identify the pattern features of leakage events by introducing a self-attention mechanism and an image transformation network. In this process, the DeiT model shows strong adaptability and can effectively compare and analyze different types of leakage events. Especially in the case of scarce data, it can still maintain a high accuracy rate.
[0180] In practical applications, after two months of testing and data collection, the system successfully detected three actual pipeline leakage incidents and issued early warnings. Among them, the first leakage incident occurred at 2:00 am on January 15, 2025, at the 230th kilometer of the pipeline. The leakage volume of this incident was small, but the system successfully identified it within 15 minutes through early warning signals and notified the staff. After subsequent inspections and confirmations, the leakage volume was 200L, the system issued an alarm 1 hour in advance, and the accuracy was 95%. The second leakage incident occurred on February 10, 2025, at the 400th kilometer of the pipeline, with a leakage volume of 500L. The system identified it in advance and notified the staff within 20 minutes, with an accuracy of 92%. The third leakage incident occurred on February 28, 2025, at the 150th kilometer, with a leakage volume of 800L. The system identified it 30 minutes in advance, with an accuracy of 90%.
[0181] The following table shows some data on oil pipeline leakage monitoring and early warning:
[0182] Table 1 Oil Pipeline Leakage Monitoring and Early Warning Data
[0183]
[0184] Throughout the embodiments, the implementer uses the oil pipeline leakage monitoring and early warning method based on deep learning of the present invention, which not only effectively solves the problems of traditional monitoring technologies such as insufficient data collection, inaccurate feature extraction, and early warning lag, but also greatly improves the accuracy and real-time performance of leakage monitoring, realizing the early discovery and efficient response of pipeline leakage incidents.
[0185] By introducing a semi-supervised variational autoencoder, the present invention can fully explore the potential structure in a large amount of unlabeled data and combine a small amount of labeled data for effective training, accurately converting the originally scattered and difficult-to-capture monitoring information into high-quality feature representations, fundamentally solving the limitation of traditional deep learning methods that are prone to overfitting in the case of insufficient labeled data.
[0186] The present invention incorporates a self-attention mechanism and an image transformation network into the improved DeiT model, accurately extracts leakage patterns through few-shot learning techniques, and uses a teacher-student mechanism to optimize the self-supervised learning ability of the model, enabling the system to maintain a high accuracy rate even in the face of complex pipeline environments and changing monitoring data. Compared with traditional single monitoring methods, the present invention realizes the efficient matching of potential features and leakage pattern features by jointly optimizing the semi-supervised variational autoencoder and the DeiT model during the leakage pattern recognition process, making the generation of early warning signals more timely and accurate, thereby effectively reducing the risks and losses during accidents.
[0187] The above are only the preferred specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, making equivalent substitutions or changes, shall be covered by the protection scope of the present invention.
Claims
1. A method for monitoring and early warning of oil pipeline leakage based on deep learning, characterized in that: The steps include: S1. Obtain oil pipeline monitoring data and perform preprocessing; S2. Construct a semi-supervised variational autoencoder, use unsupervised learning methods to mine the potential structure of unlabeled data, and combine it with a small amount of labeled data for supervised training; S3, using semi-supervised variational autoencoder to learn the representation of oil pipeline monitoring data and extract potential features; S4. The generated latent features are input into the improved DeiT model. The DeiT model extracts pipeline leakage pattern features by introducing self-attention mechanism and image transformation network for small sample learning. S5. The self-supervised learning ability of the DeiT model is optimized by introducing a teacher-student mechanism. The teacher model trains the student model by generating pseudo labels. S6. Jointly optimize the semi-supervised variational autoencoder and the DeiT model, match the latent features mined by the semi-supervised variational autoencoder with the leakage pattern features extracted by the DeiT model through joint training, and generate an early warning signal based on the trained semi-supervised variational autoencoder and the DeiT model; S7. Determine whether a leak occurs based on the early warning signal, analyze the monitoring results, and generate a final leak monitoring report based on the early warning signal.
2. According to the deep learning-based oil pipeline leakage monitoring and early warning method of claim 1, it is characterized in that: The S1 comprises the following steps: S11, obtaining oil pipeline monitoring data, including pressure, flow, and temperature data, and performing denoising processing using wavelet transform; S12, perform outlier detection, remove abnormal data points, and use interpolation to supplement missing data; S13, normalizing the processed oil pipeline monitoring data.
3. The oil pipeline leakage monitoring and early warning method based on deep learning according to claim 1 is characterized in that: The S2 comprises the following steps: S21. Construct a semi-supervised variational autoencoder. The semi-supervised variational autoencoder obtains the probability distribution q(z|x) of the latent space z by performing nonlinear mapping on the input data x. S22. In the semi-supervised variational autoencoder, an unsupervised learning method is used to explore the potential structure of unlabeled data, and the latent variable z is used to characterize the potential pattern of the input data by maximizing the variational lower bound: Where ELBO represents the maximum variational lower bound, p(x|z) is the likelihood of the reconstructed data generated by the decoder, and D KL [q(z|x)||p(z)] is the Kullback-Leibler divergence between the latent space distribution q(z|x) and the prior distribution p(z); S23. Combined with a small amount of labeled data y, the decoder part of the VAE model is optimized by minimizing the reconstruction error and using a supervised training method: in, represents the reconstruction error, x represents the input data, z represents the latent space variable, and p(x|z) represents the probability of the reconstructed data generated by the decoder.
4. The oil pipeline leakage monitoring and early warning method based on deep learning according to claim 1 is characterized in that: The S3 comprises the following steps: S31, using a semi-supervised variational autoencoder to perform representation learning on the preprocessed monitoring data, mapping the input data x to the latent space, and generating the conditional probability distribution q(z|x) of the latent variables through the encoder; S32, extracting potential features z of input data; S33, use Kullback-Leibler divergence to regularize the latent feature z: Among them, q(z|x) is the latent space distribution and p(z) is the prior distribution.
5. The oil pipeline leakage monitoring and early warning method based on deep learning according to claim 1 is characterized in that: The S4 comprises the following steps: S41. Input the latent feature z generated by the semi-supervised variational autoencoder into the improved DeiT model. The DeiT model uses a multi-head self-attention layer to perform weighted aggregation on the latent features to obtain the output feature Among them, W o is the linear transformation weight of the final output, represents the result of each attention head, h is the number of heads, and Concat(.) represents the concatenation operation; Results for each attention head The calculation method is: Among them, Q is the query vector, K is the key vector, V is the value vector, and d k is the dimension of the key vector, and softmax(.) is the normalization function; S42, yes Perform linear transformation and position encoding to generate a new feature representation z vit : Among them, Linear(.) is a linear transformation of the input feature z, and PE is the position encoding; S43, by introducing the image transformation network for multi-scale learning, vit Perform convolution operations of different scales to obtain feature maps of multiple scales Among them, Conv i (.) represents the i-th convolution operation, is the multi-scale feature obtained by the i-th layer convolution operation; The feature maps of different scales are spliced to obtain the final multi-scale features Among them, Concat(.) represents the concatenation operation; S44. Final multi-scale features Conduct further pattern analysis to extract the key leakage patterns and obtain the final pipeline leakage pattern characteristics. Among them, W f is the weight matrix of the fully connected layer.
6. The oil pipeline leakage monitoring and early warning method based on deep learning according to claim 1 is characterized in that: The S5 The following steps are involved: S51. The self-supervised learning ability of the DeiT model is optimized by introducing a teacher-student mechanism. The teacher model is used to generate pseudo labels. Output to the student model To provide guidance, the teacher model minimizes the difference between the two by guiding the student model to learn in a multi-dimensional feature space; Output of the teacher model for: Among them, W t is the weight matrix of the teacher model, b t is the bias term, Multi-scale features generated for the DeiT model, d teacher is the feature dimension output by the teacher model, and softmax(.) is the normalization function; Output of the student model for: Among them, W s is the weight matrix of the student model, b s is the bias term, d student is the feature dimension output by the student model, and softmax(.) is the normalization function; S52. Construct student model output and teacher model pseudo labels The loss function between them uses the weighted cross entropy loss function to measure the difference between the two: Among them, N is the dimension of the feature vector, α i and β i is the weighting coefficient, is the output of the teacher model in the i-th dimension, is the output of the student model in the i-th dimension; S53. By introducing the teacher-student mechanism, the learning ability of the DeiT model is further optimized in the absence of sample data.
7. The oil pipeline leakage monitoring and early warning method based on deep learning according to claim 1 is characterized in that: The S6 comprises the following steps: S61. Jointly optimize the semi-supervised variational autoencoder and DeiT model. The target loss function of the joint training is: in, is the reconstruction error of the semi-supervised variational autoencoder, is the cross entropy loss of the DeiT model, λ is the weighting coefficient; Reconstruction error of the semi-supervised variational autoencoder for: Where logp(x|z) is the log-likelihood of the reconstructed data obtained by the decoder, D KL [q(z|x)||p(z)] is the Kullback-Leibler divergence of the latent variable z, and β is the regularization hyperparameter; The DeiT model is optimized by minimizing the cross entropy loss: in, and are the outputs of the teacher and student models in the i-th dimension, respectively, and N is the dimension of the feature vector; S62. During the joint training process, update the parameters of the semi-supervised variational autoencoder and DeiT model: Where η is the learning rate, is the loss function of the semi-supervised variational autoencoder with respect to the parameter W vae The gradient of is the loss function of the DeiT model with respect to the parameter W deit The gradient of S63, latent features z extracted by trained semi-supervised variational autoencoder and leakage pattern features extracted by trained DeiT model To perform the fusion: Among them, W f is the fusion weight matrix, is the fused feature; The fused features are processed through the fully connected layer to generate early warning signals Among them, W e is the weight matrix of the fully connected layer, b e is the bias term, σ is the Sigmoid activation function, An early warning signal.
8. The oil pipeline leakage monitoring and early warning method based on deep learning according to claim 1 is characterized in that: The S7 comprises the following steps: S71. Based on early warning signals By setting the threshold θ, it is determined whether a leak occurs. When it is greater than the threshold value θ, the pipeline leakage warning is triggered and the alarm signal y is output alarm ; S72. Further analyze the monitoring results by combining the historical data and real-time monitoring data of the pipeline with early warning signals. Generate a final leak monitoring report.