Lightweight transformer-based generative adversarial network converter valve abnormality detection method and system
By using a lightweight Transformer generative adversarial network and leveraging MV2 and K-ViT block modules to reduce model complexity, the problem of insufficient detection accuracy in converter valve anomaly detection is solved, achieving efficient anomaly detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGSHA UNIVERSITY OF SCIENCE AND TECHNOLOGY
- Filing Date
- 2025-09-30
- Publication Date
- 2026-06-23
Smart Images

Figure CN121483291B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electrical maintenance, specifically to a method and system for detecting abnormalities in converter valves based on a lightweight Transformer generative adversarial network. Background Technology
[0002] Ultra-high voltage (UHV) power transmission technology is widely used globally. As a core component of the power system, the safe operation of UHV converter stations ensures stable and reliable power transmission. However, during operation, abnormal phenomena such as partial discharge can affect power balance. These faults can lead to system performance degradation and even serious equipment failures. To ensure the safe and stable operation of the power system, converter stations place higher demands on the reliability of power system fault detection methods.
[0003] Traditional power anomaly detection technologies rely on various measurement methods, including vibration signal analysis, infrared imaging, and current detection. Vibration signal analysis is widely used in practical engineering due to its high correlation with mechanical faults in converter valves. However, this technology typically requires the use of contact sensors for data acquisition, which limits its application in high-temperature or irregular surface environments. Infrared imaging, as another non-contact detection method, can reveal thermal anomalies in equipment through thermal images, aiding in fault diagnosis. However, infrared imaging systems usually require high installation costs, limiting their widespread adoption in low-cost equipment. Current signal detection is suitable for various power equipment and can be used to monitor equipment operating status and fault conditions. Although current signal detection does not affect circuit performance, its accuracy is significantly affected by environmental factors and requires regular calibration and maintenance.
[0004] Anomaly detection methods based on acoustic signature signals have attracted widespread attention in recent years. In the detection of abnormal conditions in converter valves, acoustic signature signals offer numerous advantages, including high efficiency, accuracy, real-time operation, and non-contact nature. By installing acoustic sensors, the detection equipment can instantly capture the acoustic signatures emitted by the converter valve during operation, quickly identifying the machine's status. As a non-contact monitoring method, acoustic signature signal detection not only reduces risks and maintenance costs during the detection process but also avoids interference with operating equipment. Furthermore, acoustic signature signals contain rich, multi-dimensional information, including frequency, amplitude, and waveform. This information provides a more comprehensive understanding of the converter valve's operating status, facilitating in-depth analysis and decision-making, and providing strong support for the safe operation of the equipment.
[0005] In anomaly detection of converter valves, acquiring anomaly data is often difficult. In actual system operation, faults occur infrequently and are diverse in type, posing a significant challenge to comprehensively collecting acoustic signature samples. Supervised anomaly detection methods rely on training with a large amount of labeled normal and anomaly data. However, due to the imbalance between normal and anomaly data, these methods have many limitations and struggle to effectively handle unknown anomalies. Traditional detection methods typically rely on manual inspection and basic statistical analysis, which are insufficient for practical applications. In recent years, unsupervised anomaly detection techniques such as Generative Adversarial Networks (GANs) have emerged, demonstrating high detection accuracy and good adaptability. However, existing GAN-based anomaly detection methods typically require deeper network structures to achieve the required accuracy, placing higher performance demands on operating equipment. Summary of the Invention
[0006] The technical problem to be solved by this invention is to provide a method and system for detecting anomalies in converter valves based on a lightweight Transformer generative adversarial network, which improves the accuracy of anomaly detection of converter valve acoustic signatures, reduces model complexity, and enhances model versatility.
[0007] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0008] A method for anomaly detection in converter valves based on a lightweight Transformer generative adversarial network includes the following steps:
[0009] Acquire historical acoustic data of the operation of the UHV converter valve and convert the historical acoustic data into a Mel spectrum. The historical acoustic data includes acoustic data under normal operation and under potential abnormal conditions.
[0010] The Mel spectrogram of historical voiceprint data is input into a lightweight Transformer generative adversarial network for model training to obtain a trained model. The lightweight Transformer generative adversarial network includes a generator network and a discriminator. During model training, the generator network reconstructs images with the goal of generating images whose source cannot be distinguished by the discriminator as much as possible. The discriminator receives the original image and the reconstructed image and distinguishes them with the goal of determining as accurately as possible whether the input image is a voiceprint spectrogram generated by the normal operation of the converter valve. The trained model uses the generator network to reconstruct the input original image to obtain a reconstructed image. The anomaly score between the reconstructed image and the corresponding original image is calculated. If the anomaly score is greater than a preset threshold, an anomaly is detected.
[0011] The generator network includes a first encoder, a decoder, and a second encoder. The first encoder, second encoder, and discriminator each include multiple alternately stacked MV2 modules and K-ViT block modules. The decoder includes multiple alternately stacked D-MV2 modules and K-ViT block modules. The MV2 module uses an inverted residual structure, performing dimensionality upscaling on the image tensor through a 1×1 convolution, followed by feature extraction through a 3×3 depthwise separable convolution, and then dimensionality reduction through a 1×1 convolution to obtain a feature map. The D-MV2 module performs dimensionality upscaling on the image tensor through a 1×1 convolution, followed by feature extraction through a 2×2 deconvolution, and then dimensionality reduction through a 1×1 convolution to obtain a feature map. The K-ViT... The block module uses multiple KAN convolutions to locally represent the image tensor of the feature map and adjust the channel size. Then, the feature map is divided into 2×2 image blocks and flattened. Each flattened sequence is input into L K-ViT Encoder modules for global modeling. The features are then rearranged back into the original feature map form through a folding operation. Finally, the image features are restored through KAN convolution and image stitching. In the K-ViT Encoder module, the units at the same position in each image block use a multi-head attention mechanism.
[0012] After converting the acoustic signature data of the UHV converter valve to be detected into the original Mel spectrogram, it is input into the trained model to obtain the anomaly detection results.
[0013] Furthermore, during model training, the generator network and discriminator are trained alternately. Each time the generator network is trained, an input image is randomly extracted from the Mel spectrogram of historical voiceprint data and input into the generator network for forward propagation. The first encoder downsamples the original input image and maps it to the latent space to obtain a first latent representation. The decoder remaps the first latent representation of the image into a reconstructed image. The second encoder downsamples the reconstructed image again and maps it to the latent space to obtain a second latent representation. The first latent representation, reconstructed image, and second latent representation of the input image are obtained. The loss function of the generator network is calculated based on the input image, the corresponding first latent representation, reconstructed image, second latent representation, and the output of the discriminator after the previous alternating training. The parameters of the generator network are updated based on the loss function of the generator network.
[0014] Each time the discriminator is trained, the reconstructed image of the generator network after this alternating training and the corresponding input image are input into the discriminator for forward propagation. The output of the discriminator is obtained, the loss function of the discriminator is calculated, and the parameters of the discriminator are updated according to the loss function.
[0015] Furthermore, when the first encoder performs downsampling on the input image and maps it to the latent space to obtain a first latent representation, and when the second encoder performs downsampling on the reconstructed image again and maps it to the latent space to obtain a second latent representation, both include:
[0016] First, a shallow feature map with a resolution of 128×128 is extracted through a 3×3 standard convolutional layer to capture local texture details. Then, the inverted residual block of the MV2 module is used to extract features to obtain a dimensionality-reduced feature map sequence. Next, the K-ViTblock module is used to serialize the feature map into pixel blocks and establish global dependencies. Finally, the spatial dimension is compressed through an adaptive average pooling layer, and then flattened and mapped to a low-dimensional latent space through a fully connected layer.
[0017] Furthermore, the step of the discriminator receiving and distinguishing the original image and the reconstructed image includes:
[0018] After adjusting the channels of the original and reconstructed images through 3×3 convolutional layers, the image dimensionality is gradually reduced by alternately stacking MV2 inverted residual blocks and K-ViT blocks. Specifically, features are extracted by the inverted residual blocks of the MV2 module to obtain a dimensionality-reduced feature map sequence. Then, the K-ViT block module is used to serialize the feature map into pixel blocks and establish global dependencies. Finally, the spatial dimension is compressed by an adaptive pooling layer and then input into a fully connected layer to map the features into the vectors required for normal and abnormal binary classification. The Sigmoid activation function outputs the probability of the classification result being "true" or "false". A classification result of "true" represents the real original image, and a classification result of "false" represents the reconstructed image rebuilt by the generator.
[0019] Furthermore, when the decoder remaps the first latent representation of the image to the reconstructed image, it includes:
[0020] The first latent representation is adjusted in tensor size by a 1×1 standard convolutional layer, then upsampled by stacking D-MV2 modules, and then serialized into pixel blocks using K-ViT block modules to establish global dependencies, thereby gradually restoring the sample size to obtain the reconstructed image.
[0021] Furthermore, the loss function of the generator network is as follows:
[0022]
[0023] in, , , These are the reconstruction loss coefficient, generator loss coefficient, and adversarial loss coefficient, respectively. The reconstruction loss is calculated using the following formula:
[0024]
[0025] in, For the original sample, To reconstruct the sample, Indicates from data distribution The sampled input x is used to calculate the expected L1 value of the difference between the original sample and the reconstructed sample.
[0026] The generator loss is given by the following formula:
[0027]
[0028] in, For the first potential representation, For the second potential representation, Indicates from data distribution Medium sampling input And calculate the expected L2 value of the difference between the corresponding first latent representation and the second latent representation;
[0029] To counteract losses, the formula is as follows:
[0030]
[0031] in, This represents the output of the discriminator to the input image x. To obtain data distribution The discriminator output expectation of the medium-sampled input x, Indicates from data distribution Medium sampling input And calculate the expected L2 value of the difference between the corresponding discriminator output and the discriminator output expectation.
[0032] Furthermore, the loss function of the discriminator is as follows:
[0033]
[0034] in, The discriminator output is for the original sample. To reconstruct the discriminator output of the sample, Indicates from data distribution Medium sampling input The expected value of the L1 value output by the corresponding discriminator. Indicates from data distribution Medium sampling input The expected L1 value output by the corresponding discriminator.
[0035] Furthermore, when calculating the anomaly score between the reconstructed image and the corresponding original image, the L1 error between the reconstructed spectrogram and the corresponding original Mel spectrogram is specifically calculated as the anomaly score, using the following formula:
[0036]
[0037] in, It is a Mel spectrum diagram Abnormal scores, For the original sample, To reconstruct the sample.
[0038] This invention also proposes a converter valve anomaly detection system based on lightweight Transformer generative adversarial network, including a processor and a computer-readable storage medium. The computer-readable storage medium stores a computer program, which is executed by the processor to implement the steps of the aforementioned converter valve anomaly detection method based on lightweight Transformer generative adversarial network.
[0039] The present invention also proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the described method for anomaly detection of converter valves based on a lightweight Transformer generative adversarial network.
[0040] Compared with the prior art, the advantages of the present invention are as follows:
[0041] This invention replaces the convolutional structures of the generator network and discriminator in GANomaly with two lightweight structures, MV2 and D-MV2, to achieve upsampling and downsampling of the speaker spectrum. This method utilizes an inverted residual block to control the image tensor to a lower dimension. This effectively captures local spatial features and reduces the computational complexity of the network. Simultaneously, a K-ViT block module based on the Kolmogorov-Arnold Network (KAN) is introduced into the generator network. This module leverages the ability of KAN to directly learn parameterized nonlinear activation functions, reducing the number of network parameters and lowering the performance requirements of the detection device. By combining convolutional layers containing inverted residual structures with the K-ViT block module, the model can simultaneously learn both local and global image features, improving network performance and enabling anomaly detection tasks to be completed even with limited hardware capabilities. Attached Figure Description
[0042] Figure 1 This is a flowchart of the present invention.
[0043] Figure 2This is a schematic diagram of the LT-GAN network structure.
[0044] Figure 3 This describes the structure of the MV2 module.
[0045] Figure 4 This describes the structure of the D-MV2 module.
[0046] Figure 5 This describes the structure of the K-ViT block module.
[0047] Figure 6 For encoder , The structure.
[0048] Figure 7 For decoder The structure.
[0049] Figure 8 For discriminator The structure.
[0050] Figure 9 A comparison chart of AUC for different reconstruction loss coefficients.
[0051] Figure 10 A comparison chart of AUC loss coefficients for different generators.
[0052] Figure 11 A comparison chart of AUC for different adversarial loss coefficients.
[0053] Figure 12 ROC curves for different models.
[0054] Figure 13 This is the ROC curve for the ablation experiment. Detailed Implementation
[0055] The present invention will be further described below with reference to the accompanying drawings and specific preferred embodiments, but this does not limit the scope of protection of the present invention.
[0056] This embodiment proposes a converter valve anomaly detection method based on a lightweight Transformer-based generative adversarial network. The overall process is as follows: Figure 1 As shown, it includes the following steps:
[0057] S1) Obtain historical acoustic data of the operation of the UHV converter valve and convert the historical acoustic data into a Mel spectrum. The historical acoustic data includes acoustic data under normal operation and under potential abnormal conditions.
[0058] S2) Input the Mel spectrogram of the historical voiceprint data into the generative adversarial network of the lightweight Transformer for model training to obtain the trained model; the model uses the first encoder of the generator network in the lightweight Transformer to downsample the input original image and map it to the latent space to obtain the first latent representation. Then, the decoder of the generator network is used to remap the first latent representation of the image into the reconstructed image. The second encoder of the generator network is used to downsample the reconstructed image again and map it to the latent space to obtain the second latent representation. Finally, the anomaly score between the reconstructed image and the corresponding original image is calculated based on the first latent representation and the second latent representation. If the anomaly score is greater than the preset threshold, an anomaly is detected.
[0059] S3) After converting the acoustic data of the UHV converter valve to be detected into the original Mel spectrogram, input it into the trained model to obtain the anomaly detection results.
[0060] The relevant content will be explained in detail below.
[0061] Step S1 in this embodiment includes the following steps:
[0062] First, high-precision acoustic sensors are used to collect acoustic fingerprint data during the operation of the ultra-high voltage converter valve. After capture, the signal is conditioned by a low-noise preamplifier, and then converted from analog to digital by a high-speed data acquisition card (DAQ). This ensures the integrity of the acoustic fingerprint characteristics, providing high-fidelity input for subsequent processing.
[0063] The dataset used in this embodiment comes from actual sound measurement data of converter valves at a ±800kV UHV converter station in China. This data was acquired in real-time by microphones installed within the converter station, aiming to monitor the sound signal characteristics of the converter valves during operation. The dataset covers sound records from both normal operation and potential abnormal conditions at the converter station. Under abnormal conditions, equipment may generate faults or abnormal sound signatures such as friction, loosening, or arcing, which are often accompanied by sudden changes or abnormal enhancements in the sound signal. Therefore, by analyzing and identifying abnormal patterns in the sound signal, the health status of the converter station equipment can be assessed.
[0064] This dataset consists of a series of audio files containing sound signals, all stored in WAV format. Each file records the sound signal generated by the converter station at different time points, with a sampling frequency of 44.1 kHz and a duration of 10 seconds. To ensure the diversity and representativeness of the dataset, the collected data comprehensively covers various normal and abnormal conditions that the converter station equipment may encounter.
[0065] In addition, to facilitate model testing and analysis, the normal and abnormal states of the sound signals were labeled. Based on the apparent power range of the converter valve (2000MVA to 4000MVA), the measured sound data were divided into four subsets, named Data1 to Data4. Each dataset corresponds to a specific apparent power range, and the specific correspondence is shown in Table 1.
[0066] Table 1 shows the datasets corresponding to the apparent power range.
[0067]
[0068] Each audio file is segmented into multiple 1.36-second audio segments, and each segment is then converted into a corresponding Mel spectrogram. Mel spectrograms are a common representation of sound signals, better reflecting their spectral characteristics. Using Mel spectrograms as model input facilitates model learning and analysis of the sound signal's spectral features. For each Mel spectrogram, logarithmic transformation and normalization are applied to aid subsequent model training and optimization.
[0069] Next, data preprocessing is performed. In the data preprocessing part, the audio signal is first subjected to a short-time Fourier transform (STFT), and then the time-domain signal is converted into a frequency-domain signal to obtain the spectrum. Then, the energy of each filter is obtained through a Mel filter bank. Next, the logarithm of the energy value is taken to obtain the Mel spectrum, which is then normalized.
[0070] To process data and extract features more effectively, this embodiment divides a longer audio signal into multiple shorter segments. This process is implemented using a sliding window approach, with each window containing audio data within a certain time period. This makes the data easier to manipulate and allows for more accurate capture of the temporal characteristics of the audio signal.
[0071] When processing each audio segment, Mel Frequency Cepstral Coefficients (MFCCs) are used to represent its spectral characteristics. The Mel spectrum uses the Mel scale as the horizontal axis and the power spectrum as the vertical axis, a representation that more closely resembles human auditory perception. Audio segments are converted into corresponding Mel spectrograms, and then logarithmic transformation is applied to effectively enhance the significance of low-frequency features and suppress interference from high-frequency features. Finally, the logarithmically transformed Mel spectrograms are normalized to scale the data to a uniform range, avoiding negative impacts on model training caused by numerical differences between different features. For this purpose, the experiment uses a min-max normalization method to process the data.
[0072] Image detection methods that convert voiceprint images into spectrograms offer advantages over traditional time-frequency domain analysis methods such as wavelet transforms. Spectrograms are more intuitive and have higher information density, making them suitable for deep learning models. Furthermore, deep learning models can automatically extract high-level features, making them suitable for large-scale data processing and reducing manual intervention.
[0073] In this embodiment, step S2 involves inputting the Mel spectrogram of historical voiceprint data into a lightweight Transformer generative adversarial network (hereinafter referred to as LT-GAN) for model training, thereby enabling the determination of whether the converter valve has malfunctioned.
[0074] Figure 2 The overall model structure of LT-GAN mainly consists of a generator network and a discriminator. The generator network is composed of an encoder. decoder and encoder Composition. In each network structure, K-ViT block modules are combined with generative adversarial networks to give the model a spatial inductive bias. Simultaneously, lightweight structures such as MV2 and D-MV2 modules are utilized to reduce the overall model complexity. During LT-GAN model training, the generator aims to generate images whose sources the discriminator cannot distinguish, while the discriminator aims to accurately determine whether the input image is a acoustic spectrum generated by the normal operation of a converter valve. These two networks with different objectives are continuously trained and their parameters optimized alternately, enabling the encoder to learn the key features of the input spectrum. In anomaly detection, anomaly scores are calculated on the input spectrum to determine whether it is abnormal; if the anomaly score exceeds a preset threshold, it is considered an anomaly.
[0075] Figure 3 The structure of the MV2 module is shown. The MV2 module uses an inverted residual structure, offering advantages such as higher accuracy and a smaller model size. The image tensor first undergoes dimensionality upscaling through a 1×1 convolution, then feature extraction is performed through a 3×3 DW convolution (Depthwise Separable Convolution), and finally dimensionality reduction is achieved through a 1×1 convolution. The MV2 module implements different functions by controlling the stride and whether to use residual connections. Figure 3As shown, when stride=1 and residual connections are used, the network is more likely to maintain stability during training; when stride=2 and residual connections are not used, the module is used to perform dimensionality reduction of the feature maps. MV2 uses depthwise separable convolutions and inverse residual structures to bring many performance optimizations. Depthwise separable convolutions are much less computationally expensive than ordinary convolutions, reducing computational overhead while maintaining strong feature representation capabilities. In the inverse residual structure, the image is first expanded in channel size through a 1×1 convolution, a process that allows the network to learn richer features in a higher-dimensional space. The "dimensionality increase then reduction" design ensures that the feature maps are not over-compressed in the early stages, thus helping to maintain the richness of feature information and improve the final performance of the network. At the same time, the MV2 module, by introducing residual connections, helps to avoid gradient vanishing or exploding phenomena, making the model more stable during training.
[0076] To achieve both image channel expansion and image compression, this embodiment designs a D-MV2 structure in the decoder section to reduce image channels and restore the image. The D-MV2 module maintains the "first increase dimensionality, then decrease dimensionality" structure, replacing the depthwise separable convolution in MV2 with a 2×2 deconvolution kernel. Figure 4 As shown, when the stride is 1 and residual connections are used, the channel and image sizes remain unchanged; when the stride is 2 and residual connections are not used, the D-MV2 module is used to perform dimensionality upscaling of the feature map.
[0077] The K-ViT block module in this embodiment aims to model local and global information in the input tensor with fewer parameters. The structure of the K-ViT block module is as follows: Figure 5 As shown, the module first uses multiple KAN convolutions to locally represent the image tensor of the feature map and adjust the channel size. Then, the feature map is divided into 2×2 image blocks, flattened, and each unit sequence is input into L K-ViT encoder modules for global modeling. In the K-ViT encoder, a multi-head attention mechanism is used for units at the same position in each image block to reduce the computational cost of the attention mechanism. The K-ViT block module uses a stacked and parallelized approach with L K-ViT Encoders. This approach extracts higher-level features by processing the input spectrogram at multiple levels, thereby enhancing the overall expressive power. The features are then rearranged back into the original feature map form through a folding operation. Finally, the image features are restored through KAN convolutions and image stitching.
[0078] Compared to ordinary convolutions, KAN convolutional layers significantly reduce the number of parameters and computational cost by decomposing high-dimensional convolutional kernels into combinations of multiple low-dimensional kernels. Furthermore, for the MLP block in traditional Transformer encoders, KAN convolutional layers introduce non-linear activation functions between low-dimensional convolutional operations, enhancing the expressive power of the K-ViT Encoder. However, the MLP block requires independent training of models of different sizes, leading to inefficiency. KAN networks can be trained with fewer parameters, and then the number of parameters can be increased simply by refining their spline mesh, further reducing model complexity.
[0079] The generator network is the core component of the LT-GAN network, and its task is to generate synthetic data that is similar to normal data. The generator network consists of an encoder... decoder and the components of the encoder Image x is first processed by the encoder. Perform downsampling to learn key features of the input image and map them into the latent space. ,in Its adoption Figure 6 The hybrid architecture shown deeply integrates the lightweight convolutional module of MV2 with the global context modeling capabilities of the K-ViT block. Specifically, a 3×3 standard convolutional layer first extracts a shallow feature map with a resolution of 128×128, capturing local texture details. Then, MV2 inverted residual blocks are used to extract features, and depthwise separable convolutions are used to significantly reduce computational complexity and adjust channel sizes to achieve dimensionality reduction, resulting in a sequence of dimensionality-reduced feature maps. Building upon this, the network further introduces a K-ViT block to serialize the feature maps into pixel blocks and establish global dependencies. Finally, an adaptive average pooling layer compresses the spatial dimension, and then the result is flattened and mapped to a low-dimensional latent space by fully connected layers. .like Figure 7 As shown, the decoder The decoder adopts a structure symmetrical to the encoder, progressively restoring spatial resolution through D-MV2 with deconvolution layers. The latent space of image x Remapped to image Specifically, potential space First, the tensor size is adjusted using a standard 1×1 convolutional layer. Then, upsampling is performed using D-MV2 stacking to gradually restore the sample size and obtain a reconstructed image with a resolution of 128×128. Building upon this, the network also incorporates K-ViT blocks to achieve integration with the encoder. Symmetry ensures reconstruction quality. To optimize generation quality, a second encoder is introduced into the generator network. Reconstructed sample Re-encode into latent vectors And by minimizing The generator network is optimized by addressing the differences in features. It combines the efficient local feature extraction of the MV2 module with the global attention mechanism of the K-ViT block module, maintaining a lightweight model while simultaneously learning both local and long-range features.
[0080] Discriminator Receive original image sample x and reconstructed image sample x And distinguish and judge. For example Figure 8 As shown, the discriminator employs a hierarchical downsampling architecture. Original image sample x and reconstructed image sample x. After adjusting the channels using a 3×3 convolutional layer, the image dimensionality is gradually reduced by alternately stacking multiple MV2 inverted residual blocks and K-ViT blocks. Specifically, features are extracted from the inverted residual blocks of the MV2 module to obtain a dimensionality-reduced feature map sequence. Then, the K-ViT block module is used to serialize the dimensionality-reduced feature map into pixel blocks and establish global dependencies. Finally, an adaptive pooling layer compresses the spatial dimension, and a fully connected layer maps the features into the vectors required for normal and abnormal binary classification. The Sigmoid activation function outputs the probability of a sample being "true" or "false". A result of "true" represents the original, real image, and a result of "false" represents the reconstructed image generated by the generator.
[0081] During LT-GAN training, the generator aims to produce realistic reconstructed spectrograms. The discriminator distinguishes between the input real image x and the reconstructed image generated by the generator. This maximizes the accuracy of recognizing real images. Ultimately, the adversarial supervision of the discriminator helps the generator fit the latent distribution of normal data more closely, causing anomalous samples to produce significant errors during reconstruction due to deviations from this distribution, thus providing a basis for subsequent anomaly detection.
[0082] The training process and loss function design of the LT-GAN model are as follows:
[0083] (1) Reconstruction loss The reconstruction loss measures the difference between the generated spectrogram and the true input spectrogram by calculating the pixel-level L1 distance between the input image and the reconstructed image by the generator. This loss ensures that the generator network can accurately reconstruct the features of the input spectrogram. The formula for calculating the reconstruction loss is as follows:
[0084]
[0085] in, The original sample, i.e., the input image, To reconstruct the sample, i.e., to rebuild the image, Indicates from data distribution The input x is sampled and the expected L1 value of the difference between the original sample and the reconstructed sample is calculated.
[0086] (2) Generator loss Reconstructing the spectrum Through the second encoder in the generator network Obtain the latent representation of the reconstructed image By calculating the latent representation of the original image in the generator. With the latent representation of the reconstructed image The generator loss can be obtained by calculating the L2 distance, as shown in the following formula:
[0087]
[0088] in, The latent space of the encoder output, i.e., the latent representation , The generator network outputs a latent space, i.e., a latent representation. , Indicates from data distribution Medium sampling input And calculate the expected L2 value of the difference between the latent representation of the first encoder output and the latent representation of the second encoder output.
[0089] (3) Combating losses Adversarial loss is used to make the response of the generated image in the discriminator closer to the response of the real image, thereby improving the realism of the generated image. In the LT-GAN model, adversarial loss is used by the discriminator to evaluate the realism of the spectrogram generated by the generator. The formula for calculating adversarial loss is as follows:
[0090]
[0091] in, The output of the discriminator, To obtain data distribution The discriminator output expectation of the medium-sampled input x, Indicates from data distribution Medium sampling input And calculate the expected L2 value of the difference between the corresponding discriminator output and the discriminator output expectation.
[0092] Total loss : , , These are the reconstruction loss coefficient, generator loss coefficient, and adversarial loss coefficient, respectively. They adjust the impact of their respective losses on the total loss. The formula for calculating the total loss is as follows:
[0093]
[0094] in, , , These are the reconstruction loss coefficient, generator loss coefficient, and adversarial loss coefficient, respectively.
[0095] (5) Discriminator loss The discriminator's loss function is based on binary cross-entropy loss. The discriminator needs to classify real images as real and images reconstructed by the generator as fake. This is achieved by minimizing... The discriminator learns how to distinguish between real and generated images. The formula for calculating the discriminator loss is as follows:
[0096]
[0097] in Original sample The discriminator output, To reconstruct samples The discriminator output, Indicates from data distribution Medium sampling input The expected value of the L1 value output by the corresponding discriminator. Indicates from data distribution Medium sampling input The expected L1 value output by the corresponding discriminator.
[0098] During the training of the LT-GAN model, the generator network and the discriminator are trained alternately. Each time the generator network is trained, the input image is randomly extracted from the Mel spectrogram of the historical voiceprint data and input into the generator network. Then, the generator network is forward propagated to obtain the first latent representation, the reconstructed image and the second latent representation of the input image. According to formulas (1) to (4), the loss function of the generator network is calculated based on the input image and the corresponding first latent representation, reconstructed image, second latent representation and the feature extraction results of the discriminator on the input image and the reconstructed image after the previous alternating training. The parameters of the generator network are updated according to the loss function of the generator network.
[0099] Each time the discriminator is trained, the reconstructed image of the generator network after this alternating training and the corresponding input image are input into the discriminator for forward propagation. According to formula (5), the feature extraction results of the input image and the reconstructed image are obtained and the loss function of the discriminator is calculated. The parameters of the discriminator are updated according to the loss function of the discriminator.
[0100] The training process for the LT-GAN model is shown in Table 2:
[0101] Table 2 Training process of LT-GAN model
[0102]
[0103] During training, the LT-GAN model requires setting multiple hyperparameters to adjust its performance. These include the latent space dimension, the number of K-ViT stacks (L), the size of the segmented image patches in K-ViT, the learning rates of the generator and discriminator, the expansion factors of the MV2 and D-MV2 modules, and the number of training iterations. The selection of these hyperparameters significantly impacts the training and performance of the LT-GAN model. In this embodiment, the latent space dimension is set to 1000 dimensions to ensure sufficient representation of voiceprint features. Regarding the network structure, the K-ViT module employs a two-layer stacked architecture, internally segmenting the feature map into 2×2 non-overlapping image patches for local attention calculation. A symmetric learning rate strategy is used during model training, with the learning rates for both the generator and discriminator set to 0.0002 to ensure the stability of adversarial training. Both the MV2 and D-MV2 modules are configured with an expansion factor of 4 to maintain feature representation capability while controlling model complexity. The training process consists of 100 rounds, with the dataset divided into training and test sets in an 8:2 ratio. The hyperparameter settings used are shown in Table 3:
[0104] Table 3. Hyperparameter settings for the LT-GAN model
[0105]
[0106] After training, the model determines whether an input spectrogram is abnormal by calculating an anomaly score for each input spectrogram. For a given Mel spectrogram input, it is first mapped into the latent space by an encoder to obtain latent variables. Then, a generator is used to generate a reconstructed spectrogram from the latent variables. The L1 error between the reconstructed spectrogram and the original input is used as the anomaly score. Its calculation formula is as follows:
[0107]
[0108] in, It is the anomaly score of the input Mel spectrogram. For the original sample, For sample reconstruction, since normal samples are used during training, the model can reconstruct well with small reconstruction errors and low anomaly scores when normal samples are input under the current weight parameters. However, when the model reconstructs abnormal samples or samples without abnormalities in the dataset using the weight parameters of normal samples, the reconstruction error is large and the anomaly score is low. Therefore, the larger the anomaly score, the greater the difference between the reconstructed spectrogram and the original input, indicating that the input spectrogram has abnormal or non-normal characteristics. Regarding threshold selection, the model sets the threshold by calculating the maximum difference between the true positive rate and the false positive rate to maximize the classifier's discriminative ability. In practical applications, the threshold can be adjusted to mark samples exceeding the threshold as anomalies, thereby identifying problematic acoustic signals from power equipment. The LT-GAN training and anomaly detection process is as follows: Figure 9 As shown.
[0109] The superiority of the LT-GAN model will be verified below.
[0110] For the problem of detecting abnormal acoustic signatures in converter valves, ROC curves, AUC, and p-AUC are used to measure the anomaly detection performance of the model.
[0111] ROC curve (Receiver Operating Characteristic Curve): The ROC curve is a graphical tool used to evaluate the performance of binary classification models. The horizontal axis represents the false positive rate (FPR), and the vertical axis represents the true positive rate (TPR). The ROC curve can show the trade-off between the true positive rate and the false positive rate of the model at different thresholds.
[0112] AUC (Area Under Curve): AUC represents the area under the ROC curve and is an overall metric used to measure the classification performance of a model. The value of AUC ranges from 0.5 to 1. In anomaly detection tasks, the closer the AUC value is to 1, the stronger the model's ability to distinguish between normal and abnormal samples, and the better its detection accuracy.
[0113] p-AUC (Partial Area Under Curve): p-AUC is the area under the ROC curve, used to evaluate the model's performance at low false positive rates (FPR). In anomaly detection tasks, a larger p-AUC value indicates better model detection performance at low FPR, and a more accurate ability to identify anomalous samples. Furthermore, different FPR values are set to evaluate the model's performance in different FPR regions.
[0114] In addition, three metrics—number of parameters, computational cost, and model size—are used to measure the complexity of the model.
[0115] Number of parameters: The number of parameters refers to the total number of all trainable parameters in the model.
[0116] Computational complexity: Computational complexity refers to the number of floating-point operations (FLOPs) required by the model during inference. It measures the computational complexity of the model. The higher the FLOPs, the longer the model takes for inference, and the higher the computational power required by the hardware.
[0117] Model size: Model size refers to the amount of space occupied by model parameters during storage. On mobile or embedded devices, model size is an important limiting factor, directly affecting the storage space of model files.
[0118] from Figure 12 As can be seen, the ROC curve of the LT-GAN model is higher than that of other models. At the same false positive rate, the AUC value of the LT-GAN model is higher, indicating that the LT-GAN model has better performance. Furthermore, the three unsupervised models—LT-GAN, f-AnoGAN, and GANomaly—outperform the two supervised models—Mobilevit and ViT. This suggests that when facing the problem of imbalanced data, unsupervised models trained only on normal voiceprint data are more advantageous in handling anomaly detection tasks.
[0119] According to the experimental results in Table 4, the AUC values of the LT-GAN model were 0.9792, 0.9795, 0.9811, and 0.9826 for the four different datasets, all of which were optimal. The LT-GAN model exhibited high performance in the AUC metric, indicating its good ability to detect acoustic anomalies, which helps to promptly identify potential problems and faults in the converter valve. Furthermore, as the load on the converter valve gradually increased from datasets 1 to 4, the generated abnormal acoustic signatures became more significant. Therefore, the AUC metrics of each model generally showed an increasing trend, and the gap between the LT-GAN model and the f-AnoGAN and GANomaly models also decreased.
[0120] Table 4 Comparison of AUC results for different models
[0121]
[0122] According to the experimental results in Table 5, LT-GAN performed excellently across all three FPR ranges, especially achieving a pAUC value of 0.9295 in the [0, 0.1] range, indicating that it maintains extremely high classification accuracy even with strict control over false positives. In contrast, ViT and MobileViT, both supervised learning models, performed poorly when trained with only a small amount of outlier data. This suggests that their classification ability is weak in the low FPR range. Overall, LT-GAN demonstrated the best performance in the low FPR range, making it suitable for the task of detecting acoustic anomalies in converter valves.
[0123] Table 5 Comparison of p-AUC results for different models
[0124]
[0125] As shown in Table 6, the K-ViT block and MV2 / D-MV2 structures of the LT-GAN model enable it to maintain high accuracy while achieving lightweight design. The LT-GAN model's params, FLOPs, and model size are 9.626M, 0.506GFLOPs, and 37.48MB, respectively. The LT-GAN model uses a depthwise separable convolution and inverse residual structure similar to the MobileViT model to reduce model complexity. Because the LT-GAN model has a generator network and a discriminator structure, its three complexity parameters are larger than those of the MobileViT model. However, compared to f-AnoGAN, ANomaly, and ViT models, the LT-GAN model exhibits a certain lightweight advantage and can adapt to the objective situation of insufficient hardware conditions in converter valve anomaly detection equipment.
[0126] Table 6. Comparison of Complexity of Different Models
[0127]
[0128] To verify the effectiveness of each module of LT-GAN, an ablation experiment was designed for this purpose. The LT-GAN model was compared with a model using a regular convolutional structure without KAN layers (Model1), a model using a regular convolutional structure with KAN layers (Model2), and a lightweight model without KAN layers (Model3).
[0129] from Figure 13 As can be seen, the ROC curve of the LT-GAN model is higher than that of other models. At the same false positive rate, the AUC values of Model1, Model2, and Model3 models show a significant decrease. This indicates that the LT-GAN model, which incorporates the K-ViT block and the lightweight structures MV2 and D-MV2, exhibits better performance.
[0130] The AUC results from the ablation experiments in Table 7 show that the average AUC of the models decreased by 2.47% and 1.26% respectively after omitting the lightweight structure and the K-ViT block. Model1, with its ordinary convolutional structure and without KAN layers, had the lowest AUC across all four datasets. This validates the crucial roles of the MV2 and D-MV2 lightweight structures and the K-ViT block in performance optimization.
[0131] Table 7 Comparison of AUC results in ablation experiments
[0132]
[0133] In the p-AUC results in Table 8, the LT-GAN model performed best in the FPR ranges of [0, 0.1] and [0, 0.3], with scores of 0.9295 and 0.9559, respectively. In the FPR range of [0, 0.2], it performed 0.46% worse than Model 3. This is because the original CNN encoder in GANomaly retains more high-frequency details through shallow convolutions, while the deep separating convolutions used in the LT-GAN model lose some local information due to channel compression. This results in a relatively insufficient response to low-contrast anomalies in the low false positive range of [0, 0.2]. In the FPR range of [0, 0.3], the model relies on a balance between global and local features. The hybrid structure design of convolutional layers and K-ViT block modules used in the LT-GAN model shows a significant advantage in global context modeling.
[0134] Table 8 Comparison of p-AUC results in ablation experiments
[0135]
[0136] Table 9 demonstrates that the lightweight structures MV2 and D-MV2 maintain high anomaly detection accuracy while reducing network complexity. This indicates that MV2 and D-MV2 play a crucial role in balancing model complexity and performance. Comparing Model 1 and Model 3, the use of lightweight structures significantly reduces the number of parameters, computational cost, and model size. Comparing Model 1 and Model 2, detection accuracy is significantly improved, but the impact on overall complexity is relatively small. Because the attention mechanism of the K-ViT block module is the computational bottleneck, KAN only optimizes the locally linear layers.
[0137] Table 9 Comparison of Ablation Experiment Complexity
[0138]
[0139] Ablation experiments demonstrate that the K-ViT block and the two lightweight structures, MV2 and D-MV2, are core components of the LT-GAN method, collectively improving model accuracy and reducing model complexity. The ablation experiments further prove the necessity of these modules and the superiority of the LT-GAN framework in the task of detecting acoustic anomalies in converter valves.
[0140] In summary, this invention proposes a method and system for anomaly detection in UHV converter valves based on a lightweight Transformer generative adversarial network (LT-GAN), providing an efficient solution for acoustic anomaly detection in UHV converter valves. By introducing K-ViT blocks and two lightweight structures, MV2 and D-MV2, the LT-GAN model exhibits advantages in high detection accuracy and low complexity. Experimental results show that the LT-GAN model significantly outperforms other benchmark models in both AUC and p-AUC metrics, enabling accurate anomaly identification under complex operating conditions. Furthermore, the low complexity of the LT-GAN model allows it to complete anomaly detection tasks even with limited hardware resources.
[0141] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principle of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method for anomaly detection in converter valves based on a lightweight Transformer generative adversarial network, characterized in that... This includes the following steps: Acquire historical acoustic data of the operation of the UHV converter valve and convert the historical acoustic data into a Mel spectrum. The historical acoustic data includes acoustic data under normal operation and under potential abnormal conditions. The Mel spectrogram of historical voiceprint data is input into a lightweight Transformer generative adversarial network for model training to obtain a trained model. The lightweight Transformer generative adversarial network includes a generator network and a discriminator. During model training, the generator network reconstructs images with the goal of generating images whose source cannot be distinguished by the discriminator as much as possible. The discriminator receives the original image and the reconstructed image and distinguishes them with the goal of determining as accurately as possible whether the input image is a voiceprint spectrogram generated by the normal operation of the converter valve. The trained model uses the generator network to reconstruct the input original image to obtain a reconstructed image. The anomaly score between the reconstructed image and the corresponding original image is calculated. If the anomaly score is greater than a preset threshold, an anomaly is detected. The generator network includes a first encoder, a decoder, and a second encoder. The first encoder, second encoder, and discriminator each include multiple alternately stacked MV2 modules and K-ViT block modules. The decoder includes multiple alternately stacked D-MV2 modules and K-ViT block modules. The MV2 module uses an inverted residual structure, performing dimensionality upscaling on the image tensor through a 1×1 convolution, followed by feature extraction through a 3×3 depthwise separable convolution, and then dimensionality reduction through a 1×1 convolution to obtain a feature map. The D-MV2 module performs dimensionality upscaling on the image tensor through a 1×1 convolution, followed by feature extraction through a 2×2 deconvolution, and then dimensionality reduction through a 1×1 convolution to obtain a feature map. The K-ViT... The block module uses multiple KAN convolutions to locally represent the image tensor of the feature map and adjust the channel size. Then, the feature map is divided into 2×2 image blocks and flattened. Each flattened sequence is input into L K-ViT Encoder modules for global modeling. The features are then rearranged back into the original feature map form through a folding operation. Finally, the image features are restored through KAN convolution and image stitching. In the K-ViT Encoder module, the units at the same position in each image block use a multi-head attention mechanism. After converting the acoustic signature data of the UHV converter valve to be detected into the original Mel spectrogram, it is input into the trained model to obtain the anomaly detection results.
2. The method for anomaly detection of converter valves based on lightweight Transformer generative adversarial networks according to claim 1, characterized in that... During model training, the generator network and discriminator are trained alternately. Each time the generator network is trained, an input image is randomly extracted from the Mel spectrogram of historical voiceprint data and input into the generator network for forward propagation. The first encoder downsamples the original input image and maps it to the latent space to obtain a first latent representation. The decoder remaps the first latent representation of the image to a reconstructed image. The second encoder downsamples the reconstructed image again and maps it to the latent space to obtain a second latent representation. The first latent representation, reconstructed image, and second latent representation of the input image are obtained. Based on the input image, the corresponding first latent representation, reconstructed image, second latent representation, and the output of the discriminator after the previous alternating training, the loss function of the generator network is calculated, and the parameters of the generator network are updated according to the loss function. Each time the discriminator is trained, the reconstructed image of the generator network after this alternating training and the corresponding input image are input into the discriminator for forward propagation. The output of the discriminator is obtained, the loss function of the discriminator is calculated, and the parameters of the discriminator are updated according to the loss function.
3. The method for anomaly detection of converter valves based on lightweight Transformer generative adversarial networks according to claim 2, characterized in that... When the first encoder performs downsampling on the input image and maps it to the latent space to obtain a first latent representation, and when the second encoder performs downsampling on the reconstructed image again and maps it to the latent space to obtain a second latent representation, both include: First, a shallow feature map with a resolution of 128×128 is extracted through a 3×3 standard convolutional layer to capture local texture details. Then, the inverted residual block of the MV2 module is used to extract features to obtain a dimensionality-reduced feature map sequence. Next, the K-ViT block module is used to serialize the feature map into pixel blocks and establish global dependencies. Finally, the spatial dimension is compressed through an adaptive average pooling layer, and then flattened and mapped to a low-dimensional latent space through a fully connected layer.
4. The method for anomaly detection of converter valves based on lightweight Transformer generative adversarial networks according to claim 2, characterized in that... The discriminator receives and distinguishes between the original image and the reconstructed image, including the following steps: After adjusting the channels of the original and reconstructed images through 3×3 convolutional layers, the image dimensionality is gradually reduced by alternately stacking MV2 inverted residual blocks and K-ViT blocks. Specifically, features are extracted by the inverted residual blocks of the MV2 module to obtain a dimensionality-reduced feature map sequence. Then, the K-ViT block module is used to serialize the feature map into pixel blocks and establish global dependencies. Finally, the spatial dimension is compressed by an adaptive pooling layer and then input into a fully connected layer to map the features into the vectors required for normal and abnormal binary classification. The Sigmoid activation function outputs the probability of the classification result being "true" or "false". A classification result of "true" represents the real original image, and a classification result of "false" represents the reconstructed image reconstructed by the generator network.
5. The method for anomaly detection of converter valves based on lightweight Transformer generative adversarial networks according to claim 2, characterized in that... When the decoder remaps the first latent representation of the image to the reconstructed image, it includes: The first latent representation is adjusted in tensor size by a 1×1 standard convolutional layer, then upsampled by stacking D-MV2 modules, and then serialized into pixel blocks using K-ViT block modules to establish global dependencies, thereby gradually restoring the sample size to obtain the reconstructed image.
6. The method for anomaly detection of converter valves based on lightweight Transformer generative adversarial networks according to claim 2, characterized in that... The loss function of the generator network is as follows: in, , , These are the reconstruction loss coefficient, generator network loss coefficient, and adversarial loss coefficient, respectively. The reconstruction loss is calculated using the following formula: in, For the original sample, To reconstruct the sample, Indicates from data distribution The sampled input x is used to calculate the expected L1 value of the difference between the original sample and the reconstructed sample. The generator network loss is calculated using the following formula: in, For the first potential representation, For the second potential representation, Indicates from data distribution Medium sampling input And calculate the expected L2 value of the difference between the corresponding first latent representation and the second latent representation; To mitigate losses, the calculation formula is as follows: in, This represents the output of the discriminator to the input image x. To obtain data distribution The discriminator output expectation of the medium-sampled input x, Indicates from data distribution Medium sampling input And calculate the expected L2 value of the difference between the corresponding discriminator output and the discriminator output expectation.
7. The method for anomaly detection of converter valves based on lightweight Transformer generative adversarial networks according to claim 2, characterized in that... The loss function of the discriminator is as follows: in, The discriminator output is for the original sample. To reconstruct the discriminator output of the sample, Indicates from data distribution Medium sampling input The expected value of the L1 value output by the corresponding discriminator. Indicates from data distribution Medium sampling input The expected L1 value output by the corresponding discriminator.
8. The method for anomaly detection of converter valves based on lightweight Transformer generative adversarial networks according to claim 1, characterized in that... When calculating the anomaly score between the reconstructed image and the corresponding original image, the L1 error between the reconstructed spectrogram and the corresponding original Mel spectrogram is specifically used as the anomaly score. The calculation formula is as follows: in, It is the anomaly score of the input Mel spectrogram. For the original sample, To reconstruct the sample.
9. A converter valve anomaly detection system based on lightweight Transformer generative adversarial network, characterized in that, The device includes a processor and a computer-readable storage medium storing a computer program, which is executed by the processor to implement the steps of the generative adversarial network converter valve anomaly detection method based on lightweight Transformer as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for anomaly detection of converter valves based on a lightweight Transformer generative adversarial network as described in any one of claims 1 to 8.