Audio anomaly detection method based on dual data representation of generative adversarial network
By using the dual data representation method of generative adversarial networks, the problems of scarcity of abnormal data and over-generalization of models in natural gas pipeline audio anomaly detection are solved, and more efficient anomaly detection effect is achieved, especially in natural gas pipeline audio anomaly detection.
Patent Information
- Application Number
- CN202510059614.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-01-15
AI Technical Summary
Existing natural gas pipeline audio anomaly detection methods based on generative adversarial networks suffer from the problems of scarce abnormal data and high data annotation costs in actual industrial scenarios, which leads to over-generalization of the model and inability to focus on the semantic features of normal data, affecting the detection effect.
A dual data representation method based on generative adversarial networks is adopted. An anomaly detection model is constructed through the generator and discriminator to decouple anomaly detection. An improved latent representation consistency loss is introduced to ensure the independence of the latent representation and the encoding of semantic features. The improved latent representation consistency loss is used to prevent information leakage.
It improves the stability and generalization of anomaly detection, can effectively distinguish normal and abnormal data, reduces the over-generalization of the model, and improves the accuracy and robustness of detection.
Smart Images

Figure CN119993201B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of audio anomaly detection, and particularly relates to a natural gas pipeline audio anomaly detection method based on a generative adversarial network double data representation. BACKGROUND
[0002] As the artery of energy transportation, the safe and stable operation of oil and gas pipelines is of great importance, therefore, real-time anomaly detection of the pipeline is needed. Among numerous anomaly detection technologies, the acoustic method is usually the preferred method for natural gas pipeline anomaly detection due to its fast response time, high positioning accuracy and low cost.
[0003] From the perspective of adaptive learning, Lu Jingyi et al. proposed a pipeline detection model based on integrated 1D-CNN-VAPSOSVM, which adaptively extracts features by studying one-dimensional convolution of different depths. Yao Lizhong et al. proposed a pipeline anomaly detection model integrating acoustic feature processing technology and feature reconstruction, which introduces a feature encoder (FAE) in the one-dimensional convolution network to extract effective fault features while reconstructing local spatial features. The existing pipeline audio anomaly detection methods combining deep learning mostly assume that abnormal samples are sufficient, environmental noise is simple, and working conditions are single; however, in actual industrial scenarios, due to the smooth operation of the pipeline and the large amount of monitoring data, the abnormal data is scarce and the data labeling cost is high, which will affect the effectiveness of acoustic detection. Therefore, anomaly detection of natural gas pipelines based on one-class data has become a research hotspot.
[0004] At present, one-class data-based anomaly detection mainly focuses on reconstruction-oriented models, relying on encoders or generative adversarial networks with outstanding reconstruction capabilities. Reconstruction-based methods have been proven to perform well in a wide range of anomaly detection tasks and have provided competitive results in natural gas pipeline audio anomaly detection. Gu Xiaohua et al. proposed an unsupervised adversarial domain adaptation method based on adversarial domain adaptation and one-class SVM, which aligns the source domain and target domain data in an unsupervised manner through an adversarial learning strategy to detect abnormal sounds in industrial scenarios under complex working conditions. Li Jiliang et al. proposed a generative adversarial network with multiple attention enhanced discriminators, which integrates multiple dimensional attention mechanisms into the discriminator to highlight the abnormal feature area in the mechanical working audio spectrum, thereby enhancing its ability to distinguish between test samples and reconstructed samples. However, the existing learning objectives for training reconstruction models usually focus on low-level pixel comparisons rather than semantic comparisons related to the training data, which leads to potential representations that encode more low-level data features shared between normal data and abnormal data samples rather than more discriminative high-level semantic features.
[0005] Furthermore, when trained on data with rich visual features and complex appearance, the probability of the reconstruction model reconstructing anomaly data with high fidelity increases, making reconstruction-based models less effective at detecting anomalies in such situations. This problem is further exacerbated by the high generalization capabilities of modern generative models, as high-quality reconstruction of anomaly samples can be expected under relaxed assumptions.
[0006] Therefore, the key challenge for anomaly detection methods based on generative adversarial networks is to learn latent representations that can encode important semantics and are insensitive to low-level visual features that are commonly shared by normal and anomaly data. These semantics are crucial for successfully describing normal data, helping to better distinguish normal image samples from anomaly samples and addressing the over-generalization problem commonly seen in reconstruction-based anomaly detection models. Summary of the Invention
[0007] The technical problem to be solved by the present invention is: in order to solve the problems existing in the prior art in the above-mentioned background technology, a natural gas pipeline audio anomaly detection method based on generative adversarial network dual data representation is provided.
[0008] The technical solution adopted by the present invention to solve the technical problem is: a natural gas pipeline audio anomaly detection method based on generative adversarial network dual data representation, comprising the following steps:
[0009] S1. Collect normal and abnormal audio from natural gas pipelines under different operating conditions, pre-process the collected audio to meet the needs of model training, and use the abnormal audio as a test set.
[0010] S2. Use the generator and discriminator to build an anomaly detection model based on the generative adversarial network;
[0011] S3. Decouple anomaly detection to separate pipeline detection-related semantic information from global spectrum information, eliminating interference from irrelevant information.
[0012] S4, introduces an improved latent representation consistency loss to prevent information leakage between latent spaces;
[0013] S5. Use the improved anomaly detection model based on generative adversarial network to detect the natural gas pipeline audio dataset and output the natural gas pipeline audio anomaly detection results.
[0014] Furthermore, the sampling rate of the natural gas pipeline audio collected in step S1 is 16000, and the collected audio is preprocessed as follows:
[0015] S11, dividing the collected audio into 20ms overlapping frames, applying a Hamming window function to each frame, applying a 2048-point short-time Fourier transform to each frame, overlapping each frame by 512 points, and obtaining an overlapping representation of each frame;
[0016] S12, mapping the short-time Fourier transform spectrum to the Mel scale, and using 128 Mel filters to obtain a Mel spectrum map;
[0017] S13. Perform logarithmic transformation on the Mel spectrum in decibels to obtain a logarithmic Mel spectrum graph.
[0018] Furthermore, the anomaly detection model based on the generative adversarial network in step S2 consists of a generator, a discriminator, and an autoencoder E m and a classifier C, the generator is a dual data representation generator, which consists of an encoder E s , encoder E r and decoder D, the encoder E s and encoder E r The architecture is the same and can learn different parameters independently;
[0019] Among them, the encoder E s and encoder E r Each convolutional layer consists of a convolutional layer with a stride of 2, followed by a batch normalization layer and a LeakyReLU activation function with a negative slope of 0.2. The potential representation z is obtained through the dual data representation generator. s and the potential representation z r The decoder D performs decoding by transposed convolution with a stride of 2, each transposed convolution is followed by a batch normalization layer, a ReLU activation function, and the last convolution layer uses a tanh activation function to constrain the boundaries; the discriminator has the same s and encoder E r Same architecture, with the last convolutional layer followed by a Sigmoid activation function; the classifier C is a multi-layer perceptron with 1 hidden layer and 30 hidden units. The size of the input layer is determined by the dimensionality of the potential representation, and the size of the output layer is determined by the number of classes in the training data; the autoencoder E m With encoder E s Same architecture, network parameters and encoder E s same.
[0020] Furthermore, the classifier operation steps of the anomaly detection model based on the generative adversarial network are as follows:
[0021] S21, train the classifier C according to the potential representation z s Predict the correct class label and calculate the value of the latent representation z rmisclassification; the training process controls the information content in the dual latent representation and learns meaningful data features for anomaly detection in the absence of anomalous data examples;
[0022] S22, use the gradient reversal layer to transform the potential representation z r Transform to ensure that the potential representation z r There is no useful semantic information for classification.
[0023] Furthermore, the abnormality detection decoupling in step S3 is specifically performed as follows:
[0024] S31, encoder E s Capture spectral semantic information, which is the key to characterizing normal training data; encoder E r Encode low-level residual features to ensure that the potential representation z s and the potential representation z r Ability to encode mutually independent information;
[0025] S32, using the decoupling process based on classifier C, the semantic information related to normal data is expressed in the potential representation z s and encode irrelevant residual information into the latent representation z r middle.
[0026] Furthermore, the improved latent representation consistency loss in step S4 is when the latent representation z r When the encoder E changes, s and encoder E m Extracting inconsistent semantically relevant information will cause the encoder E s Punishment, specifically:
[0027] S41, using cosine similarity to measure encoder E s and encoder E m The obtained potential representation z s and the potential representation z′ s , focusing on the directions of the two to capture the local linear correlation, their cosine similarity CosSim(z s ,z′ s )The formula is expressed as follows:
[0028]
[0029] Among them, z s ·z′ s It is z s and z′ s The dot product of ||z s ||、||z′ s || are respectively || zs || and ||z′ s ||'s modulus length;
[0030] S42. Improved potential representation consistency loss introduces an improved objective function based on mutual information: first calculate z s and z′ s The joint density function p(z s ,z′ s ), the marginal probability density functions are p(z s ) and p(z′ s ), mutual information I(z s ; z′ s )The formula is expressed as follows:
[0031]
[0032] Then calculate z separately s and z′ s The entropy H(z s ) and H(z′ s ), according to the minimum entropy normalization formula, the mutual information is normalized to [0,1];
[0033] S43. Combining the cosine similarity of step S41 and the objective function based on mutual information improvement of step S42, an improved potential representation consistency loss is obtained, which is expressed as follows:
[0034] L con =-α·NMI(z s ,z′ s )-(1-α)·CosSim(z s ,z′ s ).
[0035] Furthermore, the specific steps of step S5 are: uploading the audio data collected by the microphone collection array installed near the natural gas pipeline to the deep learning processor; the deep learning processor uses the method of step S1 to preprocess the natural gas pipeline audio data and convert the audio into a logarithmic Mel spectrum graph; the preprocessed data is input into the model for detection. If an abnormality occurs in the natural gas pipeline, an alarm signal is issued. During this period, the microphone collection array will continue to collect signals to determine whether the abnormality has been eliminated. If it has been eliminated, the alarm will stop.
[0036] Beneficial effects of the present invention:
[0037] The present invention uses a natural gas pipeline audio anomaly detection model based on a generative adversarial network dual data representation, selectively encodes data without the need for a pre-trained classification model, and solves the problems of over-generalization and inability to focus on semantic features related to the definition of normal data associated with reconstructed anomaly detection models.
[0038] We construct an anomaly detection model based on a generative adversarial network to decouple anomaly detection. This helps the model exclude uninformative features from anomaly detection tasks in a class of learning environments. We separate uninformative data features from semantic features related to normal training data through two latent spaces. This anomaly detection decoupling strategy is also applicable to class classification problems in other fields.
[0039] An improved latent representation consistency loss is introduced to prevent information leakage between latent spaces, ensuring that the effective latent representation does not change even if the uninformative latent representation changes, thereby improving the stability and generalization of anomaly detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The present invention will be further described below with reference to the accompanying drawings and examples.
[0041] Figure 1 This is a step diagram of the natural gas pipeline audio anomaly detection method based on the generative adversarial network dual data representation of the present invention.
[0042] Figure 2 This is a flow chart of the natural gas pipeline audio anomaly detection method based on generative adversarial network dual data representation of the present invention.
[0043] Figure 3 This is a network architecture diagram of the natural gas pipeline audio anomaly detection method based on the generative adversarial network dual data representation of the present invention.
[0044] Figure 4 It is a specific flow chart of the anomaly detection decoupling method in the method of the present invention. DETAILED DESCRIPTION
[0045] The present invention will now be described in further detail with reference to the accompanying drawings, which are simplified schematic diagrams that illustrate the basic structure of the present invention in a schematic manner.
[0046] like Figure 1 and Figure 2 As shown in FIG, a natural gas pipeline audio anomaly detection method based on a generative adversarial network is specifically as follows:
[0047] 1. Collecting audio signals from natural gas pipelines
[0048] Normal and abnormal audio signals of natural gas pipelines under different working conditions are collected. Normal audio is used as training data, and abnormal audio is used as test data. The normal audio signal is denoted as K = {K1, K2, K3, ..., K i …,K n}:K irepresents the i-th type of audio data, each type contains t pieces of audio data, and n represents the total number of collected types; each recording is a single-channel audio with a length of 10s, including pipeline working sound and environmental sound.
[0049] II. Preprocessing of the collected audio signals
[0050] (1) Frame division: divide the audio into 20ms overlapping frames, and apply a Hamming window function to each frame; (2) apply a 2048-point short-time Fourier transform to each frame, with an overlap of 512 points per frame, to obtain an overlapping representation of each frame; map the short-time Fourier transform spectrum to the Mel scale, and use 128 Mel filters to obtain a Mel spectrum diagram; (3) perform logarithmic transformation on the Mel spectrum in decibels to obtain a logarithmic Mel spectrum diagram; select j types of normal spectrum from the logarithmic Mel spectrum diagram obtained by preprocessing as training data, and the remaining normal spectrum and abnormal spectrum as mixed type test data, where j < n.
[0051] III. Construction of an abnormality detection network model using a generator and a discriminator, with a network architecture as shown in Figure 3 .
[0052] The abnormality detection model based on a generative adversarial network is composed of a generator, a discriminator, an autoencoder E m , and a classifier C. The generator is a dual-data representation generator, which is composed of an encoder E s , an encoder E r , and a decoder D. The encoders E s and E r have the same architecture and can independently learn different parameters.
[0053] The encoders E s and E r are both composed of convolutional layers with a step size of 2, each followed by a batch normalization layer and a LeakyReLU activation function with a negative slope of 0.2. The latent representations z s and z r are obtained through the dual-data representation generator. The decoder D performs decoding through transpose convolution with a step size of 2, each followed by a batch normalization layer, a ReLU activation function, and the last convolutional layer using a tanh activation function to limit the boundary. The classifier C is a multilayer perceptron with 1 hidden layer and 30 hidden units, the size of the input layer is determined by the dimension of the latent representation, and the size of the output layer is determined by the number of classes of the training data; the autoencoder E m has the same architecture as the encoder E s , and the network parameters are the same as those of the encoder E s s. The discriminator has the same architecture as the encoders E rThe same architecture, the last convolutional layer is followed by a Sigmoid activation function.
[0054] 4. Model training:
[0055] (a) Generator training: The generator part consists of the encoder E s and encoder E r , decoder D e , classifier C, encoder E s The input spectrum x∈R W×H×C Mapped to semantically relevant latent representation z s , encoder E r Map the input spectrum x to the dual residual representation z r , the formula is as follows:
[0056] z s =E s (x) (1),
[0057] z r =E r (x) (2),
[0058] The complete latent representation of the input spectrum x is computed as the concatenation of the two partial representations, i.e. and passed to the decoder D e Reconstruction is performed, and the formula is expressed as follows:
[0059]
[0060] in, To reconstruct the spectrum; to ensure that all image content in the input spectrum x is captured by the concatenated representation z, the standard L1 reconstruction loss is used when learning the parameters of the autoencoder, which is expressed as follows:
[0061]
[0062] (b) Discriminator training: Discriminator D s It consists of an encoder that encodes the input through 5 convolutions, batch normalization, and LeakyReLU activation function, and finally uses the Softmax activation function to distinguish the input spectrum from the reconstructed spectrum; the potential representation z s and z r The expressive power of the model depends largely on the fidelity of image reconstruction; in order to improve the fidelity and ensure that the reconstructed samples follow the distribution of normal training data, an adversarial loss L is used during the training of the model. adv The encoder weights are updated based on the following feature matching objective to reduce training instability and avoid GAN overtraining, as expressed in the following formula:
[0063]
[0064] Where f(·) is D s The activation of the last convolutional layer; in addition, the discriminator distinguishes between real and fake spectra by optimizing the standard binary cross entropy loss, which is expressed as follows:
[0065]
[0066] Anomaly detection decoupling methods such as Figure 4 As shown, the latent representation z is forced by the decoupling process of the classifier C s and z r Encode mutually exclusive information and maximize z using cross entropy loss s The classification performance is expressed as follows:
[0067]
[0068] Where y∈R n is the one-hot encoded ground truth label of the input spectrum x, is the classifier prediction; the classifier C learns to accurately represent the semantically relevant latent representation z s Classification; during the back propagation process, the gradient of the classification loss passes through the corresponding (semantically related) encoder E s Propagation, encoder E s Update to produce a more semantically relevant and accurate latent representation z s ; Potential representation z s Provide more information to the classifier.
[0069] L s The minimization process will promote the potential representation z s Provide more information about normal data classification, so that z r To achieve the opposite effect, use the gradient reversal layer R to represent the dual residual z r Transformation; the gradient reversal layer R acts as the identity function in the forward propagation of the model, that is, R(z r )=z r , but the gradients of subsequent layers are reversed during backpropagation, which is expressed as follows:
[0070]
[0071] Among them, λ R is a hyperparameter, I∈R d×d is the identity matrix, d is the potential representation z s and the dual residual represents z r During training, the encoder E rGenerate a latent representation that is uninformative to the classifier C, and achieve z through the following objectives r The minimization of the relevant information content in is expressed as follows:
[0072]
[0073] in,
[0074] Formulas (10) and (12) provide a first level of decoupling, but they do not completely prevent the potential representation z s and the dual residual represents z r Information leakage between them; introducing improved latent representation consistency loss, if the encoder E s and encoder E m If the semantically relevant latent representations extracted from s and encoder E m Punishment.
[0075] First, randomly shuffle the latent representation z of a given training batch r To ensure that each potential representation z s With the randomly selected z' r Concatenate; pass the concatenated potential representation to the decoder D e , decoder D e Generate hybrid reconstructed image Make Next, the reconstructed image is input to the encoder E m , extracting latent representation should be the same as the z originally used to generate the hybrid reconstructed image s Equal; using improved latent representation consistency loss penalty z s and The difference between them is expressed as follows:
[0076]
[0077] Among them, α is the weight parameter;
[0078] Cosine similarity is used to measure the encoder E s and the autoencoder E m The obtained potential representation z s and It focuses on the direction of the two rather than their size, so it can well capture the similarity between the two without being affected by the length, capturing the local linear correlation, and their cosine similarity The formula is as follows:
[0079]
[0080] in, It is z s and The dot product of ||z s ||、 They are ||z s || and The mold length.
[0081] Calculate z s and The joint density function of The marginal probability density functions are p(z s )and Mutual Information The formula is as follows:
[0082]
[0083] Normalization is used to map the mutual information values to a fixed range to enhance the comparability and scale consistency of different indicators. s and The entropy H(z s )and The formula is as follows:
[0084]
[0085] Where P(Z=z s ) is the potential representation to get the potential representation z s The mutual information is normalized to [0,1], and the formula is expressed as follows:
[0086]
[0087] When training the generator, the network weights of the discriminator are fixed, and the discriminator is made to identify the reconstructed spectrum as the real spectrum as much as possible to achieve the purpose of deceiving the discriminator. First, the loss terms of formula (7), formula (8), formula (10), formula (12) and formula (13) are calculated, and the combined objective function L is used to calculate the loss terms of formula (7), formula (8), formula (10), formula (12) and formula (13). G Update the weight of the generator. The formula is as follows:
[0088] L G =λ1L rec +λ2L adv +λ3L s +λ4L con (15),
[0089] Among them, λ1, λ2, λ3, and λ4 are weight parameters.
[0090] When training the discriminator, the network weights of the generator are fixed, and formulas (7) and (9) are calculated according to the combined objective function L D To update, the formula is as follows:
[0091] L D =λ1L rec +λ6L bce (16),
[0092] Among them, λ1 and λ6 are weight parameters; during training, the generator and discriminator are updated alternately for a fixed number of rounds.
[0093] The experiment is implemented based on Python 3.7, PyTorch 1.5, and CUDA 10.2. The hardware used is Intel Core i7-8700K CPU and NVIDIA GeForce RTX 2080Ti GPU. The Adam optimizer is used to minimize Equations (18) and (19). The learning rate of the Adam optimizer is lr = 0.0002, the momentum β1 = 0.5, and the momentum β2 = 0.999. In the experiment, λ1 = λ5 = 50, λ2 = λ3 = λ4 = λ6 = 1; the weight of the gradient reversal layer R is initialized to λ R =0, and then gradually updated as the training progresses; the training data of the simulated natural gas pipeline audio dataset is loaded into the improved generative adversarial anomaly detection network for training, and the model with the best effect is saved.
[0094] 5. Construct anomaly score indicator: input the detection sample into the generator to calculate the potential representation z s =E s (x), which is then fed into the classifier; the activation value of the classifier output layer is then Normalize it to satisfy the probability form, that is, The anomaly score formula is as follows:
[0095] s=1-p i (x) (17),
[0096] The normalization process generates anomaly scores s∈[0,1], where 0 represents ideal normal data; calculating the anomaly score only requires the encoder E s and classifier C, which significantly shortens the inference time.
[0097] Six, deploy training optimal model natural gas pipeline anomaly detection: the microphone array installed near the natural gas pipeline collects audio data uploaded to the deep learning processor, the processor first uses the above method to preprocess the natural gas pipeline audio data, converts the audio to a log mel spectrogram; the preprocessed data is input into the model for detection, if the natural gas pipeline appears abnormal, the abnormal score obtained exceeds the threshold, an alarm signal is sent, and the microphone array will continue to collect signals to determine whether the anomaly has been eliminated, if it has been eliminated, the alarm will be stopped.
[0098] In order to evaluate the effectiveness of the above method for natural gas pipeline audio anomaly detection, the area under the ROC curve (AUC), the area under the partial ROC curve (pAUC), the accuracy (Accuracy), and the F1 score (F1 score) are used to measure the effectiveness of the above method; the verification results are as follows:
[0099] Table 1 simulated natural gas pipeline audio data set experiment
[0100]
[0101] Table 2 DCASE Challenge 2023 Task2 data set experiment
[0102]
[0103] In Table 1, AnoGAN is an anomaly detection algorithm based on generative adversarial networks (GAN); EfficientGAN is a method designed to improve the training efficiency and stability of generative adversarial networks (GAN); AEGAN (Auto-Encoder Generative Adversarial Networks) is a model that combines autoencoders and generative adversarial networks (GAN); MeSkipGANomaly is an improved model based on Skip-GANomaly for anomaly detection tasks. Skip-GANomaly itself is a model that combines autoencoders and generative adversarial networks (GAN), which introduces skip connections to better capture the multi-scale distribution of normal data. MeSkipGANomaly further optimizes and improves on this basis to improve the performance and efficiency of the model.
[0104] In Table 2, AE-GAN-AD is an unsupervised method for machine audio anomaly detection that combines the advantages of autoencoders and generative adversarial networks (GANs). The core of this method is to reconstruct the input spectrogram through a generator (also an autoencoder) and use a discriminator to assist the generator in improving performance during the training and detection stages. Fujimura et al. proposed a new method for anomaly detection that combines a ResNeXt neural network, an improved loss function SCAdaCos, and a Gaussian mixture model (GMM) for anomaly judgment. Kevin Wilkinghoff proposed a method based on subclustering AdaCos for abnormal sound detection under domain shift conditions.
[0105] It can be seen from Table 1 and Table 2 that the overall anomaly detection effect of the model in this embodiment is better than the existing method.
[0106] With the above-described preferred embodiments of the present invention as a guide, and with reference to the above description, relevant personnel are fully capable of making various changes and modifications without departing from the technical scope of this invention. The technical scope of this invention is not limited to the contents of the specification and must be determined according to the scope of the claims.
Claims
1. A natural gas pipeline audio anomaly detection method based on generative adversarial network dual data representation, characterized in that: The steps include: S1. Collect normal and abnormal audio from natural gas pipelines under different operating conditions, preprocess the collected audio to meet the needs of model training, and use the abnormal audio as a test set. S2. Use the generator and discriminator to build an anomaly detection model based on the generative adversarial network; S3. Decouple anomaly detection to separate pipeline detection-related semantic information from global spectrum information, eliminating interference from irrelevant information. S4, introduces an improved latent representation consistency loss to prevent information leakage between latent spaces; S5. Use the improved anomaly detection model based on generative adversarial network to detect the natural gas pipeline audio dataset and output the natural gas pipeline audio anomaly detection results; The anomaly detection model based on the generative adversarial network in step S2 consists of a generator, a discriminator, and an autoencoder. and a classifier C The generator is a dual data representation generator, which consists of an encoder , encoder and decoder D, the encoder and encoder The architecture is the same and can learn different parameters independently; Among them, the encoder and encoder Each convolutional layer consists of a convolutional layer with a stride of 2, followed by a batch normalization layer and a LeakyReLU activation function with a negative slope of 0.
2. The potential representation is obtained through a dual data representation generator. and potential representation The decoder D performs decoding by transposed convolution with a stride of 2, each transposed convolution is followed by a batch normalization layer, a ReLU activation function, and the last convolution layer uses a tanh activation function to limit the boundaries; the discriminator has the same and encoder Same architecture, with the last convolutional layer followed by a Sigmoid activation function; classifier C It is a multi-layer perceptron with 1 hidden layer and 30 hidden units. The size of the input layer is determined by the dimensionality of the potential representation, and the size of the output layer is determined by the number of classes of the training data. With encoder Same architecture, network parameters and encoder same; The specific steps of running the classifier of the anomaly detection model based on the generative adversarial network are as follows: S21. Training classifier C According to the potential Predict the correct class label and use the latent representation misclassification; the training process controls the information content in the dual latent representation and learns meaningful data features for anomaly detection in the absence of anomalous data examples; S22, using gradient reversal layer to represent potential Transform to ensure the potential representation There is no useful semantic information for classification; The abnormality detection decoupling in step S3 is specifically performed as follows: S31, encoder Capturing spectral semantic information, which is key to characterizing normal training data; encoder Encoding low-level residual features to ensure latent representation and potential representation Ability to encode mutually independent information; S32, using classifier based C The decoupling process of normal data related semantic information is expressed in the potential and irrelevant residual information is forced to be encoded into the latent representation middle; The improved latent representation consistency loss in step S4 is when the latent representation When the encoder changes and encoder Extracting inconsistent semantically relevant information will cause the encoder to Punishment, specifically: S41, using cosine similarity to measure encoder and encoder The potential representation obtained and potential representation , focusing on the directions of the two to capture the local linear correlation, their cosine similarity The formula is as follows: , in, yes and The dot product of 、 They are and Length of the module; S42. Improved potential representation consistency loss introduces an improved objective function based on mutual information: first calculate and The joint density function of , the marginal probability density functions are and , mutual information The formula is as follows: , Then calculate separately and Entropy and , according to the minimum entropy normalization formula, normalize the mutual information to [0,1]; S43. Combining the cosine similarity of step S41 and the objective function based on mutual information improvement of step S42, an improved potential representation consistency loss is obtained, which is expressed as follows: , in, α is the weight parameter.
2. The natural gas pipeline audio anomaly detection method based on generative adversarial network dual data representation according to claim 1 is characterized by: The sampling rate of the natural gas pipeline audio collected in step S1 is 16000, and the collected audio is preprocessed as follows: S11, dividing the collected audio into 20ms overlapping frames, applying a Hamming window function to each frame, applying a 2048-point short-time Fourier transform to each frame, overlapping each frame by 512 points, and obtaining an overlapping representation of each frame; S12, mapping the short-time Fourier transform spectrum to the Mel scale, and using 128 Mel filters to obtain a Mel spectrum map; S13. Perform logarithmic transformation on the Mel spectrum in decibels to obtain a logarithmic Mel spectrum graph.
3. The natural gas pipeline audio anomaly detection method based on generative adversarial network dual data representation according to claim 2 is characterized by: The specific steps of step S5 are: uploading the audio data collected by the microphone collection array installed near the natural gas pipeline to the deep learning processor; the deep learning processor uses the method of step S1 to pre-process the natural gas pipeline audio data and convert the audio into a logarithmic Mel-spectrogram; The pre-processed data is input into the model for detection. If an abnormality occurs in the natural gas pipeline, an alarm signal is issued. During this period, the microphone acquisition array will continue to collect signals to determine whether the abnormality has been eliminated. If it has been eliminated, the alarm will stop.
Citation Information
Patent Citations
Audio abnormality detection method based on confrontation network generation
CN109461458A
Railway signal infrastructure data management method and system
CN119046409A