A pipeline leakage zero-sample anomaly detection method and system based on a double-adversarial decoding network

By constructing a dual-adversarial decoding network and using adversarial training with normal and abnormal samples to generate simulated abnormal data, pipeline leak detection was achieved under the condition of scarce real fault data. This solved the problem of identifying unknown leak faults and improved the robustness and generalization ability of the model.

CN122365288APending Publication Date: 2026-07-10HARBIN INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HARBIN INST OF TECH
Filing Date
2026-05-07
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing technologies are ineffective in detecting unknown leaks in pipelines, especially when real-world fault data is scarce. Their models have poor generalization ability and cannot accurately identify unknown leaks.

Method used

A zero-shot anomaly detection method for pipeline leaks based on a dual adversarial decoding network is constructed. By extracting normal operation samples from a public dataset, a pipeline system model consistent with the real structure is built to generate highly reliable simulated anomaly samples. The model is pre-trained using a masked autoencoder and dual decoders to achieve cross-domain feature alignment and robust representation learning, thereby enabling zero-shot anomaly detection.

Benefits of technology

It significantly improves the ability to identify unknown leakage faults without the need for real fault data, enhances the robustness of feature extraction and the generalization ability of the model, reduces the false negative rate, and is suitable for real-time pipeline leakage detection in complex industrial scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122365288A_ABST
    Figure CN122365288A_ABST
Patent Text Reader

Abstract

The application provides a pipeline leakage zero-sample anomaly detection method and system based on a double-adversarial decoding network, relates to the fields of fault data analysis and anomaly detection, and solves the problems of real fault data scarcity, unknown leakage fault difficulty in identification, insufficient feature extraction robustness under complex working conditions, poor adaptability of fixed thresholds, and weak generalization ability of traditional methods due to dependence on labeled fault data in industrial pipeline leakage detection. The application normalizes real and simulated abnormal samples, constructs a mask block autoencoder and a double-adversarial decoder model, optimizes parameters through joint adversarial training, extracts features from a target pipeline signal to be detected, calculates reconstruction errors, and realizes unknown pipeline leakage zero-sample detection in combination with a dynamic threshold. The application improves feature robustness and abnormal identification sensitivity through double-adversarial decoding and a mask mechanism, adapts to complex working conditions through a dynamic threshold, can accurately detect unknown leakage with zero samples, has a low missed detection rate, and is suitable for industrial real-time detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fault data analysis and anomaly detection technology, and in particular to a zero-sample anomaly detection method and system for pipeline leaks based on a dual-adversarial decoding network. Background Technology

[0002] Fluid piping systems are widely used in critical fields such as industrial water supply, petrochemicals, and marine pipelines. During long-term operation, these systems are highly susceptible to structural failures such as leaks due to a variety of complex factors, including material aging, loose connections, corrosion and wear, and external impacts. Leaks not only reduce system efficiency and energy consumption but can also cause environmental pollution and even safety accidents in severe cases. Therefore, the abnormal detection and early diagnosis of pipeline leaks have extremely important engineering significance and social value.

[0003] Traditional pipeline leak detection methods mainly include manual inspection, static pressure testing, and anomaly identification based on acoustic and vibration signals. However, manual inspection is inefficient, has a strong lag, and is easily affected by human factors; static pressure testing requires shutdown testing, which disrupts the continuous operation of the system; traditional signal processing methods based on manual rules or feature engineering are difficult to obtain robust and stable feature representations under complex operating conditions, resulting in limited detection accuracy.

[0004] In recent years, data-driven intelligent diagnostic methods based on machine learning and deep learning have gradually become a research hotspot. Models such as autoencoders, convolutional neural networks, and recurrent neural networks have achieved certain results in pipeline leak identification. However, these methods heavily rely on a large amount of labeled real fault data. In actual industrial scenarios, many leaks are unknown and unpredictable, making it difficult to obtain sufficient real fault samples, resulting in poor model generalization ability and an inability to effectively cope with unknown leaks. In addition, the leakage patterns of real industrial systems have significant uncertainty and randomness. Models trained based on fixed fault types are difficult to adapt to potential future unknown faults, limiting their application in practical engineering. Although emerging technologies such as extreme value search methods have shown advantages in signal recognition and control, they still face key challenges in zero-shot pipeline leak detection scenarios, such as how to solve the scarcity of fault data, cross-domain feature alignment, and identification of unknown faults. Therefore, a zero-shot anomaly detection method is needed that can achieve accurate identification of unknown pipeline leaks without relying on a large amount of real fault data. Summary of the Invention

[0005] This invention aims to provide a zero-shot anomaly detection method and system for pipeline leaks based on a dual-adversarial decoding network. It extracts only normally operating samples from a public dataset as health status data, then builds a pipeline system model consistent with the real structure, and obtains a large number of highly reliable simulated anomaly samples by injecting leak faults. Subsequently, real normal samples and simulated anomaly samples are used together for model pre-training, constructing a dual-decoding autoencoder framework with domain adversarial capabilities. This achieves cross-domain feature alignment and robust representation learning, and in the inference stage, the pre-trained encoder is used to discriminate unknown real anomaly data, achieving zero-shot anomaly detection. This addresses problems in industrial pipeline leak detection such as the scarcity of real fault data, difficulty in identifying unknown leak faults, insufficient robustness of feature extraction under complex operating conditions, poor adaptability of fixed thresholds, and weak generalization ability due to reliance on labeled fault data in traditional methods.

[0006] A zero-shot anomaly detection method for pipeline leaks based on a bi-adversarial decoding network includes the following steps: S1. Normalize the real normal samples collected from the actual pipeline system and the abnormal samples generated by simulation, construct a masked autoencoder (MAE), apply continuous random masks to the normal samples and abnormal samples and input them into the masked autoencoder to obtain reconstructed features; S2. Construct a model framework that includes the masked autoencoder and the normal / abnormal dual-branch adversarial decoder. The optimization objective is to minimize the reconstruction error between the input sample and the reconstruction feature output by the corresponding masked autoencoder. The encoder and decoder parameters of the model are initially trained using the masked sample data to complete the initial configuration of the model parameters. The normal / abnormal dual-branch adversarial decoder includes two parallel decoding branches: a normal branch decoder and an abnormal branch decoder. S3. Normalized real normal samples and normalized simulated abnormal samples are jointly input into the initially trained model framework for further training. The reconstructed features extracted from real normal samples by the masked autoencoder are input into the normal branch decoder, and the mean squared error (MSE) between the decoder reconstruction result and the real normal samples is calculated as the normal loss. The reconstructed features extracted from simulated abnormal samples by the masked autoencoder are input into the abnormal branch decoder, and the adversarial loss between the decoder reconstruction result and the simulated abnormal samples is calculated as the abnormal loss. The normal loss and the abnormal loss are weighted and fused to obtain the total loss. Based on the total loss, backpropagation is iterated to minimize the reconstruction loss of normal samples and maximize the reconstruction loss of abnormal samples, thereby completing the dual-branch adversarial training and optimizing the parameters of the masked autoencoder and the normal / abnormal dual-branch adversarial decoder. S4. Input the target pipeline signal to be detected into the mask autoencoder optimized by S2 and S3 to obtain the reconstruction features of the signal to be detected. Calculate the mean square error between the reconstruction features of the signal to be detected and the output of the normal branch decoder in the normal / abnormal dual-branch adversarial decoder as the reconstruction error. S5. Based on the distribution of the mean square error between the normal branch decoder and the real normal samples during the training process in S3, calculate the mean and standard deviation of the mean square error and adaptively set the dynamic discrimination threshold. By comparing the reconstruction error of the signal to be detected obtained in S4 with the dynamic discrimination threshold, zero-sample anomaly detection of pipeline leakage faults is achieved.

[0007] Furthermore, the specific steps for generating anomalous samples in S1 include: S11. Based on the actual pipeline system structure, determine the pipeline topology, including pipe segment length, pipe diameter, node connection relationship and the location of key functional components, including water pumps, valves, water tanks and pressure sensors; S12. Based on the pipeline topology determined in S11 and the specific structural parameters of the actual pipeline, a dynamic simulation model of the pipeline system is established using the fluid system simulation software Flowmaster. The pipe material properties, pipe wall roughness, medium density, wave velocity and boundary pressure conditions are set so that the dynamic simulation model is consistent with the real pipeline system in terms of pressure and flow dynamic characteristics. S13. Perform steady-state verification on the dynamic simulation model established in S12. Run the dynamic simulation model under leak-free operating conditions to ensure that the pressure and flow response obtained from the simulation are consistent with the actual normal operating data in terms of change trend and amplitude range. S14. At the fault node of the pipeline topology, a ball valve is installed to simulate the fluid leakage process of the orifice. The opening degree of the ball valve is adjusted to control the size of the leakage orifice to cover different leakage degrees. The time series signal output by the pressure sensor is collected to form a simulation anomaly sample set.

[0008] Furthermore, the construction steps of the mask autoencoder described in S2 include: S21. Design the encoder in the masked autoencoder structure to map the input data to the hidden layer and transform the input data into a low-dimensional representation in the feature space. The structure is as follows:

[0009] in This is a low-dimensional representation of the transformed feature space. This is the activation function of the encoder. For the encoder weights, This is the bias vector of the encoder. The timing data of real normal samples and simulated abnormal samples of the pipeline system are used as input mask autoencoders; S22. Design the decoder in the masked autoencoder structure to transform the low-dimensional representation of the feature space to the dimension of the original data, thereby reconstructing the input data. Its structure is as follows:

[0010] in This is the reconstructed output signal of the decoder in S21. The activation function of the decoder. For the weights of the decoder, This is the bias vector for the decoder; S23. The encoder in S21 and the decoder in S22 are combined to form a mask autoencoder. The mask autoencoder aims to minimize the reconstruction error between the real normal sample time series data or simulated abnormal sample time series data of the pipeline system input to the mask autoencoder and the reconstructed output signal of the decoder in the mask autoencoder structure. Its loss function is:

[0011] in The total number of training samples. This represents the reconstruction error; S24. At the input of the masked autoencoder formed in S23, a mask is randomly applied to the time series samples of the input masked autoencoder, setting the element values ​​in some time segments of the time series samples to 0. By reconstructing the masked time segments, the masked autoencoder is guided to learn the timing pattern of the pipeline system. The loss function of its mask reconstruction part is:

[0012] in For time series samples without randomly applied masks, The mask matrix is ​​generated randomly. For mask matrix The value of the element at the i-th row and j-th column, if This indicates that a mask is applied to the element at position j of the i-th time series sample. This indicates that no mask was applied to the element at position j of the i-th time series sample, where i ≤ B and j ≤ T. This is the reconstructed output of a masked autoencoder for time-series samples after being masked by time segments. B represents the number of time-series samples input for each training iteration, where B ≤ N. The length of each time series sample, This is the loss function for the mask reconstruction part.

[0013] Furthermore, the steps of the two-branch adversarial training described in S3 include: S31. Based on real normal samples, learn the temporal structure pattern of the pipeline system to ensure that the model can stably depict the dynamic law of the healthy operation state of the pipeline system. Input the real normal samples into the mask autoencoder for encoding to obtain the feature representation vector of the system state. Then, input the feature representation vector into the normal branch decoder in the normal / abnormal dual-branch adversarial decoder. The normal branch decoder completes the reconstruction of the original real normal sample signal. S32. Based on the idea of ​​minimizing reconstruction error, the parameters of the normal branch decoder in the mask autoencoder and normal / abnormal dual-branch adversarial decoder structure are trained so that the normal branch decoder can accurately recover the signal characteristics of the normal working condition mode in the random masked segment of the real normal sample. The loss function of the normal branch decoder is:

[0014] in For a set of real, normal samples, The loss function for the normal branch decoder, The parameters represent the mask autoencoder. This represents the parameters of the normal branch decoder. This represents the number of real, normal samples. This represents the function of the mask autoencoder. This represents the function that enables the normal branch decoder; S33. An anomalous branch decoder is introduced into the normal / abnormal dual-branch adversarial decoder structure. During the training phase, simulated anomalous samples or pseudo-abnormal samples constructed by applying noise perturbations to real normal samples are explicitly introduced. This allows the model to enhance its ability to distinguish anomalous patterns while learning to reconstruct real normal sample data, actively widening the gap between normal and anomalous patterns in the latent space. The loss function of the anomalous branch decoder is:

[0015] in This is a set of anomalous samples, which includes anomalous samples generated by simulation and pseudo-annomous samples constructed by applying noise perturbations to real normal samples. Let be the loss function of the anomaly branch decoder. The parameters represent the mask autoencoder. The parameters represent the exception branch decoder. The number of abnormal samples. This represents the function of the mask autoencoder. This represents the function that executes the exception branch decoder. The emphasis factor for the abnormal sample data structure is a predefined matrix. If the element at position j of the i-th abnormal sample has a significant abnormal feature, then the emphasis factor is increased. If the element at the i-th row and j-th column approaches 1, and the anomalous feature of the element at the j-th position of the i-th anomalous sample is not significant, then the emphasis factor is... The element at the i-th row and j-th column is close to 0. Represents matrix multiplication; S34. The loss function of the normal branch decoder. Loss function of the anomaly branch decoder Perform weighted fusion:

[0016] in These are preset adjustment parameters used to balance the model's learning ability for normal and abnormal sample patterns, so that the loss function of the normal branch decoder is as small as possible, while the loss function of the abnormal branch decoder is as large as possible after backpropagation.

[0017] Furthermore, S5 includes the following steps: S51. After the model training is completed, only the optimized mask autoencoder and the normal branch decoder in the normal / abnormal dual-branch adversarial decoder are retained for online anomaly detection inference. The signal of the target pipeline to be detected is input into the mask autoencoder to obtain the reconstructed features of the signal to be detected. Then the mean square error between the reconstructed features and the output of the normal branch decoder is calculated as the reconstruction error. S52. Calculate the mean of the reconstruction error distribution of real normal sample data during the training process. with standard deviation Set the dynamic discrimination threshold to , These are preset coefficients used to adapt to anomaly detection requirements under different working conditions. ; S53. When the reconstruction error of the signal of the target pipeline under test exceeds the dynamic discrimination threshold, it is determined that there is a leakage abnormality in the target pipeline system; when the reconstruction error of the signal of the target pipeline under test is lower than the dynamic discrimination threshold, it is determined that the target pipeline system under test is in normal operation.

[0018] Furthermore, the coefficients of S52 The setup steps are as follows: A threshold for the allowable false positive rate of normal samples in anomaly detection is set. The allowable false positive rate threshold is a preset, acceptable proportion of normal samples that are misclassified as anomalies, and its value ranges from 0.1% to 5%. Iterate through multiple coefficients with different values The coefficient The traversal range is 0.5~5.0, and the traversal step size is 0.1~0.5, for each coefficient. Calculate the corresponding dynamic discrimination threshold. ; For each of the coefficients Corresponding dynamic discrimination threshold The normal sample set is statistically analyzed to find samples that fall below the dynamic discrimination threshold. Calculate the false positive rate for normal samples based on the number of samples outside the interval. The coefficients that are selected based on the corresponding normal sample misclassification rate not exceeding the allowable misclassification rate threshold are used to identify the correct values. The coefficients that satisfy the preset optimization conditions are selected. As the optimal coefficient The preset optimization condition is: the misjudgment rate of the corresponding normal sample is closest to the allowable misjudgment rate threshold, and does not exceed the allowable misjudgment rate threshold.

[0019] A zero-shot anomaly detection system for pipeline leaks based on a bi-adversarial decoding network, applied to the aforementioned zero-shot anomaly detection method for pipeline leaks based on a bi-adversarial decoding network, the system comprising: The data preprocessing and mask reconstruction feature generation module is used to normalize the real normal samples collected from the actual pipeline system and the abnormal samples generated by simulation, construct a mask autoencoder, and input the normal samples and abnormal samples into the mask autoencoder after random masking to obtain the reconstructed features. The model framework construction and initial parameter training module is used to construct a model framework that includes the mask autoencoder and the normal / abnormal dual-branch adversarial decoder. Based on the idea of ​​minimizing reconstruction error, the reconstruction features are used to train the model parameters. The joint sample adversarial training and parameter optimization module is used to jointly input normalized real normal samples and normalized simulated abnormal samples into the model framework to train the model. Adversarial training is achieved by weighted fusion of the loss functions of the normal branch decoder and the abnormal branch decoder, and the parameters of the mask autoencoder and the normal / abnormal dual-branch adversarial decoder are optimized. The module for extracting and reconstructing the signal feature is used to input the signal of the target pipeline to be detected into the optimized mask autoencoder to obtain the reconstructed features, and to calculate the mean square error between the reconstructed features and the output of the normal branch decoder in the normal / abnormal dual-branch adversarial decoder as the reconstruction error. The dynamic discrimination threshold setting and zero-sample anomaly identification module is used to set a dynamic discrimination threshold based on the error distribution of normal sample data during the training process in the adversarial training and parameter optimization module of the joint real normal sample and simulated abnormal sample. By comparing the reconstruction error of the target pipeline signal obtained by the signal feature extraction and reconstruction error calculation module with the dynamic discrimination threshold, zero-sample anomaly detection of pipeline leakage faults can be achieved.

[0020] A computer device system includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the above-described zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network.

[0021] A storage medium storing a computer program, which, when executed by a processor, implements the above-described zero-sample anomaly detection method for pipeline leaks based on a bi-adversarial decoding network.

[0022] A computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network as described in any one of claims 1-6.

[0023] Compared with the prior art, the present invention achieves significant beneficial effects through the above technical solution: (1) Constructing a pipeline simulation model generates simulated abnormal data that is reliable and diverse, effectively solving the problem of scarce real leakage fault data and providing data support for zero-sample detection.

[0024] (2) Design a dual adversarial decoding network structure. Through adversarial training between the normal decoder and the abnormal decoder, the feature extraction network can learn a stable representation of the normal pattern, while enhancing the ability to distinguish abnormal patterns and improving the model's sensitivity to identifying unknown faults.

[0025] (3) Introduce the mask completion mechanism of the mask block autoencoder to enhance the model's ability to capture key features of the signal and improve the robustness of feature representation.

[0026] (4) The use of dynamic thresholds instead of manually set thresholds avoids the incompatibility of fixed thresholds under different working conditions and improves the generalization ability and engineering applicability of the model.

[0027] (5) It can identify unknown leakage faults without relying on real fault data for model fine-tuning. It is significantly better than traditional methods such as autoencoders and single-class support vector machines in terms of accuracy, recall, and F1 score, effectively reducing the false negative rate and is suitable for real-time detection of pipeline leaks in complex industrial scenarios.

[0028] When this invention is applied to a piping system containing only normal operating data, using the mask reconstruction result as the detection indicator, the result is as follows: Figure 5 As shown, the reconstructed mask position curve of normal samples almost completely overlaps with the original mask position curve, with minimal deviation; however, the reconstructed mask position curve of abnormal samples deviates significantly from the original mask position curve, especially in intervals with abrupt changes in signal amplitude and structural anomalies, where the reconstruction error increases dramatically. This method can still achieve the detection effect of unknown pipeline leakage faults even when training with zero-leakage samples. Attached Figure Description

[0029] Figure 1 This invention relates to a zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network, wherein... Figure 1 (a) is the pre-training phase process. Figure 1 (b) is the reasoning stage process; Figure 2 This is a schematic diagram of the data flow in a dual-adversarial decoding network. Figure 3 Here is a structural diagram of a pipeline leakage simulation model; Figure 4 This is a graph showing the pressure changes of a pipeline system under normal and leaking conditions. Figure 5 This is a diagram showing the mask reconstruction results of normal and abnormal samples of the actual pipeline system. Detailed Implementation

[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0031] This invention aims to provide a zero-sample anomaly detection method for pipeline leaks based on a bi-adversarial decoding network, addressing the problem of scarce fault samples and the difficulty in identifying unknown faults. Ultimately, it achieves zero-sample detection of unknown leak faults. (Refer to...) Figure 1 The core technical solution and steps are as follows: Step 1: Normalize the real samples from the actual system and the abnormal samples generated by simulation, construct a mask patch autoencoder, and input the random masks of normal and abnormal samples into the encoder to obtain the reconstructed features.

[0032] Step 2: Construct a model framework that includes a mask block autoencoder and a dual adversarial decoder, and train the parameters based on the idea of ​​minimizing the reconstruction error.

[0033] Step 3: Jointly train the model with the two sets of data, and achieve adversarial training by weighted fusion of normal loss and abnormal loss to optimize the feature extraction network and dual decoder parameters.

[0034] Step 4: Input the signal to be detected in the target pipeline dataset into the trained feature encoder to obtain latent features. The system calculates the reconstruction error between the input sample and the normal decoder output, and uses the mean square error as the evaluation index.

[0035] Step 5: Based on the error distribution of normal data during training, set a dynamic threshold. By comparing the reconstruction error of the signal to be detected with the dynamic threshold, zero-sample identification of unknown leakage faults can be achieved.

[0036] Specifically, this invention normalizes real samples from actual systems and simulated abnormal samples, constructs a mask block autoencoder to generate reconstructed features, and then combines the mask block autoencoder with a dual adversarial decoder to build a model framework and complete parameter training and adversarial optimization. Finally, through feature extraction, reconstruction error calculation, and dynamic threshold comparison, it achieves zero-sample identification of unknown leakage faults, effectively solving the problem of scarce real fault data in industrial pipeline leakage detection. The generated simulated abnormal data is reliable and diverse, providing solid data support for zero-sample detection. The dual-adversarial decoding network structure enables the feature extraction network to learn stable representations of normal patterns through adversarial training between normal and abnormal decoders, while significantly enhancing the ability to distinguish abnormal patterns and improving the model's sensitivity to identifying unknown faults. The introduction of the mask block autoencoder strengthens the model's ability to capture key signal features through a mask completion mechanism, further improving the robustness of feature representation. The dynamic threshold setting replaces the manual threshold setting method, avoiding the incompatibility of fixed thresholds under different operating conditions and greatly improving the model's generalization ability and engineering practicality. The entire method can accurately identify unknown leakage faults without relying on real fault data for model fine-tuning. It significantly outperforms traditional methods such as autoencoders and single-class support vector machines in terms of accuracy, recall, and F1 score, effectively reducing the false negative rate.

[0037] This study experimentally investigated the pipeline system described in the publicly available dataset, *Dataset of Leak Simulation in Experimental Testbed Water Distribution System*. The results of this dataset came from a constructed hydraulic test bench, which is 7.5 meters long and 5 meters wide, with a total pipeline length of 47 meters, consisting of 17 152.4 mm PVC pipes arranged in a ring structure. The experiment mainly focused on two aspects: completing model training and inference within a unified data framework and verifying the advantages of the proposed method in zero-shot detection tasks. The implementation process of this invention is detailed below: Step 1: Simulation Modeling and Structural Parameter Definition of Piping System Step 11: Based on the actual pipeline system structure, determine the pipeline topology, including pipe segment length, pipe diameter, node connection relationship, and the location of key functional components, such as water pumps, valves, water tanks, and pressure sensors.

[0038] Steps 1 and 2: Based on the specific structural parameters of the actual pipeline, a dynamic simulation model of the pipeline system is established using the fluid system simulation software Flowmaster (refer to...). Figure 3 As shown in the figure, parameters such as pipe material properties, pipe wall roughness, medium density, wave velocity, and boundary pressure conditions are set to ensure that the simulation model is consistent with the real pipeline system in terms of dynamic characteristics.

[0039] Step 13: Perform steady-state verification on the simulation model. Run the simulation model under leak-free conditions to ensure that the pressure and flow responses obtained from the simulation are consistent with the actual normal operating data in terms of variation trends and amplitude ranges. The simulation results for normal and leak samples are as follows: Figure 2 As shown.

[0040] Specifically, this invention clarifies the pipeline topology based on the actual pipeline system's structural composition, precisely defining pipe segment lengths, diameters, node connections, and the locations of key functional components such as pumps, valves, water tanks, and pressure sensors. This provides a precise structural foundation for the subsequent construction of the simulation model. Based on this defined pipeline topology and the specific structural parameters of the actual pipeline, a dynamic simulation model of the pipeline system is established using the fluid system simulation software Flowmaster. Key parameters such as pipe material properties, pipe wall roughness, medium density, wave velocity, and boundary pressure conditions are reasonably set, ensuring that the dynamic simulation model is highly consistent with the real pipeline system in terms of dynamic characteristics. By running the dynamic simulation model under leak-free conditions and performing steady-state verification, it is ensured that the pressure and flow responses obtained from the simulation are consistent with the actual normal operation data in terms of variation trends and amplitude ranges. This provides reliable model support for the subsequent generation of highly reliable simulation anomaly samples, effectively solving the problem of scarce real leakage fault data.

[0041] Step 2: Leakage Fault Injection and Abnormal Data Generation Step 21: Simulate the orifice leakage fault. Simulate leakage at the node where the fault occurs. To simulate this scenario in detail, a ball valve is installed at this node to simulate the fluid leakage process when the pipeline leaks.

[0042] Step 22: Adjust the opening of the ball valve to control the size of the simulated leak hole, which can cover abnormal states of leakage of different degrees.

[0043] Steps 2 and 3: Collect the time-series signal output by the pressure sensor and compare it with the data under leak-free conditions to form a simulation anomaly sample set.

[0044] Specifically, based on a clear understanding of the pipeline topology, this invention simulates the fluid leakage process during orifice leakage by installing ball valves at fault nodes. This allows for a detailed recreation of real orifice leakage scenarios, ensuring the realism and relevance of the leakage simulation. By adjusting the ball valve opening to control the size of the simulated leak orifice, it comprehensively covers abnormal states with varying degrees of leakage, resulting in a rich diversity of generated abnormal samples and avoiding the insufficient generalization ability of the model caused by samples of a single leakage degree. Furthermore, by collecting time-series signals from pressure sensors at determined locations under different leakage degrees and comparing them with data from leak-free operating conditions that have passed steady-state verification, the accuracy and reliability of the simulated abnormal sample set are ensured.

[0045] Step 3: Construct a mask completion autoencoder Step 31: Design an encoder to map the input data to the hidden layer. The input data is transformed into a low-dimensional data representation in the latent space, with the following structure:

[0046] in This is a low-dimensional representation of the transformed feature space. This is the activation function of the encoder. For the encoder weights, This is the bias vector of the encoder. The timing data of real normal samples and simulated abnormal samples of the pipeline system are used as input mask autoencoders.

[0047] Step 32: Design a decoder to transform the low-dimensional representation of the latent space to the dimension of the original data, thereby reconstructing the input data. Its structure is as follows:

[0048] in This is the reconstructed output signal of the decoder in S21. The activation function of the decoder. For the weights of the decoder, This is the bias vector for the decoder.

[0049] Step 33: Combine the encoder and decoder to form the final designed autoencoder. The purpose is to minimize the reconstruction error. The loss function of the final designed autoencoder is:

[0050] in The total number of training samples. To minimize the reconstruction error.

[0051] Steps 3 and 4: Randomly apply a mask to the time series samples at the model input, obscuring part of the time slice or feature dimension. Guide the encoder to learn the temporal dynamic features of the pipeline system by reconstructing the masked region.

[0052] in For time series samples without randomly applied masks, The mask matrix is ​​generated randomly. For mask matrix The value of the element at the i-th row and j-th column, if This indicates that a mask is applied to the element at position j of the i-th time series sample. This indicates that no mask was applied to the element at position j of the i-th time series sample, where i ≤ B and j ≤ T. This is the reconstructed output of a masked autoencoder for time-series samples after being masked by time segments. B represents the number of time-series samples input for each training iteration, where B ≤ N. The length of each time series sample, This is the loss function for the mask reconstruction part.

[0053] Specifically, this invention utilizes a dedicated encoder to map input data to a hidden layer and transform it into a low-dimensional data representation in the latent space, effectively extracting core information from pipeline system signals. A matching decoder accurately converts low-dimensional features back to the original data dimension, achieving efficient reconstruction of the input data. Combined with a loss function aimed at minimizing reconstruction error, the accuracy of data reconstruction is further improved. The encoder and decoder are integrated to form a complete masked block autoencoder. A mask is randomly applied to the time-series samples at the input, and the encoder is guided to focus on key signal features by reconstructing the masked region. This enhances the ability to capture the dynamic temporal features of the pipeline system, significantly improves the robustness of feature representation, and avoids interference from irrelevant information.

[0054] Step 4: Construct a dual-adversarial decoder Step 41: Learn the temporal structure pattern from real normal samples to ensure the model can stably depict the dynamic laws of the pipeline system under healthy operating conditions. The input pipeline operation data sequence is first encoded by the feature extraction module to obtain the latent representation vector of the system state. Subsequently, the normal decoder uses this latent representation to reconstruct the original signal. The data propagation method is as follows: Figure 4 .

[0055] Step 42: Based on the idea of ​​minimizing reconstruction error, parameter training is performed to enable the decoder to accurately recover the normal operating mode. The loss function of the normal decoder is:

[0056] in For a set of real, normal samples, The loss function for the normal branch decoder, The parameters represent the mask autoencoder. This represents the parameters of the normal branch decoder. This represents the number of real, normal samples. This represents the function of the mask autoencoder. This represents the function that executes the normal branch decoder.

[0057] Step 43: Introduce an anomaly decoder to prevent the model from still fitting anomalies well in situations that may overlap with normal data, thus reducing anomaly detection sensitivity. The core idea is to explicitly introduce anomaly samples or construct pseudo-anomaly samples through noise perturbation during the training phase. This allows the model to learn not only how to reconstruct normal data but also how to produce poor reconstruction results in anomaly situations, actively differentiating normal and anomaly patterns in the latent space. The loss function of the anomaly decoder is:

[0058] in This is a set of anomalous samples, which includes anomalous samples generated by simulation and pseudo-annomous samples constructed by applying noise perturbations to real normal samples. Let be the loss function of the anomaly branch decoder. The parameters represent the mask autoencoder. The parameters represent the exception branch decoder. The number of abnormal samples. This represents the function of the mask autoencoder. This represents the function that executes the exception branch decoder. The emphasis factor for the abnormal sample data structure is a predefined matrix. If the element at position j of the i-th abnormal sample has a significant abnormal feature, then the emphasis factor is increased. If the element at the i-th row and j-th column approaches 1, and the anomalous feature of the element at the j-th position of the i-th anomalous sample is not significant, then the emphasis factor is... The element at the i-th row and j-th column is close to 0. This represents matrix multiplication.

[0059] Step 44: Weighted fusion of normal and abnormal losses:

[0060] in These are preset adjustment parameters used to balance the model's learning ability for normal and abnormal sample patterns, so that the loss function of the normal branch decoder is as small as possible, while the loss function of the abnormal branch decoder is as large as possible after backpropagation.

[0061] Specifically, this invention learns the temporal structure pattern of a pipeline system based on real normal samples, enabling the model to stably characterize the dynamic laws of the pipeline system's healthy operating state. By inputting real normal samples into a feature encoder to obtain a latent representation vector, and then reconstructing the original signal through a normal decoder, coupled with parameter training that minimizes reconstruction error, the normal decoder ensures accurate recovery of the signal characteristics of the normal operating mode. By explicitly introducing simulated abnormal or pseudo-abnormal samples to construct an abnormal decoder, the problem of overfitting the model to abnormalities and reducing detection sensitivity due to overlapping operating conditions with the normal mode is effectively avoided. Simultaneously, the separability between normal and abnormal modes in the latent space is actively increased, strengthening the model's ability to distinguish abnormal modes. By weighted fusion of normal and abnormal losses and adjusting parameters to balance the model's learning ability for normal and abnormal modes, the training objective of "minimizing normal loss and maximizing abnormal loss" is achieved, allowing the feature extraction network to firmly grasp the stable representation of the normal mode while also keenly capturing the differential features of the abnormal mode.

[0062] Step 5: Zero-Sample Anomaly Inference and Dynamic Threshold Setting Step 51: After the model training is completed, only the encoder and normal decoder are retained for the online inference stage. The pipeline operation data to be detected is input into the model, and the corresponding reconstruction error is calculated.

[0063] Step 52: Based on the reconstruction error distribution of normal samples during the training phase, calculate its mean and standard deviation, and adaptively set the dynamic discrimination threshold accordingly.

[0064] Step 53: When the reconstruction error of the sample to be tested exceeds the dynamic threshold, it is determined that there is a leakage abnormality in the corresponding pipeline; when the reconstruction error is lower than the threshold, it is determined that the pipeline system is in normal operation.

[0065] Specifically, after model training, this invention retains only the optimized feature encoder and the normal decoder from the bi-adversarial decoder for online inference. This ensures both the efficiency and simplicity of the inference process and full utilization of the performance of the optimized core components during training, guaranteeing the quality of feature extraction and data reconstruction of the detected signal. The detected signal from the target pipeline dataset is input into the feature encoder to obtain latent features. The reconstruction error between these latent features and the normal decoder output is calculated using the mean square error as an evaluation metric. This objectively quantifies the deviation of the detected signal from the normal pattern, providing accurate quantitative evidence for anomaly detection. Based on the reconstruction error distribution of normal data during training, a dynamic discrimination threshold is adaptively set by calculating the mean and standard deviation. This effectively adapts to the detection requirements under different working conditions, avoiding the inadequacy of fixed thresholds in complex conditions and significantly improving the model's generalization ability. By comparing the reconstruction error of the detected signal with the dynamic threshold, the presence of a leak in the pipeline system can be quickly and accurately determined, achieving zero-sample identification of unknown leak faults, effectively reducing the false negative rate, and ensuring that the model can reliably and stably complete real-time pipeline leak detection tasks in complex industrial scenarios.

[0066] The method of this invention was validated using actual pipeline system data, with leakage anomaly detection results used as the evaluation index. Experimental results are as follows: Figure 5 As shown, this method can still effectively identify unknown pipeline leakage anomalies without introducing real leakage samples for training, verifying the feasibility and engineering application value of the present invention in zero-sample anomaly detection scenarios.

[0067] This invention presents a zero-shot pipeline leakage anomaly detection method based on a dual-adversarial decoding network, aiming to improve the fault detection capability of complex systems with zero-shot capability. By extracting only normal operating samples as health state data from a public dataset, a pipeline system model consistent with the real structure is constructed. A large number of highly reliable simulated anomaly samples are obtained by injecting leakage faults. Subsequently, real normal samples and simulated anomaly samples are used together for model pre-training, constructing a dual-decoding autoencoder framework with domain adversarial capability. This achieves cross-domain feature alignment and robust representation learning, and in the inference stage, the pre-trained encoder is used to discriminate unknown real anomaly data, achieving zero-shot anomaly detection. This framework, by introducing simulated anomaly data for pre-training based only on real normal operating data, achieves zero-shot anomaly detection of unknown leakage faults. Through this framework, it is expected to achieve reliable identification and stable discrimination of unknown pipeline leakage anomalies under conditions lacking real fault samples, thereby substantially improving the model's zero-shot anomaly detection capability and generalization performance under complex operating conditions.

[0068] This invention is not limited to the above-described embodiments. Without departing from the spirit and essence of this invention, those skilled in the art can make equivalent substitutions or improvements to the sequence of steps, parameter settings, and specific implementation forms, all of which should fall within the protection scope of the claims of this invention.

Claims

1. A zero-sample anomaly detection method for pipeline leaks based on a bi-adversarial decoding network, characterized in that, Includes the following steps: S1. Normalize the real normal samples collected from the actual pipeline system and the abnormal samples generated by simulation, construct a mask autoencoder, apply continuous random masks to the normal samples and abnormal samples and input them into the mask autoencoder to obtain the reconstructed features. S2. Construct a model framework that includes the masked autoencoder and the normal / abnormal dual-branch adversarial decoder. The optimization objective is to minimize the reconstruction error between the input sample and the reconstruction feature output by the corresponding masked autoencoder. The encoder and decoder parameters of the model are initially trained using the masked sample data to complete the initial configuration of the model parameters. The normal / abnormal dual-branch adversarial decoder includes two parallel decoding branches: a normal branch decoder and an abnormal branch decoder. S3. Input the normalized real normal samples and the normalized simulated abnormal samples into the model framework after initial training for further training. Input the reconstructed features extracted from the real normal samples by the mask autoencoder into the normal branch decoder. Calculate the mean square error between the decoder reconstruction result and the real normal samples as the normal loss. The reconstructed features extracted from the simulated abnormal samples by the masked autoencoder are input into the abnormal branch decoder. The adversarial loss between the decoder reconstruction result and the simulated abnormal samples is calculated as the abnormal loss. The normal loss and the abnormal loss are weighted and fused to obtain the total loss. Based on the total loss, backpropagation is iterated to minimize the reconstruction loss of normal samples and maximize the reconstruction loss of abnormal samples, thereby completing the dual-branch adversarial training and optimizing the parameters of the masked autoencoder and the normal / abnormal dual-branch adversarial decoder. S4. Input the target pipeline signal to be detected into the mask autoencoder optimized by S2 and S3 to obtain the reconstruction features of the signal to be detected. Calculate the mean square error between the reconstruction features of the signal to be detected and the output of the normal branch decoder in the normal / abnormal dual-branch adversarial decoder as the reconstruction error. S5. Based on the distribution of the mean square error between the normal branch decoder and the real normal samples during the training process in S3, calculate the mean and standard deviation of the mean square error and adaptively set the dynamic discrimination threshold. By comparing the reconstruction error of the signal to be detected obtained in S4 with the dynamic discrimination threshold, zero-sample anomaly detection of pipeline leakage faults is achieved.

2. The zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network according to claim 1, characterized in that, The specific steps for generating anomalous samples in S1 include: S11. Based on the actual pipeline system structure, determine the pipeline topology, including pipe segment length, pipe diameter, node connection relationship and the location of key functional components, including water pumps, valves, water tanks and pressure sensors; S12. Based on the pipeline topology determined in S11 and the specific structural parameters of the actual pipeline, a dynamic simulation model of the pipeline system is established using the fluid system simulation software Flowmaster. The pipe material properties, pipe wall roughness, medium density, wave velocity and boundary pressure conditions are set so that the dynamic simulation model is consistent with the real pipeline system in terms of pressure and flow dynamic characteristics. S13. Perform steady-state verification on the dynamic simulation model established in S12. Run the dynamic simulation model under leak-free operating conditions to ensure that the pressure and flow response obtained from the simulation are consistent with the actual normal operating data in terms of change trend and amplitude range. S14. At the fault node of the pipeline topology, a ball valve is installed to simulate the fluid leakage process of the orifice. The opening degree of the ball valve is adjusted to control the size of the leakage orifice to cover different leakage degrees. The time series signal output by the pressure sensor is collected to form a simulation anomaly sample set.

3. The zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network according to claim 2, characterized in that, The construction steps of the mask autoencoder described in S2 include: S21. Design the encoder in the masked autoencoder structure to map the input data to the hidden layer and transform the input data into a low-dimensional representation in the feature space. The structure is as follows: in This is a low-dimensional representation of the transformed feature space. This is the activation function of the encoder. For the encoder weights, This is the bias vector of the encoder. The timing data of real normal samples and simulated abnormal samples of the pipeline system are used as input mask autoencoders; S22. Design the decoder in the masked autoencoder structure to transform the low-dimensional representation of the feature space to the dimension of the original data, thereby reconstructing the input data. Its structure is as follows: in This is the reconstructed output signal of the decoder in S21. The activation function of the decoder. For the weights of the decoder, This is the bias vector for the decoder; S23. The encoder in S21 and the decoder in S22 are combined to form a mask autoencoder. The mask autoencoder aims to minimize the reconstruction error between the real normal sample time series data or simulated abnormal sample time series data of the pipeline system input to the mask autoencoder and the reconstructed output signal of the decoder in the mask autoencoder structure. Its loss function is: in The total number of training samples. This represents the reconstruction error; S24. At the input of the masked autoencoder formed in S23, a mask is randomly applied to the time series samples of the input masked autoencoder, setting the element values ​​in some time segments of the time series samples to 0. By reconstructing the masked time segments, the masked autoencoder is guided to learn the timing pattern of the pipeline system. The loss function of its mask reconstruction part is: in For time series samples without randomly applied masks, The mask matrix is ​​generated randomly. For mask matrix The value of the element at the i-th row and j-th column, if This indicates that a mask is applied to the element at position j of the i-th time series sample. This indicates that no mask was applied to the element at position j of the i-th time series sample, where i ≤ B and j ≤ T. This is the reconstructed output of a masked autoencoder for time-series samples after being masked by time segments. B represents the number of time-series samples input for each training iteration, where B ≤ N. The length of each time series sample, This is the loss function for the mask reconstruction part.

4. The zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network according to claim 3, characterized in that, The steps of the two-branch adversarial training described in S3 include: S31. Based on real normal samples, learn the temporal structure pattern of the pipeline system to ensure that the model can stably depict the dynamic law of the healthy operation state of the pipeline system. Input the real normal samples into the mask autoencoder for encoding to obtain the feature representation vector of the system state. Then, input the feature representation vector into the normal branch decoder in the normal / abnormal dual-branch adversarial decoder. The normal branch decoder completes the reconstruction of the original real normal sample signal. S32. Based on the idea of ​​minimizing reconstruction error, the parameters of the normal branch decoder in the mask autoencoder and normal / abnormal dual-branch adversarial decoder structure are trained so that the normal branch decoder can accurately recover the signal characteristics of the normal working condition mode in the random masked segment of the real normal sample. The loss function of the normal branch decoder is: in For a set of real, normal samples, The loss function for the normal branch decoder, The parameters represent the mask autoencoder. This represents the parameters of the normal branch decoder. This represents the number of real, normal samples. This represents the function of the mask autoencoder. This represents the function that enables the normal branch decoder; S33. An anomalous branch decoder is introduced into the normal / abnormal dual-branch adversarial decoder structure. During the training phase, simulated anomalous samples or pseudo-abnormal samples constructed by applying noise perturbations to real normal samples are explicitly introduced. This allows the model to enhance its ability to distinguish anomalous patterns while learning to reconstruct real normal sample data, actively widening the gap between normal and anomalous patterns in the latent space. The loss function of the anomalous branch decoder is: in This is a set of anomalous samples, which includes anomalous samples generated by simulation and pseudo-annomous samples constructed by applying noise perturbations to real normal samples. Let be the loss function of the anomaly branch decoder. The parameters represent the mask autoencoder. The parameters represent the exception branch decoder. The number of abnormal samples. This represents the function of the mask autoencoder. This represents the function that executes the exception branch decoder. The emphasis factor for the abnormal sample data structure is a predefined matrix. If the element at position j of the i-th abnormal sample has a significant abnormal feature, then the emphasis factor is increased. If the element at the i-th row and j-th column approaches 1, and the anomalous feature of the element at the j-th position of the i-th anomalous sample is not significant, then the emphasis factor is... The element at the i-th row and j-th column is close to 0. Represents matrix multiplication; S34. The loss function of the normal branch decoder. Loss function of the anomaly branch decoder Perform weighted fusion: in These are preset adjustment parameters used to balance the model's learning ability for normal and abnormal sample patterns, so that the loss function of the normal branch decoder is as small as possible, while the loss function of the abnormal branch decoder is as large as possible after backpropagation.

5. The zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network according to claim 4, characterized in that, S5 includes the following steps: S51. After the model training is completed, only the optimized mask autoencoder and the normal branch decoder in the normal / abnormal dual-branch adversarial decoder are retained for online anomaly detection inference. The signal of the target pipeline to be detected is input into the mask autoencoder to obtain the reconstructed features of the signal to be detected. Then the mean square error between the reconstructed features and the output of the normal branch decoder is calculated as the reconstruction error. S52. Calculate the mean of the reconstruction error distribution of real normal sample data during the training process. with standard deviation Set the dynamic discrimination threshold to , These are preset coefficients used to adapt to anomaly detection requirements under different working conditions. ; S53. When the reconstruction error of the signal of the target pipeline under test exceeds the dynamic discrimination threshold, it is determined that there is a leakage abnormality in the target pipeline system; when the reconstruction error of the signal of the target pipeline under test is lower than the dynamic discrimination threshold, it is determined that the target pipeline system under test is in normal operation.

6. The zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network according to claim 5, characterized in that, The coefficient of S52 The setup steps are as follows: A threshold for the allowable false positive rate of normal samples in anomaly detection is set. The allowable false positive rate threshold is a preset, acceptable proportion of normal samples that are misclassified as anomalies, and its value ranges from 0.1% to 5%. Iterate through multiple coefficients with different values The coefficient The traversal range is 0.5~5.0, and the traversal step size is 0.1~0.5, for each coefficient. Calculate the corresponding dynamic discrimination threshold. ; For each of the coefficients Corresponding dynamic discrimination threshold The normal sample set contains samples that fall below the dynamic discrimination threshold. Calculate the false positive rate for normal samples based on the number of samples outside the interval. The coefficients that are selected based on the corresponding normal sample misclassification rate not exceeding the allowable misclassification rate threshold are used to identify the correct values. The coefficients that satisfy the preset optimization conditions are selected. As the optimal coefficient The preset optimization condition is: the misclassification rate of the corresponding normal sample is closest to the allowable misclassification rate threshold, and does not exceed the allowable misclassification rate threshold.

7. A zero-shot anomaly detection system for pipeline leaks based on a bi-adversarial decoding network, applied to the zero-shot anomaly detection method for pipeline leaks based on a bi-adversarial decoding network as described in any one of claims 1-6, characterized in that, The system includes: The data preprocessing and mask reconstruction feature generation module is used to normalize the real normal samples collected from the actual pipeline system and the abnormal samples generated by simulation, construct a mask autoencoder, and input the normal samples and abnormal samples into the mask autoencoder after random masking to obtain the reconstructed features. The model framework construction and initial parameter training module is used to construct a model framework that includes the mask autoencoder and the normal / abnormal dual-branch adversarial decoder. Based on the idea of ​​minimizing reconstruction error, the reconstruction features are used to train the model parameters. The joint sample adversarial training and parameter optimization module is used to jointly input normalized real normal samples and normalized simulated abnormal samples into the model framework to train the model. Adversarial training is achieved by weighted fusion of the loss functions of the normal branch decoder and the abnormal branch decoder, and the parameters of the mask autoencoder and the normal / abnormal dual-branch adversarial decoder are optimized. The module for extracting and reconstructing the signal feature is used to input the signal of the target pipeline to be detected into the optimized mask autoencoder to obtain the reconstructed features, and to calculate the mean square error between the reconstructed features and the output of the normal branch decoder in the normal / abnormal dual-branch adversarial decoder as the reconstruction error. The dynamic discrimination threshold setting and zero-sample anomaly identification module is used to set a dynamic discrimination threshold based on the error distribution of normal sample data during the training process in the adversarial training and parameter optimization module of the joint real normal sample and simulated abnormal sample. By comparing the reconstruction error of the target pipeline signal obtained by the signal feature extraction and reconstruction error calculation module with the dynamic discrimination threshold, zero-sample anomaly detection of pipeline leakage faults can be achieved.

8. A computer device system, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the zero-sample anomaly detection method for pipeline leaks based on a bi-adversarial decoding network as described in any one of claims 1-6.

9. A storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network as described in any one of claims 1-6.

10. A computer device, characterized in that, include: The memory, the processor, and the computer program stored in the memory and executable on the processor, the processor executing the program to implement the zero-sample anomaly detection method for pipeline leaks based on a dual-adversarial decoding network as described in any one of claims 1-6.