Transformer Sound Anomaly Detection Method Based on Sample Generation and Sequence Alignment
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-04
- Publication Date
- 2026-08-11
AI Technical Summary
基于统计量的检测比较正常序列和异常序列统计信息,实现简单但检测效果受统计量区分度的影响较大
[0024]This invention employs an autoencoder to learn normal sound signals, and then utilizes the model's weak predictive ability for abnormal sound signals to detect them, thus avoiding the inconvenience of manually collecting and labeling abnormal sound signals. Furthermore, considering the time insensitivity of the autoencoder, a sequence alignment method is proposed to address the potential time delay effect in the autoencoder output.
Smart Images

Figure CN116110428B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electrical equipment maintenance technology, and more specifically, to a method for detecting abnormal sound in transformers based on sample generation and sequence alignment. Background Technology
[0002] Transformer acoustic signal detection has attracted considerable attention due to its advantages such as no electrical contact, simple implementation, and online detection capabilities. Acoustic signals can be applied to transformer anomaly detection, fault identification, and fault location. Among these, the implementation of sound anomaly detection is the foundation of transformer acoustic signal detection and a prerequisite for subsequent fault identification and location.
[0003] Supervised learning has proven effective in fault detection, but acquiring and labeling abnormal signals is extremely difficult in many scenarios. Take transformer sound anomaly detection as an example: because the probability of transformer failure is extremely low, the collected sound is primarily normal, with abnormal sounds accounting for a very small proportion. Furthermore, manual labeling is challenging. Therefore, semi-supervised and unsupervised learning are currently the main research directions for anomaly recognition.
[0004] Anomaly detection methods for sound include: statistical detection, classification-based detection, and generative detection. Statistical detection compares the statistical information of normal and abnormal sequences; it is simple to implement, but its detection performance is greatly affected by the discriminative power of the statistics. Classification-based detection typically trains a classifier to recognize normal samples; this method detects abnormal samples by defining the boundaries of normal samples. Generative detection learns from normal samples to regenerate approximate samples; it can detect abnormal samples by utilizing information that the model cannot effectively generate. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the purpose of this invention is to provide a transformer sound anomaly detection method based on sample generation and sequence alignment.
[0006] In a first aspect, this application provides a transformer sound anomaly detection method based on sample generation and sequence alignment, including:
[0007] Step 1: Perform frame segmentation on the sampled audio sequence to obtain a time series, and divide the time series into a training set and a test set;
[0008] Step 2: Use the training set as input samples to train the autoencoder and obtain the trained autoencoder;
[0009] Step 3: Use the test set as input to the trained autoencoder, output the predicted sequence, and perform delay correction on the time series in the test set and the predicted sequence to align the test sequence with the predicted sequence.
[0010] Step 4: Evaluate the error between the test sequence and the predicted sequence to identify abnormal signals.
[0011] Optionally, in step 1, the frames for the training set are divided using an overlapping method, while the frames for the test set are divided using a non-overlapping method.
[0012] Optionally, step 3 includes:
[0013] Step 3.1: Perform three-level clipping on the time series and prediction sequence of the test set respectively;
[0014] Step 3.2: Select time series and prediction sequences of preset length in the test set, and convert each sequence into a three-level sequence with values of -1, 0, and 1 using a clipping function;
[0015] Step 3.3: Determine the number of sampling points in the test set that lead or lag the predicted sequence in terms of time series;
[0016] Step 3.4: When the time series in the test set is ahead, take the sequence with the same length as the number of ahead sampling points at the end of the predicted sequence, reverse the sequence and add it to the beginning; when the time series in the test set is lagging, take the sequence with the same length as the number of lagging sampling points at the beginning of the predicted sequence, reverse the sequence and add it to the end.
[0017] Optionally, step 4 includes:
[0018] Step 4.1: Assume the mean of a normal signal is μ and the variance is σ; if the amplitude of the signal is less than μ-3σ or greater than μ+3σ, the signal is considered abnormal; if the amplitude of the signal is not less than μ-3σ and not greater than μ+3σ, the signal is considered normal.
[0019] Step 4.2: Set the normal signal to 0 and the abnormal signal to 1;
[0020] Step 4.3: Detect the start and end times of the abnormal signal to obtain the time period of the abnormal signal.
[0021] Secondly, embodiments of this application provide a transformer sound anomaly detection device based on sample generation and sequence alignment, comprising: a processor and a memory, wherein the memory stores executable program instructions, and when the processor invokes the program instructions in the memory, the processor is used to:
[0022] Perform the steps of the transformer sound anomaly detection method based on sample generation and sequence alignment as described in any one of the first aspects.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] This invention employs an autoencoder to learn normal sound signals, and then utilizes the model's weak predictive ability for abnormal sound signals to detect them, thus avoiding the inconvenience of manually collecting and labeling abnormal sound signals. Furthermore, considering the time insensitivity of the autoencoder, a sequence alignment method is proposed to address the potential time delay effect in the autoencoder output. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort. Other features, objects, and advantages of the present invention will become more apparent by reading the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0026] Figure 1 This is a flowchart illustrating a transformer sound anomaly detection method based on sample generation and sequence alignment provided in an embodiment of this application.
[0027] Figure 2 This is a schematic diagram of the framework structure of the self-encoder provided in the embodiments of this application. Detailed Implementation
[0028] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention. These all fall within the scope of protection of the present invention.
[0029] It should be noted that when a component is referred to as "fixed to" or "set on" another component, it can be directly on or indirectly on that other component. When a component is referred to as "connected to" another component, it can be directly connected to or indirectly connected to that other component. Furthermore, a connection can be for both fixing and circuit connection purposes.
[0030] It should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", and "outer" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the embodiments of the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the present invention.
[0031] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of embodiments of the present invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0032] In existing technologies, conditional anomaly detection is used to check for abnormal partial discharges. Conditional anomaly detection constructs two Gaussian mixture models to fit environmental data and sensor data, respectively. However, Gaussian mixture models cannot utilize the contextual relationships of the data and are greatly affected by the initial values, which may only find local optima.
[0033] If we first extract the time-frequency domain features of the signal and then use a Long Short-Term Memory (LSTM) network to achieve anomaly detection, the time-frequency domain features are manually selected features, and the generality of this feature extraction is poor. Autoencoders are also often used for dimensionality reduction and feature extraction because of their excellent data fitting ability.
[0034] Borrowing from the structure of autoencoders, LSTM is used to replace the encoder and decoder parts of the autoencoder. However, LSTM training is computationally expensive and cannot be used for real-time detection. Concatenating two autoencoders to build a new model shows higher precision, recall, and F1 score, but it does not solve the time insensitivity problem of autoencoders. Because the latent variables of autoencoders are not easily interpreted, variational autoencoders were proposed to normalize the spatial distribution of latent variables. Subsequently, variational autoencoders have also been used in anomaly detection, but the problems of time insensitivity and poor robustness still need to be addressed.
[0035] To address the problems existing in current technologies, this application mainly studies unsupervised learning for detecting transformer anomalies. Since autoencoders are common in unsupervised learning, this application uses an autoencoder to detect anomalies and improves the model to form an aligned autoencoder. To address the time insensitivity of autoencoders, the model is trained using overlapping frames, and a sequence alignment method is introduced to align the output and input. To address the weak robustness of autoencoders, Huber loss is used instead of the commonly used mean squared error, and a hybrid activation function is used instead of a single ReLU function. Experimental results show that the aligned autoencoder in this application not only effectively avoids the time delay effect in model output but also improves training speed and anomaly detection accuracy.
[0036] The transformer sound anomaly detection method based on sample generation and sequence alignment provided in this application mainly addresses the difficulty in obtaining abnormal samples. In the embodiments of this application, an autoencoder is used to learn normal sound signals, and then the weak predictive ability of the model for abnormal sound signals is utilized to detect the abnormal sound signals, thereby avoiding the inconvenience of manually collecting and labeling abnormal sound signals. Furthermore, considering the time insensitivity of the autoencoder, a sequence alignment method is proposed to address the potential time delay effect in the autoencoder output.
[0037] This application provides a transformer sound anomaly detection method based on sample generation and sequence alignment, which may include the following steps:
[0038] Step 1: Perform frame segmentation on the sampled audio sequence to obtain a time series, and divide the time series into a training set and a test set.
[0039] In this embodiment, because the sampled audio sequence is generally very long, it cannot be directly trained using a neural network. Therefore, frame segmentation of the audio sequence can divide the long sequence into shorter sequences, thereby constructing a time series matrix.
[0040] For example, suppose we have a time series s = [s1, s2, ..., s...]. N First, divide s into training sets s train and test set s test , where s train =[s1,s2,…,s p ](1 <p<N),s test =[s p+1 ,s p+2 ,…,s N N is a natural number greater than 1, representing the total number of samples. Since the purpose of the training set is to enable the model to learn the key features of the data as much as possible, while the purpose of the test set is to provide the model's prediction results as quickly as possible, the training set is frame-overlapping, while the test set is frame-separated but not overlapping.
[0041] Step 2: Use the training set as input samples to train the autoencoder and obtain the trained autoencoder.
[0042] In this embodiment, transformer fault detection often relies on multiple signals, especially the processing and analysis of abnormal signals. Traditional statistical methods do not require a large amount of sample data, but they need to make assumptions about the distribution of the samples, which limits the accuracy of fault detection. With the rise of artificial intelligence, neural networks are gradually being used to achieve fault detection. However, existing fault detection methods rely on a large number of abnormal samples, so this paper mainly studies the automatic acquisition of acoustic signals, especially abnormal acoustic signals.
[0043] As an unsupervised learning network, autoencoders are widely used in feature extraction, signal denoising, and anomaly detection. An autoencoder consists of two parts: an encoder and a decoder. The encoder reduces the dimensionality of the input signal by mapping it from a high-dimensional space to a low-dimensional space, while the decoder increases the dimensionality of the input signal by mapping it from a low-dimensional space to a high-dimensional space. The framework of an autoencoder is as follows: Figure 1 As shown.
[0044] Figure 2 In the diagram, circles represent neurons, the first trapezoid represents the hidden layer of the encoder, and the second trapezoid represents the hidden layer of the decoder. The lowest-dimensional network layer in the encoder is called the hidden layer. After constructing the framework of the autoencoder, we need to further discuss the internal structure of the model.
[0045] There is a sample X n×m =[x1,x2,…,x m ], where x i =[x 1i ,x 2i ,…,x ni ] T (1≤i≤m). Let Then the input X1 of the autoencoder is [x ′ 1,x ′ 2,…,x ′ n Let the encoder have N1 layers, and the weights of the first layer (actually a matrix composed of neuron weights and biases, referred to here simply as weights) be W. e1 The output is Z1, and the weights of the N1-th layer are... The output is the latent variable Z; the decoder has N² layers, and the weights of the first layer are W. d1 The output is Y1, and the weights of the last layer of the network are... The output is Y. Therefore, we have...
[0046]
[0047]
[0048]
[0049]
[0050] Where: T is the transpose symbol. This represents the output of the encoder's (N1-1)th layer. This represents the output of the decoder at layer N2-1.
[0051] In equations (3) and (4), f() and g() are both activation functions. f() is taken as ReLU or LeakReLU, and g() is taken as Tanh. Their expressions are as follows:
[0052]
[0053]
[0054] Where x represents the value of the output vector of the neuron without an activation function. In equation (6), α∈(0,1), and α is generally taken as 0.01. When α=0, equation (6) degenerates into equation (5).
[0055] The traditional loss function is often chosen as the mean squared error (MSE), with x as the input. i (1≤i≤n), the output is y i When the i-th input is selected, the MSE is defined as follows:
[0056]
[0057] Where: m represents the sample size, x ij Let y represent the j-th number of the i-th sample to be output. ij This represents the j-th number of the i-th sample in the actual output.
[0058] However, when outliers exist in the input, their contribution to the Mean Absolute Error (MSE) is significant, leading to substantial bias in the model's predictions of the samples. To reduce the impact of outliers, the Huber loss is formed by combining MSE and Mean Absolute Error (MAE). The definition of this loss function is as follows:
[0059]
[0060] In equation (9), δ is the threshold of the loss function, which is 1 by default.
[0061] Step 3: Use the test set as input to the trained autoencoder, output the predicted sequence, and perform delay correction on the time series in the test set and the predicted sequence to align the test sequence with the predicted sequence.
[0062] In this embodiment, step 3 may include:
[0063] Step 3.1: Perform three-level clipping on the time series and prediction sequence of the test set respectively;
[0064] Step 3.2: Select time series and prediction sequences of preset length in the test set, and convert each sequence into a three-level sequence with values of -1, 0, and 1 using a clipping function;
[0065] Step 3.3: Determine the number of sampling points in the test set that lead or lag the predicted sequence in terms of time series;
[0066] Step 3.4: When the time series in the test set is ahead, take the sequence with the same length as the number of ahead sampling points at the end of the predicted sequence, reverse the sequence and add it to the beginning; when the time series in the test set is lagging, take the sequence with the same length as the number of lagging sampling points at the beginning of the predicted sequence, reverse the sequence and add it to the end.
[0067] For example, the time delay effect during autoencoder prediction can affect the alignment of the original sequence and the predicted sequence. In severe cases, it can lead to the failure to detect anomalies or deviations between the detected anomaly time segments and the actual situation. Therefore, it is necessary to achieve sequence alignment by correcting the time delay.
[0068] The delay correction method includes two steps: delay detection and sequence cycle delay alignment. Delay detection obtains the delays of the original sequence and the predicted sequence, while sequence delay alignment uses the estimated delay to move and splice the beginning and end of the predicted sequence. To reduce the computational load of delay detection, the test sequence and the predicted sequence are first subjected to three-level clipping. The clipping function is as follows:
[0069]
[0070] In equation (10), x represents a sample point of the test sequence or the prediction sequence. T Indicates the level selection threshold, x T ∈(0,0.5).
[0071] After determining the clipping function, the time delay correction steps are as follows:
[0072] 1) Select a test sequence and a prediction sequence of a certain length, and use a clipping function to convert them into a three-level sequence with values of -1, 0, and 1;
[0073] 2) Calculate the time delay of the transformed sequence, i.e., how many sampling points the test sequence leads or lags the prediction sequence by;
[0074] 3) When the test sequence is ahead, take the sequence with the same length as the number of ahead sampling points at the end of the predicted sequence, reverse the sequence and add it to the beginning; when the test sequence is behind, take the sequence with the same length as the number of behind sampling points at the beginning of the predicted sequence, reverse the sequence and add it to the end.
[0075] 4) Recalculate the absolute values of the absolute errors of the original sequence and the predicted sequence.
[0076] Step 4: Evaluate the error between the test sequence and the predicted sequence to identify abnormal signals.
[0077] In this embodiment, step 4 may include:
[0078] Step 4.1: Assume the mean of a normal signal is μ and the variance is σ; if the amplitude of the signal is less than μ-3σ or greater than μ+3σ, the signal is considered abnormal; if the amplitude of the signal is not less than μ-3σ and not greater than μ+3σ, the signal is considered normal.
[0079] Step 4.2: Set the normal signal to 0 and the abnormal signal to 1;
[0080] Step 4.3: Detect the start and end times of the abnormal signal to obtain the time period of the abnormal signal.
[0081] For example, although the characteristics of the abnormal signal in the detected signal are already quite obvious, it is necessary to further define the abnormal signal in order to determine the start and end times of the abnormal signal.
[0082] Let the mean of the normal signal be μ and the variance be σ. The "3σ" criterion is used to judge abnormal signals: if the amplitude of the signal is less than μ-3σ or greater than μ+3σ, the signal is considered abnormal. In actual operation, the normal signal is set to 0, and the abnormal signal is set to 1. Then, the start and end times of the abnormal signal are detected to obtain the final detection result.
[0083] To objectively demonstrate the detection performance of the alignment autoencoder, the following metrics are defined:
[0084]
[0085] In equations (11) and (12), TP represents the number of samples that predict positive examples (abnormal sounds) as positive examples, FP represents the number of samples that predict negative examples (normal sounds) as positive examples, and FN represents the number of samples that predict positive examples as negative examples. P represents precision, and R represents recall.
[0086] In equation (13), IoU (Intersection-over-Union) represents the intersection-over-union ratio, A represents the actual interval of the abnormal sound signal [a1,a2], B represents the predicted interval of the abnormal sound signal [b1,b2], ∩ represents the intersection of two sets, ∪ represents the union of two sets, and A∩B = a2-b1 and A∪B = b2-a1 are defined.
[0087] To distinguish it from F1 scores, F1 is proposed. PRI To comprehensively consider the evaluation effects of P, R, and IoU, the expression is as follows:
[0088]
[0089] In the formula, α and β (α, β ≥ 1 and These are all weighting metrics, used to measure the impact of R and IoU respectively. It is stipulated that when P, R, or IoU is 0, F... PRI =0.
[0090] When α = β = 1, P, R, and IoU have equal importance, and F PRI Let it be F PRI1 Equation (11) simplifies to:
[0091]
[0092] This application also provides a transformer sound anomaly detection device based on sample generation and sequence alignment, which may include a processor and a memory.
[0093] Memory is used to store programs. Memory can include volatile memory, such as random-access memory (RAM), including static random-access memory (SRAM) and double data rate synchronous dynamic random-access memory (DDR SDRAM); it can also include non-volatile memory, such as flash memory. Memory is used to store computer programs (such as application programs and functional modules that implement the above methods), computer instructions, etc., which can be partitioned and stored in one or more memory locations. Furthermore, these computer programs, instructions, and data can be accessed by the processor.
[0094] The aforementioned computer programs, computer instructions, etc., can be stored in partitions within one or more memory locations. Furthermore, the aforementioned computer programs, computer instructions, data, etc., can be accessed by a processor.
[0095] A processor is used to execute a computer program stored in memory to implement the various steps in the methods described in the above embodiments.
[0096] For details, please refer to the relevant descriptions in the preceding method embodiments.
[0097] The processor and memory can be separate structures or integrated structures. When the processor and memory are separate structures, they can be coupled together via a bus.
[0098] The transformer sound anomaly detection device based on sample generation and sequence alignment in this embodiment can execute the technical solution in the above method. For its specific implementation process and technical principle, please refer to the relevant description in the above method, which will not be repeated here.
[0099] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "platform."
[0100] Furthermore, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions. When at least one processor of a user device executes these computer-executable instructions, the user device performs the various possible methods described above. The computer-readable medium includes a computer storage medium and a communication medium, wherein the communication medium includes any medium that facilitates the transfer of a computer program from one location to another. The storage medium can be any available medium accessible to a general-purpose or special-purpose computer. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Additionally, the ASIC can reside in the user device. Alternatively, the processor and storage medium can exist as discrete components in a communication device.
[0101] The above is the core idea of this invention. To make the above-mentioned objectives, features, and advantages of this invention more apparent and understandable, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0102] The various embodiments described in this specification are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0103] The specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various modifications or variations within the scope of the claims, which do not affect the essence of the present invention.
Claims
1. A method for detecting transformer sound anomalies based on sample generation and sequence alignment, characterized in that, include: Step 1: Perform frame segmentation on the sampled audio sequence to obtain a time series, and divide the time series into a training set and a test set; Step 2: Use the training set as input samples to train the autoencoder and obtain the trained autoencoder. The encoder activation function is ReLU or LeakyReLU, the decoder activation function is Tanh, and the loss function is Huber loss function. Step 3: Use the test set as input to the trained autoencoder, output the predicted sequence, and perform delay correction on the time series in the test set and the predicted sequence to align the time series in the test set with the predicted sequence. Step 3 includes: Step 3.1: Perform three-level clipping on the time series and prediction sequence of the test set respectively; Step 3.2: Select time series and prediction sequences of preset length in the test set, and convert each sequence into a three-level sequence with values of -1, 0, and 1 using a clipping function; Step 3.3: Determine the number of sampling points in the test set that lead or lag the predicted sequence in terms of time series; Step 3.4: When the time series in the test set is ahead, take the sequence with the same length as the number of ahead sampling points at the end of the predicted sequence, reverse the sequence and add it to the beginning; when the time series in the test set is lagging, take the sequence with the same length as the number of lagging sampling points at the beginning of the predicted sequence, reverse the sequence and add it to the end. Step 4: Evaluate the errors between the time series and the predicted sequence in the test set to identify anomalous signals; Step 4 includes: Step 4.1: Assume the mean of a normal signal is μ and the variance is σ; if the amplitude of the signal is less than μ-3σ or greater than μ+3σ, the signal is considered abnormal; if the amplitude of the signal is not less than μ-3σ and not greater than μ+3σ, the signal is considered normal. Step 4.2: Set the normal signal to 0 and the abnormal signal to 1; Step 4.3: Detect the start and end times of the abnormal signal to obtain the time period of the abnormal signal.
2. The transformer sound anomaly detection method based on sample generation and sequence alignment according to claim 1, characterized in that, In step 1, the frames for the training set are divided using an overlapping method, while the frames for the test set are divided using a non-overlapping method.
3. A transformer sound anomaly detection device based on sample generation and sequence alignment, characterized in that, include: A processor and a memory, wherein the memory stores executable program instructions, and when the processor invokes the program instructions in the memory, the processor is used to: Perform the steps of the transformer sound anomaly detection method based on sample generation and sequence alignment as described in any one of claims 1-2.
Citation Information
Patent Citations
Industrial scene abnormal sound detection and identification method based on auto-encoder
CN114333773A