Intelligent anomaly detection method and system based on convolutional flow adversarial network
By constructing a convolutional flow adversarial network model and combining it with maximum likelihood estimation and progressive adversarial training, the problems of insufficient feature extraction accuracy and model stability in mechanical equipment anomaly detection are solved, and accurate detection of early faults and visual diagnosis of fault evolution are achieved.
Patent Information
- Application Number
- CN202511068209.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-07-31
AI Technical Summary
In the detection of mechanical equipment anomalies, existing technologies have problems such as insufficient feature extraction accuracy, poor model stability, missing probability benchmarks, and weak early anomaly capture capabilities. In particular, it is difficult to achieve accurate fault detection in scenarios where abnormal samples are missing.
An intelligent anomaly detection method based on convolutional flow adversarial network is adopted. By constructing a convolutional flow adversarial network model composed of a generator and a discriminator, combining the maximum likelihood estimation loss function and progressive adversarial training, and utilizing the generator's detail generation ability and the reversibility of the flow model, an anomaly detection indicator with a weighted MLE error and reconstruction error is constructed to achieve accurate capture of early anomalies.
It improves the stability of the model and the accuracy of feature extraction, can sensitively capture weak abnormal signals at an early stage, provide an explainable probability benchmark, and achieve earlier and more accurate fault warning and quantitative tracking of the fault evolution process.
Smart Images

Figure CN120561836B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of anomaly detection technology, and in particular to an intelligent anomaly detection method and system based on a convolutional flow adversarial network. Background Art
[0002] In the field of intelligent anomaly detection for mechanical equipment, the long-standing problem of missing abnormal samples poses a significant challenge to traditional machine learning methods that rely on abnormal samples for model training. Therefore, building anomaly detection metrics based on the characteristics of normal samples by learning the data probability density distribution of normal samples has become a key approach to achieving accurate detection in this scenario.
[0003] Early anomaly detection methods primarily relied on manual feature extraction and unsupervised machine learning algorithms, such as principal component analysis, independent component analysis, and first-class support vector machines. These methods modeled normal data and used reconstruction error or distance metrics as anomaly indicators. However, due to limitations in feature expression, they performed poorly on vibration data monitored in complex environments.
[0004] With the rise of deep learning, deep unsupervised diagnostic frameworks based on autoencoders or variational autoencoders have emerged. These frameworks leverage unsupervised learning to automatically extract high-order nonlinear features from raw time-domain or time-frequency maps and detect anomalies using reconstruction losses or potential distribution deviation metrics. However, autoencoders are susceptible to noise during the learning process and tend to capture general features, making it difficult to accurately capture key features, which affects detection accuracy.
[0005] Generative adversarial networks (GANs) have been introduced to the field of normal sample diagnosis due to their powerful distributional learning capabilities. They use a generator to learn the characteristic distribution of normal samples, forming an adversarial mechanism with the discriminator to improve feature extraction. However, due to the limitations of the network structure, model training stability is poor, and the generated samples suffer from randomness due to their reliance on random latent vectors. While some researchers have combined GANs with other generative models (such as autoencoder GANs) to improve performance, the reliance on adversarial mechanisms still carries the risk of mode collapse.
[0006] The flow model can fully learn the probability density distribution of samples by virtue of its reversible mapping and precise likelihood estimation characteristics, but its generation effect tends to be smooth and lacks the sharpness of details of the generative adversarial network. At the same time, it has the problems of large number of model parameters and slow inference speed.
[0007] Currently, in scenarios where abnormal samples are missing, mainstream anomaly detection models based on autoencoders or generative adversarial networks still have obvious shortcomings: first, autoencoders have weak network constraints, are easily affected by noise, and have difficulty capturing key features. Generative adversarial networks, on the other hand, have the risk of mode collapse due to their reliance on adversarial training. Second, existing models only focus on reconstruction errors and cannot provide the probabilistic meaning of samples, making it difficult to establish a strict health status probability benchmark. Third, for early faults, since they are often masked by noise or normal vibrations, existing models find it difficult to effectively capture the occurrence of early anomalies and cannot accurately describe the evolution of faults. Summary of the Invention
[0008] To this end, an embodiment of the present invention provides an intelligent anomaly detection method and system based on a convolutional flow adversarial network, which is used to solve the problems faced by the existing technology in mechanical equipment anomaly detection in scenarios where abnormal samples are missing, such as insufficient feature extraction accuracy, poor model stability, missing probability benchmarks, and weak early anomaly capture capabilities.
[0009] To solve the above problems, an embodiment of the present invention provides an intelligent anomaly detection method based on a convolutional flow adversarial network, which includes:
[0010] Collect the mechanical time-domain vibration signals of the equipment throughout its life cycle, intercept samples of uniform length, perform short-time Fourier transform on them to obtain a time-frequency diagram, and divide the time-frequency diagram into a normal sample training set containing only normal operating data of the equipment and a full-cycle test set containing data from the entire life cycle of the equipment;
[0011] Construct a convolutional adversarial network model, which consists of a generator and a discriminator, where:
[0012] The generator adopts a convolutional flow network composed of M layers of blocks, each layer of blocks includes a compression layer, an N layer of flow layer and a separation layer in sequence; the compression layer is used to compress the input feature map size and increase the number of channels; the flow layer is stacked by an actnorm layer, a reversible 1×1 convolution layer and a coupling layer, the actnorm layer performs data-dependent initialization based on the mean and variance of each channel of the first batch of data to achieve zero mean and unit variance normalization, the reversible 1x1 convolution layer performs a linear transformation of the channel dimension on each spatial position of the input, the coupling layer splits the input into two parts, the first part is directly output, and the second part is affine transformed based on the weights and biases obtained after the first part is transformed by a small convolutional network and then output; the separation layer splits the input into two parts according to the channel, one part is used as the input of the next layer of blocks, and the other part is used as an intermediate latent variable; the forward pass of the convolutional flow network of the generator is used for feature extraction, and the reverse pass is used for synthetic sample generation;
[0013] The discriminator includes a convolutional flow network, a global average pooling layer, a fully connected layer, and an activation function layer in sequence; wherein the convolutional flow network of the discriminator adopts the same architecture as that of the generator but only uses forward transmission;
[0014] Inputting the normal sample training set into the convolutional flow adversarial network model, pre-training the generator through a set maximum likelihood estimation loss function, and solidifying the discriminator parameters without optimizing the discriminator;
[0015] The parameters of the de-fixed discriminator are fixed and optimized alternately with the pre-trained generator until the set conditions are met. When the discriminator is updated, the samples in the normal sample training set are used as positive samples and the samples synthesized by the generator are used as negative samples, and the discriminator is optimized using binary cross-entropy loss. When the generator is updated, the generator is optimized using a joint loss. The joint loss is a linear weighted sum of the MLE loss, the adversarial loss, and the reconstruction loss. The weight of the adversarial loss is zero at the beginning of adversarial training, and a step-by-step strategy is used to gradually increase the weight of the adversarial loss to a preset value.
[0016] The trained generator is used as an anomaly detection model, and an anomaly detection indicator based on the weighted MLE error and reconstruction error is constructed;
[0017] The full-cycle test set is input into the abnormal state detection model, and the abnormal state of the sample is identified online according to the abnormal detection index.
[0018] Preferably, the short-time Fourier transform uses a rectangular window function to convert the time domain signal into a time-frequency diagram of uniform size; the normal sample training set uses data from the front end of the mechanical time domain vibration signal of the equipment throughout its life cycle to confirm normal operation.
[0019] Preferably, the compression layer multiplies the number of channels of the input feature map by four, and the length and width dimensions are both reduced to half of the original ones.
[0020] Preferably, the Actnorm layer initialization method is: rearrange and flatten the input data by channel, calculate the mean and variance of each channel, and use them to initialize the scaling and bias parameters of the layer.
[0021] Preferably, the small convolutional network used in the coupling layer includes, in sequence: a 3×3 convolutional layer, a ReLU activation layer, a 1×1 convolutional layer, a ReLU activation layer, and a 3×3 zero-initial convolutional layer.
[0022] Preferably, the alternating optimization is a one-to-one round alternation; the discriminator parameters are fixed when the generator is updated, and the generator parameters are fixed when the discriminator is updated; the reconstruction loss is in the form of mean square error; the optimization process adopts the stochastic gradient descent algorithm, and introduces gradient clipping and learning rate gradual attenuation mechanism.
[0023] Preferably, in the joint loss function, the MLE loss weight, the adversarial loss weight and the reconstruction loss weight are freely adjusted and set according to actual problems.
[0024] Preferably, the method for online identifying the abnormal state of a sample based on the abnormality detection indicator is:
[0025] Calculate the anomaly detection index value of each sample and compare it with the benchmark value calculated based on historical samples. When the index value exceeds the set ratio of the benchmark value, it is determined to be an abnormal state; the benchmark value is the average of the anomaly index values of all historical samples before the current sample.
[0026] Preferably, the anomaly detection index value is:
[0027] ;
[0028] Among them, w1 and w2 are weights that can be freely adjusted according to actual problems.
[0029] An embodiment of the present invention further provides an intelligent anomaly detection system based on a convolutional flow adversarial network. The system is used to implement the above-mentioned intelligent anomaly detection method based on a convolutional flow adversarial network, and specifically includes:
[0030] The data acquisition and preprocessing module is used to collect the mechanical time-domain vibration signals of the equipment throughout its life cycle, intercept samples of uniform length, perform short-time Fourier transform to obtain a time-frequency diagram, and divide the time-frequency diagram into a normal sample training set containing only normal operating data of the equipment and a full-cycle test set containing data from the entire life cycle of the equipment;
[0031] The convolutional adversarial network model construction module is used to construct a convolutional adversarial network model. The convolutional adversarial network model consists of a generator and a discriminator, where:
[0032] The generator adopts a convolutional flow network composed of M layers of blocks, each layer of blocks includes a compression layer, an N layer of flow layer and a separation layer in sequence; the compression layer is used to compress the input feature map size and increase the number of channels; the flow layer is stacked by an actnorm layer, a reversible 1×1 convolution layer and a coupling layer, the actnorm layer performs data-dependent initialization based on the mean and variance of each channel of the first batch of data to achieve zero mean and unit variance normalization, the reversible 1x1 convolution layer performs a linear transformation of the channel dimension on each spatial position of the input, the coupling layer splits the input into two parts, the first part is directly output, and the second part is affine transformed based on the weights and biases obtained after the first part is transformed by a small convolutional network and then output; the separation layer splits the input into two parts according to the channel, one part is used as the input of the next layer of blocks, and the other part is used as an intermediate latent variable; the forward pass of the convolutional flow network of the generator is used for feature extraction, and the reverse pass is used for synthetic sample generation;
[0033] The discriminator includes a convolutional flow network, a global average pooling layer, a fully connected layer, and an activation function layer in sequence; wherein the convolutional flow network of the discriminator adopts the same architecture as that of the generator but only uses forward transmission;
[0034] A model pre-training module is used to input the normal sample training set into the convolutional flow adversarial network model, pre-train the generator through a set maximum likelihood estimation loss function, and solidify the discriminator parameters without optimizing the discriminator;
[0035] The model adversarial training module is used to fix the discriminator parameters and alternately optimize them with the pre-trained generator until the set conditions are met. When the discriminator is updated, the samples in the normal sample training set are used as positive samples and the samples synthesized by the generator are used as negative samples, and the discriminator is optimized using binary cross-entropy loss. When the generator is updated, the generator is optimized using a joint loss. The joint loss is a linear weighted sum of the MLE loss, the adversarial loss, and the reconstruction loss. The weight of the adversarial loss is zero at the beginning of adversarial training, and a step-by-step strategy is used to gradually increase the weight of the adversarial loss to a preset value.
[0036] The abnormal state detection model construction module is used to use the trained generator as the abnormal state detection model and construct an abnormality detection indicator based on the weighted MLE error and reconstruction error;
[0037] The online diagnosis module is used to input the full-cycle test set into the abnormal state detection model and identify the abnormal state of the sample online according to the abnormal detection index.
[0038] It can be seen from the above technical solutions that the present invention has the following beneficial effects:
[0039] (1) This paper combines the detail generation capability (adversarial loss + reconstruction loss) of generative adversarial networks (GANs) to enable the model to accurately capture the microscopic features of normal states. During the detection phase, the degree of deviation is quantified by a combined anomaly indicator (MLE error + weighted reconstruction error), making it highly sensitive to weak early abnormal signals (such as faults masked by noise). This overcomes the problems of traditional autoencoders' insufficient learning of key features and GANs' missed detection due to mode collapse, achieving earlier and more accurate fault warnings.
[0040] (2) The reversibility and precise likelihood calculation of the flow model of the present invention fundamentally reduce the risk of mode collapse; the progressive training strategy balances distribution learning and detail generation, significantly improving model stability. It solves the training divergence problem caused by the instability of the adversarial mechanism in pure GAN models and filters out data noise interference.
[0041] (3) The proposed method uses the MLE error to provide an interpretable probability metric, while the reconstruction error provides detailed information. The weighted combination of the two clearly reflects the continuous evolution of a fault from initiation to deterioration. This overcomes the drawbacks of traditional methods (such as autoencoders) that rely solely on the reconstruction error and lack probabilistic meaning, enabling quantitative tracking and visual diagnosis of fault evolution. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the implementation cases of the present invention or the technical solutions in the prior art, the following briefly describes the drawings required for use in the embodiments. By referring to the drawings, the features and advantages of the present invention will be more clearly understood. The drawings are for illustration only and should not be construed as limiting the present invention in any way. Those skilled in the art can derive other drawings based on these drawings without inventive effort. Among them:
[0043] Figure 1 A flowchart of an intelligent anomaly detection method based on a convolutional flow adversarial network provided by the present invention;
[0044] Figure 2 Schematic diagram of the structure of the convolutional flow adversarial network model in the present invention;
[0045] Figure 3 Schematic diagram of the structure of the abnormal state detection model of the present invention;
[0046] Figure 4 Schematic diagram of the results of abnormal indicators and original signals in the present invention;
[0047] Figure 5 Schematic diagram of the envelope spectrum of the sample of the full life cycle data at the 72nd minute in the present invention;
[0048] Figure 6This is a block diagram of an intelligent anomaly detection system based on a convolutional flow adversarial network provided by the present invention. DETAILED DESCRIPTION
[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0050] Example 1: In order to solve the problems faced by the existing technology in mechanical equipment anomaly detection in the absence of abnormal samples, such as insufficient feature extraction accuracy, poor model stability, lack of probability benchmarks, and weak early anomaly capture capabilities. Figure 1 As shown, the present invention proposes an intelligent anomaly detection method based on a convolutional flow adversarial network, which includes:
[0051] S1: Collect the mechanical time-domain vibration signals of the equipment throughout its life cycle, cut samples of uniform length, perform short-time Fourier transform on them to obtain a time-frequency diagram, and divide the time-frequency diagram into a normal sample training set containing only normal equipment operation data and a full-cycle test set containing data from the entire equipment life cycle;
[0052] S2: Build a convolutional adversarial network model, which consists of a generator and a discriminator.
[0053] S3: Input the normal sample training set into the convolutional adversarial network model, pre-train the generator through the set maximum likelihood estimation loss function, and solidify the discriminator parameters without optimizing the discriminator;
[0054] S4: The parameters of the de-fixed discriminator are fixed and optimized alternately with the pre-trained generator until the set conditions are met. When the discriminator is updated, the samples in the normal sample training set are used as positive samples and the generator synthesized samples are used as negative samples, and the discriminator is optimized using binary cross-entropy loss. When the generator is updated, the generator is optimized using a joint loss, which is a linear weighted sum of MLE loss, adversarial loss, and reconstruction loss. The weight of the adversarial loss is zero at the beginning of adversarial training, and a step-by-step strategy is used to gradually increase the weight of the adversarial loss to a preset value.
[0055] S5: Use the trained generator as an anomaly detection model and construct an anomaly detection metric based on the weighted MLE error and reconstruction error.
[0056] S6: Input the full-cycle test set into the anomaly state detection model and identify the abnormal state of the sample online based on the anomaly detection index.
[0057] From the above technical solution, it can be seen that the present invention proposes an intelligent anomaly detection method based on a convolutional flow adversarial network. By collecting the vibration signal of the equipment throughout its life cycle and obtaining a time-frequency diagram through short-time Fourier transform, the normal sample training set and the full-cycle test set are divided to lay a data foundation for the model to learn normal features and ensure the purity of the training data; a convolutional flow adversarial network composed of a generator (M-layer Block, including a compression layer, a Flow layer (Actnorm layer, a reversible 1×1 convolution layer, a coupling layer) and a separation layer, supporting forward feature extraction and reverse sample generation) and a discriminator (convolutional flow network + global average pooling layer, etc.) is constructed, which integrates the precise likelihood estimation of the flow model and the detail capture ability of the generative adversarial network, solving the problem of feature extraction of traditional models. The problem of insufficient accuracy; through MLE loss pre-training generator and combined with alternating optimization adversarial training (the generator uses joint loss, and the adversarial loss weight is increased step by step), the reversibility of the flow model and the progressive training strategy are used to reduce the risk of mode collapse, improve model stability, and solve the problem of instability in pure GAN training; construct an anomaly detection indicator based on the weighted MLE error and reconstruction error, in which the MLE error provides a strict probability benchmark and the reconstruction error supplements the detailed deviation information, which can clearly reflect the evolution of the fault and solve the problem of the lack of a probability benchmark in the existing model; finally, through full-cycle test set online detection, relying on the network's high sensitivity to subtle deviations, it can achieve accurate capture of early anomalies, solve the problem of weak early fault detection capabilities, and the overall structure can filter noise and has strong robustness.
[0058] In step S1, the mechanical time domain vibration signal of the equipment throughout its life cycle is collected, samples of uniform length are cut, and short-time Fourier transform (STFT) is performed to obtain a time-frequency diagram. The time-frequency diagram is divided into a normal sample training set containing only normal operation data of the equipment and a full-cycle test set containing data from the entire life cycle of the equipment.
[0059] The XJTU-SY rolling bearing accelerated life test dataset, provided by Xi'an Jiaotong University, was used as the processing target. The dataset's acquisition platform consists of an AC motor, motor speed controller, rotating shaft, support bearing, hydraulic loading system, and test bearing. The test bearing is an LDKUER204 rolling bearing. The specific parameters for full-life cycle data acquisition are as follows: a sampling frequency of 25.6 kHz, a sampling interval of 1 minute, and a sampling duration of 1.28 seconds. The dataset provides three operating conditions, each with five bearings. Both vertical and horizontal vibration signals are collected. The experiment selected a set of horizontal full-life data for analysis. This data set corresponds to a speed of 2100 rpm and a radial load of 12 kN. The data contains 123 samples, and the bearing operated for a total of 123 minutes. The final fault was an outer race crack, with a reference frequency of 108.6 Hz for the outer race fault characteristic.
[0060] The specific operations of data preprocessing are as follows:
[0061] 0.128s of data are randomly selected from each sampling data segment as a sample, and each sample has a total of 3277 data points.
[0062] The selected samples are subjected to short-time Fourier transform (STFT), and a rectangular window function is selected to convert the time domain signal into a 128×256 time-frequency diagram.
[0063] All time-frequency graphs are arranged in chronological order, and the first 32 samples are selected as the normal sample training set. These samples correspond to the data during the normal operation period of the equipment and do not contain abnormal samples. The 123 samples of the full life cycle data are used as the full-cycle test set for subsequent anomaly detection verification.
[0064] In step S2, a convolutional stream adversarial network model is constructed. The convolutional stream adversarial network model consists of a generator and a discriminator. The two are parallel structures to form an adversarial network. The generator is used to generate pseudo samples, and the discriminator is used to distinguish true from false samples.
[0065] The specific structure is shown in Figure 2.
[0066] 1. Construction of the generator
[0067] The generator uses a convolutional flow network consisting of four blocks. Each block consists of a compression layer, 16 flow layers, and a separation layer. Each flow layer is composed of a stack of actnorm layers, reversible 1×1 convolutional layers, and coupling layers. The forward pass of the generator's convolutional flow network is used for feature extraction, and the backward pass is used for synthetic sample generation.
[0068] Compression layer: The number of channels of the input feature map is multiplied by four, and the length and width are both reduced to half of the original, thereby compressing the feature map size and increasing the number of channels.
[0069] Flow layer:
[0070] Actnorm layer (A1): Performs data-dependent initialization based on the mean and variance of each channel on the first batch of data. This is done by first rearranging the data by channel and then flattening it so that each channel contains values from all batches and spatial locations. The mean and variance are then statistically calculated to initialize the scaling and bias parameters of this layer, ensuring that the initial output is normalized to zero mean and unit variance, avoiding the drawback of relying on statistics from the entire batch.
[0071] Reversible 1x1 convolutional layer (C1): Performs a linear transformation on each input data point in the channel dimension. The linear transformation used is a reversible non-singular matrix, making the entire convolution operation reversible. The convolution operation multiplies the weight matrix at each spatial position.
[0072] Coupling layer (O1): The data is split into two parts by channel. The first part is directly output without any calculation. The first part is copied and passed through a small convolutional network. The small convolutional network is stacked in the order of 3×3 convolutional layer, ReLU activation layer, 1×1 convolutional layer, ReLU activation layer, and 3×3 zero-initial convolutional layer. The output of the small convolutional network is split into weights and biases according to the number of channels. The second part is multiplied by the weight and then added to the bias before output.
[0073] Separation layer: Splits the input into two parts by channel. One part serves as the input of the next layer of Block, and the other part serves as an intermediate latent variable, which can be directly used for sample reconstruction to observe the learning ability of the network.
[0074] After each block, the number of channels is multiplied by 2, and the length and width are reduced to half of the original. After the sample is forward propagated, it becomes a latent variable with 8 channels and a size of 8×16. This latent variable can be used to reshape the synthetic sample.
[0075] 2. Construction of the Discriminator
[0076] The discriminator consists of a convolutional flow network, a global average pooling layer (GAP), a fully connected layer (F1), and a Sigmoid activation function layer.
[0077] Convolutional Stream Network: This uses the same architecture as the generator, but only uses the forward pass and disables the backward pass. That is, after the forward pass, the input true and false samples are transformed into latent variables with 8 channels and a size of 8×16.
[0078] Global average pooling layer: averages all spatial pixels on each input channel, outputs a single value for the corresponding channel, and compresses the feature map into a feature vector. In this embodiment, the feature vector shape is 8×1.
[0079] Fully connected layer: All features output by the previous layer are weighted summed and nonlinearly transformed to convert the feature vector into eigenvalue.
[0080] Sigmoid activation function layer: maps the network's original eigenvalue scores to probabilities, which are used to distinguish true from false samples.
[0081] In step S3, the normal sample training set is input into the convolutional flow adversarial network model, and the generator is pre-trained through the set maximum likelihood estimation (MLE) loss function. At the same time, the discriminator parameters are solidified and the discriminator is not optimized.
[0082] The specific settings of pre-training are as follows:
[0083] The input of the generator is a normal sample training set. The last layer outputs a latent variable with 8 channels and a size of 8×16. After the latent variable is passed back, the generator outputs a synthetic pseudo sample.
[0084] The MLE loss function optimizes parameters by minimizing the negative log-likelihood of the data under the model, ensuring that the synthetic samples output by the model are highly consistent with the real samples. This works by assuming that the data samples come from an unknown parameterized probability distribution and adjusting the model parameters to maximize the joint probability of the observed data under that distribution, which is equivalent to minimizing the negative logarithm of that joint probability.
[0085] The discriminator is solidified after completing parameter initialization and has no input or output.
[0086] The optimization algorithm uses the stochastic gradient descent algorithm, the pre-training iteration number is set to 5, and the fixed learning rate is 0.01.
[0087] Pre-training continues until the log-likelihood function of the generator for normal samples converges, so that the generator has the initial ability to generate samples, laying the foundation for subsequent adversarial training.
[0088] In step S4, the parameters of the de-fixed discriminator are fixed and optimized alternately with the pre-trained generator until the set conditions are met; when the discriminator is updated, the samples in the normal sample training set are used as positive samples and the generator synthesized samples are used as negative samples, and the discriminator is optimized using binary cross entropy loss; when the generator is updated, the generator is optimized using joint loss, which is the linear weighted sum of MLE loss, adversarial loss and reconstruction loss. The weight of the adversarial loss is zero at the initial stage of adversarial training, and a step-by-step strategy is used to gradually increase the weight of the adversarial loss to a preset value.
[0089] Specifically, the parameters of the de-fixed discriminator are optimized alternately with the pre-trained generator in a one-to-one ratio until the loss of the model objective function tends to be stable (a total of 50 iterations in this embodiment).
[0090] Discriminator Update: The discriminator is trained using the binary cross-entropy loss function, using samples from the normal training set as positive samples and samples synthesized by the generator as negative samples. This loss function quantifies the error by measuring the "cross entropy" between the probability distribution of the discriminator output and the distribution of the true labels. This function imposes a strong penalty on the confidence level of the discriminator output, especially when the model is overconfident about the wrong class. This generates a large gradient signal, helping the model to quickly correct incorrect predictions.
[0091] Generator update: Optimize the weighted joint loss applied to the generator, where the joint loss is defined as the linear weighted sum of the MLE loss, the adversarial loss, and the reconstruction loss.
[0092] The adversarial loss adopts the classic minimax optimization form. During training, the goal of the discriminator is to maximize the objective function, and the goal of the generator is to minimize the objective function.
[0093] The reconstruction loss is in the form of mean square error, which measures the difference between the input real sample and the output synthetic sample.
[0094] The weight of the joint loss is freely adjusted according to the actual problem. In the early stage of adversarial training, the weight of the adversarial loss is set to zero, and only the MLE and reconstruction performance are consolidated. As the training deepens, a step-by-step strategy is adopted to smoothly increase the proportion of the adversarial loss. In this embodiment, after 10 iterations, the weight rises to the preset value and remains unchanged. Finally, the MLE loss weight is set to 5, the adversarial loss weight is set to 3, and the reconstruction loss weight is set to 3.
[0095] During the optimization process, the stochastic gradient descent algorithm is used, and the gradient clipping and learning rate gradual attenuation mechanisms are introduced:
[0096] Gradient clipping uses global norm clipping to "clip" excessive gradients to a preset threshold or scale them to ensure that the parameter update step size is within a reasonable range.
[0097] The learning rate gradually decays from the initial 0.01 to 0.001.
[0098] The entire training process is executed in parallel, and the optimal model parameters are saved periodically. The evaluation indicators comprehensively consider the reconstruction quality of the generator and the error rate of the discriminator to ensure that the generator and discriminator are balanced and the generation quality and anomaly detection capabilities are improved simultaneously.
[0099] In step S5, the trained generator is solidified and saved as an abnormal state detection model, such as Figure 3 As shown in the figure, an anomaly detection indicator based on the weighted MLE error and reconstruction error is constructed.
[0100] The calculation formula of the anomaly detection index is:
[0101] ;
[0102] Wherein, w1 and w2 are weights that can be freely adjusted according to the actual problem. In this embodiment, the MLE error weight w1 is set to 3, and the reconstruction error weight w2 is set to 5.
[0103] In step S6, the full-cycle test set is input into the abnormal state detection model, and the abnormal state of the sample is identified online according to the abnormal detection index.
[0104] The full-cycle test set does not participate in model training and is only used to verify the accuracy of the model in detecting abnormal conditions. The specific judgment method is as follows:
[0105] First, summarize the abnormal index values of all previous samples and calculate their average value as a reference benchmark.
[0106] For each new sample, its abnormal index value is calculated and compared with the baseline value. If the value exceeds 1 / 3 of the baseline value, the sample is considered abnormal.
[0107] In this example, the anomaly detection results are shown in Figure 4. The model's anomaly index values initially remained stable near a constant value until around the 72nd minute, when they began to increase, signaling a fault. Subsequent fluctuations in the index values closely reflect the evolution of the bearing fault. To verify the accuracy of this result, envelope spectrum analysis of the vibration signal at the 72nd minute was performed. As shown in Figure 5, a significant peak at 108.59 Hz was observed. This frequency is close to the reference value of 108.6 Hz for the bearing outer race fault characteristic frequency given in the original data set, confirming the occurrence of the fault.
[0108] Example 2: Figure 6 As shown, the present invention provides an intelligent anomaly detection system based on a convolutional flow adversarial network. The system is used to implement the intelligent anomaly detection method based on a convolutional flow adversarial network of the above embodiment 1, specifically comprising:
[0109] The data acquisition and preprocessing module 100 is used to collect the mechanical time-domain vibration signals of the equipment throughout its life cycle, intercept samples of uniform length, perform short-time Fourier transform to obtain a time-frequency graph, and divide the time-frequency graph into a normal sample training set containing only normal operation data of the equipment and a full-cycle test set containing data from the entire life cycle of the equipment;
[0110] The convolutional adversarial network model construction module 200 is used to construct a convolutional adversarial network model. The convolutional adversarial network model consists of a generator and a discriminator, wherein:
[0111] The generator uses a convolutional flow network composed of M layers of blocks, each of which includes a compression layer, an N-layer flow layer and a separation layer in sequence; the compression layer is used to compress the input feature map size and increase the number of channels; the flow layer is composed of an actnorm layer, a reversible 1×1 convolutional layer and a coupling layer. The actnorm layer performs data-dependent initialization based on the mean and variance of each channel of the first batch of data to achieve zero mean and unit variance normalization. The reversible 1x1 convolutional layer performs a linear transformation of the channel dimension on each spatial position of the input. The coupling layer splits the input into two parts. The first part is directly output, and the second part is affine transformed based on the weights and biases obtained after the first part is transformed by a small convolutional network and then output; the separation layer splits the input into two parts according to the channel, one part is used as the input of the next layer of blocks, and the other part is used as an intermediate latent variable; the forward pass of the convolutional flow network of the generator is used for feature extraction, and the reverse pass is used for synthetic sample generation;
[0112] The discriminator consists of a convolutional flow network, a global average pooling layer, a fully connected layer, and an activation function layer. The convolutional flow network of the discriminator adopts the same architecture as the generator but only uses forward propagation.
[0113] The model pre-training module 300 is used to input the normal sample training set into the convolutional flow adversarial network model, pre-train the generator through the set maximum likelihood estimation loss function, and solidify the discriminator parameters without optimizing the discriminator;
[0114] The model adversarial training module 400 is used to fix the parameters of the discriminator and alternately optimize it with the pre-trained generator until the set conditions are met. When the discriminator is updated, the samples in the normal sample training set are used as positive samples and the samples synthesized by the generator are used as negative samples, and the discriminator is optimized using binary cross-entropy loss. When the generator is updated, the generator is optimized using a joint loss. The joint loss is a linear weighted sum of the MLE loss, the adversarial loss, and the reconstruction loss. The weight of the adversarial loss is zero at the beginning of the adversarial training, and a step-by-step strategy is used to gradually increase the weight of the adversarial loss to a preset value.
[0115] Anomaly detection model construction module 500 is used to use the trained generator as an anomaly detection model and construct an anomaly detection indicator based on the weighted MLE error and reconstruction error;
[0116] The online diagnosis module 600 is used to input the full-cycle test set into the abnormal state detection model and identify the abnormal state of the sample online according to the abnormal detection index.
[0117] An intelligent anomaly detection system based on a convolutional flow adversarial network in this embodiment is used to implement the aforementioned intelligent anomaly detection method based on a convolutional flow adversarial network. Therefore, the specific implementation method of the intelligent anomaly detection system based on a convolutional flow adversarial network can be seen in the embodiment part of the intelligent anomaly detection method based on a convolutional flow adversarial network mentioned above. For example, the data acquisition and preprocessing module 100, the convolutional flow adversarial network model construction module 200, the model pre-training module 300, the model adversarial training module 400, the abnormal state detection model construction module 500, and the online diagnosis module 600 are respectively used to implement steps S1, S2, S3, S4, S5, and S6 in the above-mentioned intelligent anomaly detection method based on a convolutional flow adversarial network. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part. In order to avoid redundancy, it will not be repeated here.
[0118] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0119] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0120] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0121] Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will appreciate that other variations or modifications can be made based on the above description. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.
Claims
1. An intelligent anomaly detection method based on convolutional flow adversarial network, characterized in that: include: Collect the mechanical time-domain vibration signals of the equipment throughout its life cycle, intercept samples of uniform length, perform short-time Fourier transform on them to obtain a time-frequency diagram, and divide the time-frequency diagram into a normal sample training set containing only normal operating data of the equipment and a full-cycle test set containing data from the entire life cycle of the equipment; Construct a convolutional adversarial network model, which consists of a generator and a discriminator, where: The generator adopts a convolutional flow network composed of M layers of blocks, each layer of blocks includes a compression layer, an N layer of flow layer and a separation layer in sequence; the compression layer is used to compress the input feature map size and increase the number of channels; the flow layer is stacked by an actnorm layer, a reversible 1×1 convolution layer and a coupling layer, the actnorm layer performs data-dependent initialization based on the mean and variance of each channel of the first batch of data to achieve zero mean and unit variance normalization, the reversible 1x1 convolution layer performs a linear transformation of the channel dimension on each spatial position of the input, the coupling layer splits the input into two parts, the first part is directly output, and the second part is affine transformed based on the weights and biases obtained after the first part is transformed by a small convolutional network and then output; the separation layer splits the input into two parts according to the channel, one part is used as the input of the next layer of blocks, and the other part is used as an intermediate latent variable; the forward pass of the convolutional flow network of the generator is used for feature extraction, and the reverse pass is used for synthetic sample generation; The discriminator includes a convolutional flow network, a global average pooling layer, a fully connected layer, and an activation function layer in sequence; wherein the convolutional flow network of the discriminator adopts the same architecture as that of the generator but only uses forward transmission; Inputting the normal sample training set into the convolutional flow adversarial network model, pre-training the generator through a set maximum likelihood estimation loss function, and solidifying the discriminator parameters without optimizing the discriminator; The parameters of the de-fixed discriminator are fixed and optimized alternately with the pre-trained generator until the set conditions are met. When the discriminator is updated, the samples in the normal sample training set are used as positive samples and the samples synthesized by the generator are used as negative samples, and the discriminator is optimized using binary cross-entropy loss. When the generator is updated, the generator is optimized using a joint loss. The joint loss is a linear weighted sum of the MLE loss, the adversarial loss, and the reconstruction loss. The weight of the adversarial loss is zero at the beginning of adversarial training, and a step-by-step strategy is used to gradually increase the weight of the adversarial loss to a preset value. The trained generator is used as an anomaly detection model, and an anomaly detection indicator based on the weighted MLE error and reconstruction error is constructed; The full-cycle test set is input into the abnormal state detection model, and the abnormal state of the sample is identified online according to the abnormal detection index.
2. The intelligent anomaly detection method based on convolutional flow adversarial network according to claim 1 is characterized in that: The short-time Fourier transform uses a rectangular window function to convert the time domain signal into a time-frequency diagram of uniform size; the normal sample training set uses data from the front end of the mechanical time domain vibration signal of the equipment throughout its life cycle to confirm normal operation.
3. The intelligent anomaly detection method based on convolutional flow adversarial network according to claim 1 is characterized in that: The compression layer multiplies the number of channels of the input feature map by four, and the length and width dimensions are both reduced to half of the original ones.
4. The intelligent anomaly detection method based on convolutional flow adversarial network according to claim 1 is characterized in that: The Actnorm layer initialization method is as follows: the input data is rearranged and flattened by channel, and the mean and variance of each channel are calculated to initialize the scaling and bias parameters of the layer.
5. The intelligent anomaly detection method based on convolutional flow adversarial network according to claim 1 is characterized in that: The small convolutional network used in the coupling layer includes: a 3×3 convolutional layer, a ReLU activation layer, a 1×1 convolutional layer, a ReLU activation layer, and a 3×3 zero-initial convolutional layer.
6. The intelligent anomaly detection method based on convolutional flow adversarial network according to claim 1 is characterized in that: The alternating optimization is a one-to-one round alternation; the discriminator parameters are fixed when the generator is updated, and the generator parameters are fixed when the discriminator is updated; the reconstruction loss is in the form of mean square error; the optimization process adopts the stochastic gradient descent algorithm, and introduces gradient clipping and learning rate gradual attenuation mechanisms.
7. The intelligent anomaly detection method based on convolutional flow adversarial network according to claim 1 is characterized in that: In the joint loss function, the MLE loss weight, the adversarial loss weight, and the reconstruction loss weight are freely adjusted and set according to the actual problem.
8. The intelligent anomaly detection method based on convolutional flow adversarial network according to claim 1 is characterized in that: The method for online identifying the abnormal state of a sample based on the abnormality detection indicator is: Calculate the anomaly detection index value of each sample and compare it with the benchmark value calculated based on historical samples. When the index value exceeds the set ratio of the benchmark value, it is determined to be an abnormal state; the benchmark value is the average of the anomaly index values of all historical samples before the current sample.
9. The intelligent anomaly detection method based on convolutional flow adversarial network according to claim 8 is characterized in that: The anomaly detection index value is: ; Among them, w1 and w2 are weights that can be freely adjusted according to actual problems.
10. An intelligent anomaly detection system based on convolutional flow adversarial network, characterized in that: The system is used to implement the intelligent anomaly detection method based on convolutional flow adversarial network according to any one of claims 1 to 9, specifically comprising: The data acquisition and preprocessing module is used to collect the mechanical time-domain vibration signals of the equipment throughout its life cycle, intercept samples of uniform length, perform short-time Fourier transform to obtain a time-frequency diagram, and divide the time-frequency diagram into a normal sample training set containing only normal operating data of the equipment and a full-cycle test set containing data from the entire life cycle of the equipment; The convolutional adversarial network model construction module is used to construct a convolutional adversarial network model. The convolutional adversarial network model consists of a generator and a discriminator, where: The generator adopts a convolutional flow network composed of M layers of blocks, each layer of blocks includes a compression layer, an N layer of flow layer and a separation layer in sequence; the compression layer is used to compress the input feature map size and increase the number of channels; the flow layer is stacked by an actnorm layer, a reversible 1×1 convolution layer and a coupling layer, the actnorm layer performs data-dependent initialization based on the mean and variance of each channel of the first batch of data to achieve zero mean and unit variance normalization, the reversible 1x1 convolution layer performs a linear transformation of the channel dimension on each spatial position of the input, the coupling layer splits the input into two parts, the first part is directly output, and the second part is affine transformed based on the weights and biases obtained after the first part is transformed by a small convolutional network and then output; the separation layer splits the input into two parts according to the channel, one part is used as the input of the next layer of blocks, and the other part is used as an intermediate latent variable; the forward pass of the convolutional flow network of the generator is used for feature extraction, and the reverse pass is used for synthetic sample generation; The discriminator includes a convolutional flow network, a global average pooling layer, a fully connected layer, and an activation function layer in sequence; wherein the convolutional flow network of the discriminator adopts the same architecture as that of the generator but only uses forward transmission; A model pre-training module is used to input the normal sample training set into the convolutional flow adversarial network model, pre-train the generator through a set maximum likelihood estimation loss function, and solidify the discriminator parameters without optimizing the discriminator; The model adversarial training module is used to fix the discriminator parameters and alternately optimize them with the pre-trained generator until the set conditions are met. When the discriminator is updated, the samples in the normal sample training set are used as positive samples and the samples synthesized by the generator are used as negative samples, and the discriminator is optimized using binary cross-entropy loss. When the generator is updated, the generator is optimized using a joint loss. The joint loss is a linear weighted sum of the MLE loss, the adversarial loss, and the reconstruction loss. The weight of the adversarial loss is zero at the beginning of adversarial training, and a step-by-step strategy is used to gradually increase the weight of the adversarial loss to a preset value. The abnormal state detection model construction module is used to use the trained generator as the abnormal state detection model and construct an abnormality detection indicator based on the weighted MLE error and reconstruction error; The online diagnosis module is used to input the full-cycle test set into the abnormal state detection model and identify the abnormal state of the sample online according to the abnormal detection index.
Citation Information
Patent Citations
Image anomaly detection method based on deep convolutional generative adversarial network
CN113658115A
Two-stage image anomaly detection method based on generative adversarial network
CN114757257A