Oil and gas pipeline anomaly detection method based on AMVMD and ASPN

The noise was removed by the AMTCF-VMD method and the ASPN model combined with the SwinTransformer and Attention mechanism were used to solve the problem of insufficient noise interference and information capture capabilities in the abnormal detection of oil and gas pipelines, and high-precision and efficient abnormal detection were achieved.

CN118965229APending Publication Date: 2024-11-15CHANGZHOU UNIV
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202411119189.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The existing oil and gas pipeline anomaly detection technology is affected by background noise, signal mode complexity and pipeline condition changes, and the detection performance is not ideal. The CNN and recurrent neural network methods have large parameters, high training costs, insufficient samples, and capture global information. Poor ability problem.

Method used

The AMTCF-VMD method is proposed to remove industrial noise interference, and the ASPN model is adopted, combined with SwinTransformer, AgentAttention, ASPP and PSA modules to capture multi-level features and global information, make up for the shortcomings of CNN's inability to achieve global and remote semantic information interaction, and improve classification detection Accuracy.

Benefits of technology

Effectively filter out background noise, improve detection accuracy and efficiency, enhance model generalization capabilities, and realize high-precision and efficient early automated diagnosis and detection of abnormalities. It is suitable for oil and gas station application scenarios with resource-constrained.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118965229A_ABST
    Figure CN118965229A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of pipeline anomaly detection, in particular to an oil and gas pipeline anomaly detection method based on AMVMD and ASPN, and the method comprises the steps: collecting an abnormal audio signal of an oil and gas pipeline, and carrying out the preprocessing of the abnormal audio signal; fusing a Swin Transform and a CNN (Convolutional Neural Network) to serve as a feature extraction layer of an ASPN model, and capturing global and local information in the audio Mel spectrum image; agentAttention is introduced to aggregate global information, so that the calculation complexity is reduced; an ASPP module and a PSA module are fused in a CNN network, local and non-local feature information is integrated, a spatial context is captured, and feature aggregation is carried out. The problems that the denoising effect of the VMD algorithm is poor and the accuracy of oil and gas pipeline anomaly detection conducted by the SwinTransform model is poor are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of pipeline anomaly detection, and in particular to an oil and gas pipeline anomaly detection method based on AVMMD and ASPN. Background Art

[0002] As the artery of global energy transportation, the safe and stable operation of oil and gas pipelines is of vital importance; therefore, real-time anomaly detection of pipelines is required; among many anomaly detection technologies, acoustic detection determines the existence, location and size of anomalies by analyzing the frequency, amplitude, propagation speed and other characteristics of abnormal sound waves; but in actual applications, factors such as background noise, signal pattern complexity and changes in pipeline conditions may affect the effectiveness of acoustic detection.

[0003] In response to the above challenges, traditional pipeline anomaly detection methods mainly rely on signal processing technology, including time domain analysis, frequency domain analysis, and time-frequency domain analysis. Among them, Dhiman et al. proposed a whale optimization algorithm to optimize VMD parameters to enhance circuit fault signal detection, but this type of optimization algorithm is time-consuming. Although methods based on traditional signal processing have certain effects, they are affected by background noise, signal pattern complexity and changes in pipeline conditions, and the detection performance is often not ideal.

[0004] Xie et al. collected acoustic leakage signals of underwater pipelines and combined ensemble empirical mode decomposition (EEMD), Hilbert-Huang transform (HHT) and convolutional neural network (CNN) to identify the extent of pipeline leakage. The combination of CNN and time-frequency domain hydroacoustic signal visualization provided new insights for underwater pipeline fault identification, but this combination leads to intensive computation. Su et al. proposed a decision-level fusion dual-stream CNN (TSCNN-DS), which fused two sets of auditory features with a four-layer CNN architecture to effectively characterize environmental sounds to improve classification accuracy. However, the dependence on specific combination features limits the model's generalization ability to capture a wider range of audio. Adavanne et al. proposed a stacked convolutional and recurrent neural network (CRNN), which used 3D CNN to learn inter-channel and intra-channel features from multi-channel audio, improving the detection of overlapping sound events in multi-channel audio. However, the amount of feature information in the data set was small, which affected the generalization ability of the model. Therefore, although the methods based on CNN and recurrent neural network can automatically extract features from data and improve detection accuracy to a certain extent, they also have defects such as large number of parameters, high training cost, insufficient samples, and poor ability to capture global information.

[0005] Recently, the Transformer model based on the self-attention mechanism has achieved powerful performance in the fields of natural language processing (NLP) and CV. Zhou et al. fused the Swin transformer and CNN and proposed a hybrid tunnel crack semantic segmentation algorithm (SCDeepLab), which effectively improved the performance of SwinTransformer in the case of insufficient tunnel crack image data. However, the actual operating environment of the pipeline is complex and changeable, and it is impossible to pay attention to all working conditions in the pipeline operation, especially the acoustic signals during leakage and failure. Therefore, it is particularly important to study appropriate detection and classification methods for oil and gas pipeline anomaly detection. Summary of the invention

[0006] In view of the shortcomings of the existing methods, the present invention proposes an AMTCF-VMD method (adaptive multi-threshold center frequency variational mode decomposition method), referred to as AVMMD, to remove industrial noise interference; and an ASPN model (Agent SwinPyramidNet) is used for pipeline anomaly detection. SwinTransformer is used as the backbone network to extract multi-level features, AgentAttention is combined to extract and compress global information, and CNN and ASPP (Atrous Spatial Pyramid Pooling) and PSA (PyramidSplitAttention) are integrated to capture richer contextual space and semantic information, make up for the shortcomings of CNN that cannot realize the interaction of global and long-range semantic information and the limitation of traditional SwinTransformer that over-focuses on local features, and improve the classification detection accuracy.

[0007] The technical solution adopted by the present invention is: the oil and gas pipeline anomaly detection method based on AMVMD and ASPN includes the following steps:

[0008] Step 1: Collect abnormal audio signals from oil and gas pipelines and pre-process the abnormal audio signals;

[0009] As a preferred implementation of the present invention, the preprocessing includes: using the AVMMD method to solve the optimal solution of the constrained variational equation to decompose the abnormal signal into the sum of inherent eigenmode components of different bandwidths.

[0010] As a preferred embodiment of the present invention, the AVMMD method comprises:

[0011] Step 11: Set T1 = β * cf_max IMF、T2=γ*cf_max IMF 、T3=δ*cf_max IMF , β, γ, δ are the thresholds of the center frequency aliasing quotient, cf_max IMF is the maximum value of the center frequency of the IMF component;

[0012] Step 12: within the maximum value range of the penalty factor α and the number of decomposition layers K, decompose the abnormal audio signal into IMF components, and calculate the envelope signal and center frequency value of the IMF;

[0013] Step 13: Calculate the center frequency aliasing quotient P K , and for P K To impose restraints;

[0014] Step 14: P K Compare with T1, T2, and T3 cyclically to determine the optimal K value under the current α value, and calculate the fuzzy entropy FE to determine the optimal combination of α and K values.

[0015] Step 2: Integrate SwinTransformer and CNN network as the feature extraction layer of the ASPN model to capture global and local information in the audio mel spectrum image; introduce AgentAttention to aggregate global information and reduce computational complexity; integrate ASPP and PSA modules in the CNN network to integrate local and non-local feature information, capture spatial context and perform feature aggregation;

[0016] As a preferred embodiment of the present invention, step 2 includes:

[0017] Convert audio samples into time-frequency domain Mel-spectrograms;

[0018] Input the Mel-spectrogram into the Patch-Partition layer and divide it into AudioPatchTokens;

[0019] Use the Patch-Partition module to flatten the Audio PatchTokens and aggregate the token sequences of different frequencies at the same time;

[0020] In the Patch Embedding layer, the window of the feature layer is mapped to dimension D, and the Token sequence is reshaped into the original 2D feature map.

[0021] As a preferred implementation of the present invention, step 2 also includes: fusing Swin Transformer is to embed AgentAttention in the Swin Transformer blocks in group1 to group3 of Swin Transformer.

[0022] As a preferred embodiment of the present invention, the fusion SwinTransformer includes:

[0023] Use the Patch-Merging layer to merge adjacent Token sequences into feature maps

[0024] Through the linear layer, the feature map Reduced to feature map Perform alternating compression of the stacked structure to obtain the feature map

[0025] As a preferred embodiment of the present invention, the ASPP and PSA modules are integrated in the CNN network, local and non-local feature information are integrated, spatial context is captured and feature aggregation is performed, including: constructing an HPC network, including: 2D CNN and ASHPA modules; wherein,

[0026] 2D CNN is used to integrate the frequency band semantic information of Group4 of Swin Transformer, local features of time and frequency are modeled through convolution kernels, and the feature map output by Group4 is projected onto the event category;

[0027] The multi-scale context information is captured through the ASHPA module, and the feature map is globally averaged and pooled, and the average is calculated along the time axis to generate a 1×C vector, which is input into the fully connected layer to obtain the event score.

[0028] As a preferred embodiment of the present invention, the ASHPA module includes an ASPP module and a PSA module, and the ASPP module is composed of a dilated convolution with parallel expansion rates of (6, 12, 18) and a global average pooling.

[0029] As a preferred embodiment of the present invention, an oil and gas pipeline anomaly detection system based on AVMMD and ASPN includes: a memory for storing instructions executable by a processor; and a processor for executing instructions to implement an oil and gas pipeline anomaly detection method based on AVMMD and ASPN.

[0030] As a preferred embodiment of the present invention, a computer readable medium stores a computer program code, and when the computer program code is executed by a processor, the oil and gas pipeline anomaly detection method based on AMVMD and ASPN is implemented.

[0031] Beneficial effects of the present invention:

[0032] 1. Aiming at the problem that the background noise covers the abnormal signal and affects the accuracy of the model, the time-frequency analysis of AVMMD is designed to accurately present the time-frequency energy distribution characteristics of the pipeline abnormal signal, effectively filter out the strong noise in the measured abnormal audio, and avoid the interference of noise on subsequent classification detection;

[0033] 2. In view of the problems of strong data dependence and easy loss of local features in the Swin Transformer network, a Hybrid Pyramid ConvNet network is proposed and the AgentAttention mechanism is introduced to make up for the shortcomings of the CNN receptive field, enhance the representation ability of the global context features of the Swin Transformer, and further improve the detection accuracy and efficiency; in view of the sparse and unbalanced problems of abnormal samples such as leakage and failure, the SpecAugment and Scaper methods are integrated to enhance the data through random mask changes and multi-source signal fusion to enhance the generalization ability of the model, and the Agent-SwinPyramidNet pipeline anomaly detection model is constructed to fully learn the abnormal signal characteristics and realize efficient and accurate scene audio classification and abnormal warning;

[0034] 3. Evaluations on public environmental sound datasets and abnormal sound datasets recorded in real pipelines show that the Agent-SwinPyramidNet model can accurately detect abnormal events with superior performance;

[0035] 4. The method of the present invention has better advantages and deployment prospects in oil and gas stations and valve room application scenarios where resources are limited and a large amount of data needs to be processed. It has important application value for ensuring pipeline operation safety, energy safe storage and transportation, and reducing economic losses, and realizes high-precision and efficient early automatic diagnosis and detection of abnormalities. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a flow chart of the oil and gas pipeline anomaly detection method based on AMVMD and ASPN;

[0037] Figure 2 It is the framework diagram of the ASPN model of the present invention;

[0038] Figure 3 It is the working principle diagram of SW-MSA of the present invention;

[0039] Figure 4 It is the structure diagram of AgentAttention of the present invention;

[0040] Figure 5 It is the workflow diagram of AgentAttentionModule of the present invention;

[0041] Figure 6It is a network structure diagram of the Hybrid Pyramid ConvNet of the present invention;

[0042] Figure 7 This is the ASPP network structure diagram;

[0043] Figure 8 It is the PSA module structure diagram;

[0044] Fig. 9 This is the audio data expansion effect diagram;

[0045] Fig.10 It is a comparison chart of pretreatment effects;

[0046] Fig.11 It is the K-scale ablation effect map;

[0047] Fig.12 This is the ablation effect diagram of α value. DETAILED DESCRIPTION

[0048] The present invention is further described below in conjunction with the accompanying drawings and embodiments. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore it only shows the components related to the present invention.

[0049] like Figure 1 As shown, the oil and gas pipeline anomaly detection method based on AMVMD and ASPN includes the following steps:

[0050] Step 1: Collect abnormal audio signals from oil and gas pipelines and pre-process the abnormal audio signals;

[0051] The preprocessing includes: constructing an AVMMD method and using the AVMMD method to denoise abnormal audio signals;

[0052] Due to the complex layout of the factory environment, the industrial pipeline sound collected online is often disturbed by various noises such as the environment and machinery, and there is a problem of signal attenuation, which affects the accuracy of anomaly detection; therefore, in order to obtain the representative characteristics of the abnormal audio signal, the AVMMD method can be used to preprocess the original abnormal audio signal, and the process of solving the optimal solution of the constrained variational equation can be used to adaptively realize the frequency domain division of the signal and the effective separation of each component, so as to decompose the abnormal signal into the sum of K inherent intrinsic mode components (IMF) with different bandwidths, and realize the decomposition of leakage and fault abnormal signals.

[0053] The existing VMD method first performs modal segmentation processing on the input abnormal audio signal according to the frequency according to the decomposition layer number K value to obtain K IMF components. The specific steps are as follows:

[0054] 1. Using the Hilbert transform method, calculate each modal function u starting from k = [1, K]k The analytical function of (t) is used to obtain the corresponding marginal spectrum;

[0055] 2. Each modal function u k (t) The exponential term corresponding to the center frequency Aliasing, so that its spectrum is transferred to the corresponding baseband;

[0056] 3. Estimate each modal function u according to the gradient square criterion k (t) bandwidth size, solve the constrained variational problem, the constrained variational problem is shown in formula (1):

[0057]

[0058] Among them, * is convolution; f is the decomposed main signal; is the partial derivative of the function with respect to time t, δ t is the unit pulse signal; u k ={u1,u2,…,u k} represents the K IMF components after decomposition; ω k ={ω1,ω2,…,ω k} represents the center frequency of each IMF component.

[0059] In order to minimize equation (1), the penalty factor α and the Lagrangian multiplier λ(T) are introduced to transform the constrained variational problem into an unconstrained variational problem. The extended Lagrangian expression is shown in equation (2):

[0060]

[0061] When the relative error e is less than the convergence limit ε, the iteration is terminated; e is as shown in formula (3):

[0062]

[0063] in, and are the frequency domain representations of the kth mode at the nth and n+1th iterations, respectively.

[0064] The decomposition layer number K and the penalty factor α are the key parameters of the VMD method. Too small K and α may cause the important IMF components of the signal to be discarded or ignored as noise; while too large K and α may introduce irrelevant noise or cause mode repetition; therefore, proper adjustment of K and α is crucial for optimizing the decomposition and identification of signals; in order to determine the optimal K and α values ​​of pipeline fault signals, the scale space representation is introduced into VMD based on the multi-threshold center frequency to obtain the AVMD method, and the optimal number of modes is obtained through cyclic solution, which saves lengthy optimization logic while ensuring the decomposition effect to improve the decomposition rate.

[0065] The AMVMD method includes:

[0066] First, according to the center of the modal component, three thresholds T1, T2 and T3 are set based on the central frequency distribution characteristics of the modal component and the characteristics of the pipeline abnormal signal; among them, T1 = β*cf_max IMF 、T2=γ*cf_max IMF 、T3=δ*cf_max IMF , β, γ, and δ are the thresholds of the center frequency aliasing quotient, where β is taken as 8% to ensure that the modal center frequency is obvious enough without missing important frequency components; γ is taken as 15% to distinguish adjacent IMF components and ensure significant frequency differences; δ is taken as 50% to capture a wider range of frequency changes, thereby identifying more subtle or less significant modal quantities.

[0067] Secondly, for [1,α max ] for each α value, α max To maximize the penalty factor, set the parameter K from [1, K max ] is iterated to decompose the abnormal audio signal into a series of IMF components at different scales;

[0068] Hilbert is used to calculate the envelope signal and center frequency value of each IMF component, and a set of center frequencies cf IMF ;

[0069] Secondly, the center frequencies of the power spectrum density at different scales are subtracted from each other to select the minimum difference and the second smallest difference. As the center frequency aliasing quotient P K , and the center frequency aliasing quotient P K Constraint, P K As shown in formula (2):

[0070]

[0071] Secondly, using P K The smaller the center frequency value is, the closer the P K Compare with the three thresholds cyclically to determine the optimal K value under the current α value, and calculate the fuzzy entropy (FE) to determine the optimal combination of α and K values. The specific process is shown in Algorithm 1:

[0072] The pseudo code is as follows:

[0073]

[0074] Step 2: Integrate Swin Transformer and CNN network as the feature extraction layer of the ASPN model to capture global and local information in the audio mel spectrum image; introduce AgentAttention to aggregate global information and reduce computational complexity; integrate ASPP and PSA modules in the CNN network to integrate local and non-local feature information, capture spatial context and perform feature aggregation;

[0075] The oil and gas pipeline network is distributed throughout the country. The climate environment, equipment conditions and management levels vary greatly. A single model is difficult to cope with the complex and changing environment, resulting in poor accuracy and generalization ability. To this end, SwinTransformer and CNN networks are integrated as the feature extraction layer of the audio classification detection model to fully capture the global and local information in the audio Mel spectrum image. At the same time, in order to further improve the global context capture ability and computational efficiency of the SwinTransformer model, the Agent Attention mechanism is introduced into the Swin Transformer model to aggregate global information and reduce computational complexity. The ASPP and PSA modules are integrated into the CNN network to effectively integrate local and non-local feature information, more effectively capture spatial context at multiple scales, and aggregate features.

[0076] like Figure 2 As shown in the figure, the ASPN model is divided into three stages: audio Mel-Spectrogram encoding stage (Encode Audio Mel-Spectrogram), agent attention Swin pyramid network model (Agent SwinPyramidNet Model) and audio classification (Audio Classfication).

[0077] In the audio mel-spectrogram encoding stage, the input audio sample is first converted into a mel-spectrogram in the time-frequency domain through fast Fourier transform (FFT); the size is (H×W), the height H of the mel-spectrogram represents time T, and the width W represents frequency F.

[0078] Secondly, the Mel-spectrogram is input into the Patch-Partition layer, and the Mel-spectrogram is divided into Audio Patch Tokens of size (P×P) using the Patch-Embed CNN with a specific kernel size (P×P). This step aims to obtain more refined local features and improve the resolution of time and frequency dimensions.

[0079] Secondly, in the Patch-Partition layer, these Audio Patch Tokens are flattened along the window direction in the order of time and frequency, and the tokens of different frequencies at the same moment are aggregated and merged into an output sequence for subsequent self-attention processing;

[0080] Finally, the window of the feature layer is mapped to dimension D through the Patch Embedding layer, and the compressed audio Token sequence is reshaped into the original 2D feature map

[0081] In the Agent SwinPyramidNet Model stage, the compressed audio Token sequence is first input into the AgentSwin TransformerBlock for self-attention calculation;

[0082] Secondly, the adjacent Token sequences are merged into feature maps through the Patch-Merging layer.

[0083] Finally, the feature map is transformed into Reduce to feature map again To reduce the sequence length, and appropriately increase the feature dimension to capture higher-level audio features; after alternating processing of this layered structure, the dimension is successfully reduced to It greatly reduces the consumption of GPU memory, allowing the model to capture local details while paying full attention to global information, thereby achieving accurate classification and detection of audio signals. This not only reduces the computational complexity of the model, but also improves the model's ability to parse audio signals.

[0084] In the audio classification stage, first, a HybridPyramid ConvNet network (HPC network for short) is connected after the last Swin Transformer block. The HybridPyramid ConvNet network is composed of a 2D convolutional neural network that integrates the semantic information of all frequency bands of Group4 of Swin Transformer, models the local features of time and frequency through the convolution kernel, and projects the output feature map with a channel size of 8D onto the event category C. Then, the Atrous Spatial Hybrid Convolution is used to perform the hybrid pyramid attention. PyramidAttention, ASHPA), captures multi-scale contextual information, performs global average pooling on the feature map, averages it along the time axis, and finally generates a vector of size (1×C), which represents the category prediction result of the entire audio clip; finally, the (1×C) vector is input into the fully connected layer to obtain the final event score, and the cross entropy loss is calculated with the real sample label, and the network is updated through back propagation; the network is responsible for integrating the semantic information of each tag in the feature, and outputs the frame level and overall probability of each type of event, which enables the model to more accurately identify the start and end time of audio events, thereby achieving effective detection of abnormal audio events.

[0085] The time domain signals collected in industrial production scenarios often have a long time span, which increases the computational cost of the Transformer network in applications; the attention mechanism module, as a key component in the Transformer, can provide the model with a global receptive field and reduce computational costs, but the excessively high computational complexity will also limit its application in various scenarios and affect the model's generalization ability.

[0086] In this regard, compared with the traditional global self-attention mechanism, Swin Transformer introduces two key designs: hierarchical Transformer structure and window multi-head self-attention mechanism (Window Multi-Head Self-Attention, W-MSA) and sliding window multi-head self-attention mechanism (Shift Window Multi-Head Self-Attention, SW-MSA), which optimize the model's ability to capture the global and local dependencies of audio signals at different levels and improve the efficiency and scalability of the model; however, some fine-grained information will disappear, making it impossible to extract these features. Therefore, on this basis, the Agent Attention module is further introduced to replace part of the attention mechanism in SwinTransformerBlock, that is, Figure 2The SwinTransformerBlock in group1, group2, and group3 is replaced by Agent SwinTransformer Block, so that the model can better adapt to the dynamic changes of audio signals while capturing global and local information, thereby improving the model's anomaly detection capability and generalization performance in industrial scenarios.

[0087] In W-MSA, the input features are first divided into non-overlapping windows, and each window independently undergoes position encoding, scaled dot product attention, connection operation, fully connected layer, normalization and residual connection to obtain output features, ensuring the independence of windows, but also leading to information isolation and loss of the correlation that should exist between windows. To make up for this defect, a sliding window mechanism is proposed in SwinTransformer to exchange information in adjacent windows, thus achieving a global modeling capability in disguise and capturing a wider range of contextual information.

[0088] SW-MSA working principle diagram Figure 3 As shown, Figure 3 (a) is W-MSA. Assume that the size of the input feature map is (16×16), m=4. In SW-MSA, the feature map is first divided into windows of size (m×m), and MSA calculation is performed in each window, such as Figure 3 (b) divides the original feature map into 9 windows, and then cyclically shifts the window to the upper left corner by m / 2 tokens, pushes A0, C1, and C2 to the bottom, and then pushes B3, B6, and A0 to the right. In this way, the new window after shifting is composed of the original non-adjacent sub-windows in the feature map, such as Figure 3 (b); therefore, the Masked MSA mechanism is needed to mask and perform a second MSA calculation on each new window, setting the unnecessary attention to 0, thereby limiting the self-attention calculation to each sub-window to generate the final output, such as Figure 3 (d); Through the above operations, the effective flow of information between windows is ensured, thereby enhancing the expressiveness of the model.

[0089] The specific calculation formula of Swin TransformerBlock is shown in equations (5) to (8):

[0090]

[0091]

[0092]

[0093]

[0094] in, and z l They are the output features of the (S)W-MSA module and the MLP module in the lth Block respectively. MLP (Multi-LayerPerceptron) and LN (LayerNormalization) are multi-layer perceptron and layer normalization respectively.

[0095] For efficient modeling, SwinTransformer uses W-MSA, which is more efficient than MSA. Since its self-attention calculation is performed in a local window, assuming that there are M×M PatchTokens in each window and the size of each Token is T×F, the computational complexity of MSA and W-MSA are shown in equations (9) to (10) respectively:

[0096] Ω(MSA)=4TFD 2 +2(TF) 2 D (9)

[0097] Ω(W-MSA)=4TFD 2 +2M 2 TFD (10)

[0098] Among them, T represents the length of the time series, F represents the size of each window, D represents the projection dimension in MSA, and M represents the number of window divisions.

[0099] When using MSA for self-attention calculation, the computational complexity is the quadratic of TF, while when using W-MSA, the computational complexity is linear of TF, which effectively reduces the computational complexity and improves the detection efficiency of abnormal audio.

[0100] For the abnormal audio recognition task of the pipe network system, in order to further improve the detection accuracy and efficiency of the model for abnormal audio, the AgentAttention mechanism is introduced. By embedding AgentAttention in the Swin Transformerblock in different groups, it aims to optimize the computing performance of the model and better capture global and local details. The AgentAttention architecture is as follows Figure 4 As shown:

[0101] Agent attention consists of two standard Softmax Attentions. On the basis of traditional attention (Query, Key, Value), an additional set of Agent vectors A is added, expanding the original triple (Q, K, V) to a quadruple (Q, A, K, V).

[0102] The working principle includes two steps: agent aggregation and agent broadcasting;

[0103] Agent Aggregation: The agent tag A is used as the Q value, and attention is calculated between the K and V values ​​that remain unchanged, so as to aggregate the features in K and V, effectively concentrating the features of different values ​​to form a more representative agent feature V_A.

[0104] Agent Broadcast: Take A as the K value and V_A as the V value, and perform a second attention calculation on the Q value; pass the global information gathered in V_A to each Querytoken to generate the final output O; through the broadcast mechanism of Agenttokens, avoid directly calculating the pairwise similarity between Q and K values, while retaining the information exchange between each QK pair; by reducing the amount of directly interacted data, the computational complexity is effectively reduced, while fully retaining the ability of global context modeling. The specific workflow of the Agent Attention module is as follows Figure 5 shown.

[0105] AgentAttention integrates Softmax attention and linear attention by using two Softmax attention operations, combining the powerful expressiveness of Softmax attention and the high efficiency of linear attention to establish a generalized linear attention paradigm; thirdly, AgentAttention also introduces agent bias (AgentBias) and deep convolution module (DWC) to further improve performance; AgentBias uses position information to solve the problem of rank decrease of the calculated Attention matrix due to the lack of Softmax function in linear Attention, and maintains the diversity of features; the DWC module integrates convolution kernels of different scales, adjusts the receptive field of the module by changing the size of the convolution kernel, and applies independent filters to each input channel to capture more refined spatial features and improve the expressiveness of the model.

[0106] The attention calculation formulas of Softmax, Linear Attention and AgentAttention are shown in equations (11) to (13), and the calculation complexity of AgentAttention is shown in equation (14):

[0107] O S =σ(QK T )V=Attn S (Q,K,V) (11)

[0108]

[0109] O A =σ(QA T+B2)σ(AK T +B1)V+DWC(V) (13)

[0110] Ω(Agent Attention)=Softmax(QA T )Softmax(AK T )V (14)

[0111] in, is the proxy bias, and

[0112] It can be seen that the application of Agent Attention combines the advantages of linear Attention and global Softmaxattention. It only requires linear computational complexity to better utilize global information and improve feature representation capabilities. It reduces the computational complexity of complex Softmax attention from quadratic to linear, greatly reducing the computational requirements of the model; at the same time, despite the reduction in computational complexity, AgentAttention can still integrate the high expressiveness of Softmax attention and the high efficiency of linear attention through Agent tokens, effectively capturing and maintaining global context information; compared to the high computational complexity of SwinTransformer's W-MSA and limited local window information exchange, AgentAttention's Agent token allows more effective extraction and compression of global information, providing a strong guarantee for subsequent anomaly classification detection.

[0113] The HPC network consists of a CNN network and an ASHPA module. By integrating the ASPP module and the PSA module into the 2DCNN semantic convolution module, the model's ability to process multi-scale contextual information is further enhanced.

[0114] First, after feature extraction in the convolutional layer and feature dimension reduction in the maximum pooling layer, the abnormal and leakage features are further separated. Then, through the ASHPA module, the input feature T is evenly divided into i groups according to the channel, denoted as T i (i=1,2,3,4), change the dense connection mode between the original feature channels and reduce the number of network parameters; secondly, to obtain each group feature T iThe multi-scale contextual semantic information of the image is extracted by using a 1×1 ordinary convolution as the first layer, retaining the original feature map to supplement the spatial information; then, a dilation rate of [6, 12, 18] is selected as the 2nd to 4th layers to extract multi-scale image features; finally, global average pooling and SE Weight Module are used as the 5th and 6th layers to obtain global features and channel attention vectors; again, the convolution results of these convolution kernels of different sizes are spliced ​​to effectively aggregate multiple high-level semantic features of audio images of different scales. i ', improve the model classification performance, and finally convert the compressed audio feature sequence into a token semantic coupling attention map of each category to further support the sound event detection task. The HPC network is as follows Figure 6 shown.

[0115] The ASHPA module is mainly composed of two parts: the ASPP module and the PSA module. Figure 7 As shown in the figure, it consists of a series of parallel dilated convolutions with different expansion rates and global average pooling. While keeping the spatial resolution unchanged, the feature map is sampled in parallel at multi-scale information through dilated convolutions with different expansion rates to expand the receptive field. At the same time, the pooling operation can aggregate information at different scales and increase the network's perception of objects and structures at different scales. Finally, the features extracted from each branch are fused to extract multi-scale semantic information, thereby improving the accuracy and effect of target defect detection.

[0116] The ASPP module can effectively avoid local information loss and enhance the relevance of long-distance semantic information, but the ASPP module may also have the following two shortcomings: (1) When the dilation rate of the parallel void convolution is not set properly, the gridding effect is very likely to occur; (2) When the number of input feature channels is large, the number of module parameters is large, resulting in a high memory usage rate. In this regard, in order to solve the "grid effect" of problem (1), Wang et al. proposed the Hybrid Dilated Convolution (HDC) theory; assuming that there are n convolution kernels of size k×k and dilation rates [r1,r2…r n ], and the greatest common divisor of the expansion rate cannot be greater than 1, then the distance between two non-zero values ​​can be defined as:

[0117] M i =max[M i+1 -2r i ,M i+1 -2(M i+1 -r i ),r i ] (15)

[0118] Where M n =r n , M2≤k.

[0119] In this embodiment, the expansion rate is set to [6, 12, 18], which avoids the loss of audio semantic information and can capture target contexts of different scales, reducing the possibility of detecting erroneous target defects.

[0120] To address problem (2), the PSA module is introduced. It concatenates the convolution results of convolution kernels of different sizes to form a pyramid-shaped feature map, and then applies the attention mechanism on this feature map to extract richer feature information.

[0121] PSA module such as Figure 8 As shown in the figure, first, the input feature map is evenly divided and grouped by channel through the SPC module, and then, the spatial information on each channel feature map is subjected to multi-scale feature extraction using convolution kernels of different sizes, thereby effectively reducing the amount of convolution calculation; secondly, the channel attention of feature maps of different scales is extracted with the help of the SE Weight module to obtain the channel attention vector at each scale; thirdly, the multi-scale channel attention vectors are recalibrated through Softmax to obtain new attention weights after multi-scale channel interaction; finally, the recalibrated weights are dot-multiplied with the corresponding feature map by element, and the feature map after multi-scale feature information attention is obtained as the output, thereby improving its multi-scale information representation capability; through the combination of this series of modules, the model not only considers the global information of the audio, but also effectively learns the local features of the audio signal, and achieves good results in the task of abnormal sound detection.

[0122] Experimental process:

[0123] Pytorch is used as the framework, and the main parameters of the model are as follows: the training process uses the AdamW optimizer to continue training, the model's BatchSize is set to 64, the learning rate is 1e-4, the Window Size is set to 1024, the Hop Size is set to 320, and the mel-bins is set to 64 in the calculation of STFT and Mel spectrogram; the experimental environment configuration used in the experiment is shown in Table 1:

[0124] Table 1 Experimental environment

[0125]

[0126] The audio acquisition device for simulating abnormalities in the experiment is SV600, with the sampling frequency range set at around 30kHz. A 64-bit digital MEMS microphone is used to collect simulated leakage audio from oil and gas storage tanks.

[0127] Dataset: The abnormal audio dataset consists of two parts: industrial equipment and industrial environment. The first is the industrial equipment audio samples, which are mainly composed of 1152 audios in 10 categories such as real pipeline leakage audio collected by SV600 and public datasets such as IICA, WDN, IDMT and MIMII; among them, SV600 is set on a self-built pipeline leakage simulation test bench to record leakage sounds under different calibers and pressure parameters; the public dataset covers equipment abnormality and fault audio data in various industrial environments such as no noise, laboratory noise, hydraulic press noise, general factory noise, etc., gas leakage, liquid pipeline leakage, hydrophone, normal motor, overload, damage, etc.

[0128] Secondly, there are industrial environment audio samples, which mainly select 4,000 different environmental audio clips in 64 categories from the ESC-50, UrbenSound8K, and SCV2 public datasets, covering animals, natural soundscapes, water sounds, human activity sounds, etc., which are used to further simulate on-site industrial environments and environmental noise datasets in large outdoor scenes.

[0129] All audios were resampled to 32000Hz mono before training, and cropped or padded to an audio length of 5s. K-fold cross validation was used to divide the data set into 5 equal sizes for training and verification. At the same time, since the audio samples in real industrial scenarios are mostly normal environmental audio and less abnormal audio, if they are directly input into the model for training or simply random sampling is used, the imbalance will be aggravated. This will not only cause the model to extract fewer abnormal data features during training, but also easily lead to overfitting and make the prediction results more inclined to the normal category, thereby causing the recognition accuracy to decrease. For this reason, the two data enhancement methods of Scaper and Spec Augment are integrated to expand the data set, randomly insert abnormal audio into the original pure audio, and add random mask transformations for further enhancement, and finally expand the noise audio to 1500. The audio data expansion effect diagram is as follows Fig. 9 As shown, Fig. 9 (a) is the original audio, Fig. 9 (b) and (c) are Scaper audio enhancement and SpecAugment audio enhancement respectively.

[0130] In order to further verify the effectiveness and accuracy of the preprocessing method and model, two types of evaluation indicators were used for the preprocessing method and model respectively. For the preprocessing evaluation indicators, the signal preprocessing effect was evaluated by signal-to-noise ratio (SNR), mean square error (MSE) and mean absolute error (MAE); among them, SNR reflects the ability of the model to distinguish between abnormal sounds and background noise. A high SNR indicates that the model can effectively identify abnormal sounds in a noisy environment. MSE and MAE are indicators used to measure the difference between abnormal sound features and actual abnormal sound features. The smaller the two values, the closer the prediction of various parameters of abnormal sounds is to the actual situation and the smaller the error is.

[0131] For model evaluation indicators, the effect of the model is evaluated by precision (Precision, P), recall (Recall, R), accuracy (Accuracy, Acc), Top-5 and Matthews correlation coefficient (Mcc). Among them, True Positive (TP) refers to samples that are correctly judged to contain abnormal sounds, True Negative (TN) refers to negative samples that are correctly judged to contain no abnormal sounds, False Positive (FP) refers to negative samples that are mistakenly judged to contain abnormal sounds, and False Negative (FN) refers to samples that contain abnormal sounds but are mistakenly judged to be negative samples; on this basis, the above evaluation indicators can be calculated; Precision reflects the accuracy of the model in identifying abnormal sounds, and high precision means fewer false alarms; Recall reflects the completeness of the model in detecting samples that actually contain abnormal sounds, and a high recall rate means that the model can capture a larger part of real abnormal events; Accuracy reflects the proportion of the model correctly classified in all audio samples, whether abnormal sounds or environmental sounds; Top-5 reflects the proportion of the correct category included in the top five most likely categories predicted by the model; Finally, MCC takes TP, TN, FP and FN into consideration, and provides a score between -1 and +1. A high MCC value indicates that the model performs well in reducing false alarms and false negatives, and is a strong indicator for evaluating the overall accuracy and consistency of the model.

[0132] Pretreatment experiment comparison results:

[0133] In order to comprehensively evaluate the performance of the Agent-SwinPyramidNet model of the present invention in the abnormal audio detection task, the following two groups of comparative experiments were carried out respectively; first, in order to verify the effectiveness of the AMTCF-VMD preprocessing method in audio processing performance, the performance of six preprocessing methods including original audio, wavelet transform, wavelet packet decomposition, BiLSTM, EMD, and AMTCF-VMD were comprehensively compared. The preprocessing performance comparison experiment chart is shown in Table 2. Highest-Acc is the highest accuracy of the Agent-SwinPyramidNet model in the preprocessed dataset.

[0134] Table 2 Pretreatment effect comparison table

[0135]

[0136] From the experimental results, it can be seen that the AMTCF-VMD method has shown excellent performance in all indicators. Especially in terms of SNR, AMTCF-VMD reached 30.816, which is much higher than other methods. At the same time, MSE and MAE are only 0.005 and 0.013. Compared with other methods, the reconstructed signal is closest to the original audio; it can be seen that AMTCF-VMD can extract and retain the characteristics of speech signals more effectively than other preprocessing methods while suppressing noise components; secondly, AMTCF-VMD also achieved the best result of 0.987 on Highest-Acc, which is more than 10% higher than traditional methods such as original audio and wavelet transform. This shows that this method provides high-quality input features for the Agent-SwinPyramidNet model, thereby greatly improving the enhancement performance of the model; in order to more intuitively show the performance differences of various preprocessing methods, the following plots are drawn. Fig.10 The mel-spectrogram comparison of various preprocessing methods is shown in the figure. Fig. 9 (a)-(f) are original audio, wavelet transform, wavelet packet decomposition, BiLSTM, EMD and AMTCF-VMD, respectively.

[0137] The comparison of Mel-spectrograms further confirms the above conclusions. AMTCF-VMD performs particularly well in retaining speech signal details and suppressing noise. The processed audio signal has a clear spectrum, and key features such as harmonics are well preserved and extracted. At the same time, the noise component is almost completely suppressed, leaving only some subtle noise traces. Compared with other preprocessing methods, the spectrograms have different degrees of feature distortion and noise residue, the speech features are severely damaged or masked, and the noise component is not effectively suppressed. In general, the AMTCF-VMD preprocessing method provides high-quality signal input for audio data enhancement and abnormal audio classification detection with its excellent noise suppression and feature retention capabilities.

[0138] In order to fully verify the generalization ability of the model, the environmental audio datasets ESC-50, SCV2 and the self-constructed abnormal audio fusion dataset are used as examples to compare the latest image and audio detection models. The comparison results are shown in Table 3 below:

[0139] Table 3 Model accuracy comparison experiment

[0140]

[0141] The results in Table 3 show that single image detection models such as ViT and Swin Transformer are not very effective in detecting abnormal audio. Compared with Swin-T, Swin-S has a significantly increased number of parameters but has little improvement in accuracy. The EffcientNet network has a shallow depth and a small receptive field, which limits its diagnostic accuracy. The ResNet model requires a large amount of data for pre-training, and has many parameters to be trained, resulting in insufficient generalization ability and diagnostic accuracy. Although the accuracy of audio detection models such as AST has increased significantly, the large number of model parameters limits its deployment capabilities in industrial environments. In contrast, Agent-SwinPyramidNet shows excellent performance on all three datasets when the number of parameters is approximately the same compared to the Swin Transformer model, especially on the self-constructed abnormal audio dataset, where it achieves an accuracy of 98.7%, which is significantly higher than other models and can accurately classify and detect abnormal audio.

[0142] Ablation experiment:

[0143] Preprocessing ablation experiment,In order to verify the effectiveness and accuracy of the AMTCF-VMD decomposition effect, ablation iteration experiments were carried out on different decomposition layers K and penalty factors α. The ablation experiment of the decomposition layer K is as follows. Fig.11 , Fig.11 This is the K-scale ablation effect diagram.

[0144] Depend on Fig.11 It can be seen that when the number of decomposition layers is small, K = [2,3], although the signal is preliminarily decomposed, the preprocessing effect is not obvious. The signal in the range of [2000,4000] Hz is discarded, and some possible low-frequency abnormal signals are ignored. When the number of decomposition layers is high, K = [5,9], some irrelevant noise and aliasing appear in the signal in the range of [6000,10000] Hz, affecting the recognition accuracy of high-frequency abnormal signals. When K = 4, both low-frequency and high-frequency signals are fully decomposed and reconstructed. At the same time, the decomposition rate is faster than that when K = 9, which can provide more efficient support for the classification and detection of pipeline abnormal signals.

[0145] Based on the ablation experiment results of the decomposition layer number K, we choose to conduct an ablation experiment with the penalty factor α when K=4, as follows Fig.12 The figure shows the ablation effect of α value.

[0146] Depend on Fig.12 It can be seen that when the penalty factor α = [1,1500], although some preprocessing was performed on the intermediate frequency signal of [4000,8000] Hz, the effect was not significant enough; when α = [3000,4000], the intermediate frequency signal of [4000,8000] Hz reconstructed some irrelevant noise affecting the detection and classification accuracy; and when α = [2000,3000], the audio signal around α = 2500 not only avoided the over-decomposition problem within [4000,8000] Hz, but also effectively achieved prominent decomposition of the high-frequency abnormal signal of [10000,12000] Hz, providing a strong guarantee for the recognition and classification of abnormal signals; in summary, when the decomposition layer number K = 4 and the penalty factor α = about 2500, AMTCF-VMD has the best preprocessing effect on pipeline abnormal signals.

[0147] Model ablation experiment:

[0148] In order to further verify the accuracy and effectiveness of the Agent SwinPyramidNet model, SwinTransformer was used as the baseline model, and a module-level ablation experiment was performed with the CNN, ASHPA, and AgentAttention modules to evaluate the contribution of each module to the performance. The performance of different models in the abnormal audio recognition and classification task is shown in Table 4.

[0149] Table 4 Ablation experiment

[0150]

[0151] Based on the performance of the baseline model Swin-Transformer in Acc, Precision, Recall, F1-Score and Top-5, it can be seen that: first, after Swin Transformer is integrated with the CNN network, the Acc, Precision, Recall and Mcc are improved by 4.64%, 7.67%, 7.97% and 5.13% respectively. The model can more effectively capture the global dependencies of audio signals and improve the representation ability of the model; then, the Agentattenion mechanism is introduced separately on the basis of CNN integration, and the overall performance of the model is slightly improved, but not significantly. Thirdly, after the ASHPA module is integrated separately, it surpasses the single SwinTransformer in all evaluation indicators, especially in Precision and Recall, which are improved by 8.33% and 9.38% respectively. Finally, the Swin-Transformer, CNN, ASHPA and Agent attenion are further combined to successfully improve the Acc and Mcc of the model to 98.74% and 98.6%, and the Top-5 is 1, which is significantly better than other models.

[0152] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.

Claims

1. The oil and gas pipeline anomaly detection method based on AVMMD and ASPN is characterized by: The following steps are involved: Step 1: Collect abnormal audio signals from oil and gas pipelines and pre-process the abnormal audio signals; Step 2: Integrate SwinTransformer and CNN network as the feature extraction layer of the ASPN model to capture the global and local information in the audio Mel spectrum image; introduce AgentAttention to aggregate global information and reduce computational complexity; integrate ASPP and PSA modules in the CNN network to integrate local and non-local feature information, capture spatial context and perform feature aggregation.

2. The oil and gas pipeline anomaly detection method based on AVMMD and ASPN according to claim 1 is characterized in that: The preprocessing includes: using the AVMMD method to solve the optimal solution of the constrained variational equation to decompose the abnormal signal into the sum of the inherent eigenmode components of different bandwidths.

3. The oil and gas pipeline anomaly detection method based on AVMMD and ASPN according to claim 2 is characterized in that: The AMVMD method includes: Step 11: Set T1 = β * cf_max IMF 、T2=γ*cf_max IMF 、T3=δ*cf_max IMF , β, γ, δ are the thresholds of the center frequency aliasing quotient, cf_max IMF is the maximum value of the center frequency of the IMF component; Step 12: within the maximum value range of the penalty factor α and the number of decomposition layers K, decompose the abnormal audio signal into IMF components, and calculate the envelope signal and center frequency value of the IMF; Step 13: Calculate the center frequency aliasing quotient P K , and for P K To impose restraints; Step 14: P K Compare with T1, T2, and T3 cyclically to determine the optimal K value under the current α value, and calculate the fuzzy entropy FE to determine the optimal combination of α and K values.

4. The oil and gas pipeline anomaly detection method based on AVMMD and ASPN according to claim 1 is characterized in that: Step 2 includes: Convert audio samples into time-frequency domain Mel-spectrograms; Input the Mel-spectrogram into the Patch-Partition layer to divide it into Audio Patch Tokens; Use the Patch-Partition layer to flatten the Audio Patch Tokens and aggregate the Token sequences of different frequencies at the same time; In the Patch Embedding layer, the window of the feature layer is mapped to dimension D, and the Token sequence is reshaped into the original 2D feature map.

5. The oil and gas pipeline anomaly detection method based on AVMMD and ASPN according to claim 4 is characterized in that: Step 2 also includes: fusing Swin Transformer is to embed AgentAttention in SwinTransformerblock in group1 to group3 of SwinTransformer.

6. The oil and gas pipeline anomaly detection method based on AVMMD and ASPN according to claim 5 is characterized in that: Fusion SwinTransformer includes: Use the Patch-Merging layer to merge adjacent Token sequences into feature maps Through the linear layer, the feature map Reduced to feature map Perform alternating compression of the stacked structure to obtain the feature map 7. The oil and gas pipeline anomaly detection method based on AVMMD and ASPN according to claim 1 is characterized in that: The ASPP and PSA modules are integrated into the CNN network to integrate local and non-local feature information, capture spatial context and perform feature aggregation, including: Build an HPC network, which includes 2D CNN and ASHPA modules. 2D CNN is used to integrate the frequency band semantic information of Group4 of Swin Transformer, local features of time and frequency are modeled through convolution kernels, and the feature map output by Group4 is projected onto the event category; The multi-scale context information is captured through the ASHPA module, and the feature map is globally averaged and pooled, and the average is calculated along the time axis to generate a 1×C vector, which is input into the fully connected layer to obtain the event score.

8. The oil and gas pipeline anomaly detection method based on AVMMD and ASPN according to claim 7 is characterized in that: The ASHPA module includes the ASPP module and the PSA module. The ASPP module consists of dilated convolutions with parallel dilation rates of (6, 12, 18) and global average pooling.

9. The oil and gas pipeline anomaly detection system based on AMVMD and ASPN is characterized by: include: a memory for storing instructions executable by a processor; A processor, configured to execute instructions to implement the oil and gas pipeline anomaly detection method based on AVMMD and ASPN as described in any one of claims 1 to 8.

10. A computer readable medium storing computer program code, characterized in that: When the computer program code is executed by a processor, the computer program code implements the oil and gas pipeline anomaly detection method based on AVMMD and ASPN as described in any one of claims 1 to 8.

Citation Information

Cited By

  • Natural gas pipeline anomaly detection method based on DN-A and MFF

    CN120015054A

  • Internet of Things network abnormal flow monitoring method and system

    CN120415920A

  • Heating pipeline damage detection method and system based on ultrasonic technology

    CN120577412A

  • Internal arteriovenous fistula blood flow sound signal processing method and electronic equipment

    CN120748457A

  • Processing method of arteriovenous fistula blood flow sound signal and electronic equipment

    CN120748457B