A motor equipment abnormal sound detection method based on a transformer level aggregation

By using the Transformer hierarchical aggregation method, the problem of failing to effectively utilize information between different layers in existing technologies is solved, thereby improving the accuracy and feature representation capability of abnormal sound detection in motor equipment.

CN121884858BActive Publication Date: 2026-07-21NANJING UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING UNIV
Filing Date
2026-03-20
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing Transformer models only consider information from the last layer in detecting abnormal sounds from motor equipment, failing to effectively utilize the influence and dependencies between different layers, resulting in low detection accuracy.

Method used

We adopt a Transformer-based hierarchical aggregation method, which fully mines the information of each layer and models cross-layer dependencies by combining feature extraction, preprocessing, multi-stage Transformer representation and global feature aggregation, along with feature representation in time and frequency dimensions, thereby improving detection accuracy.

Benefits of technology

It significantly improves the accuracy of abnormal sound detection in motor equipment, achieving stronger feature representation capabilities and higher classification accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121884858B_ABST
    Figure CN121884858B_ABST
Patent Text Reader

Abstract

The application discloses a motor equipment abnormal sound detection method based on a Transformer hierarchical aggregation, which comprises feature extraction, preprocessing, first-stage Transformer hierarchical representation, second-stage Transformer representation, averaging, compression, splicing, aggregation and classification; the global feature representation of each layer is extracted, the time dimension and the frequency dimension are simultaneously averaged, spliced and compressed, and the average compression features of each layer are obtained; the comprehensive features fusing the multi-layer information are obtained by modeling the cross-layer dependency relationship while the layer features are composed into a hierarchical sequence. The application introduces a two-stage modeling mechanism, fully excavates the shallow local features and the deep global semantic information, and considers the feature expression of the time dimension and the frequency dimension, so that the application has stronger feature expression capability and higher classification precision in the industrial motor equipment abnormal detection task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an industrial equipment testing technology, and more particularly to a method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation. Background Technology

[0002] Electric motors are essential electromechanical devices in modern production and daily life, playing a vital role in the smooth operation of industrial processes and the safe operation of equipment. However, manufactured motors are prone to abnormal conditions, leading to malfunctions and safety hazards. Quickly detecting abnormal equipment can reduce the number of defective products and prevent further damage. The sound of a motor's operation can be used to determine whether it is normal or abnormal. For manual inspection, checking for abnormal sounds and other characteristics would consume a significant amount of human and material resources, while machine identification of abnormal equipment can reduce losses in terms of manpower and finances.

[0003] Common machine learning models used for motor sound classification include RNNs, CNNs, and Transformers. Compared to RNNs and CNNs, Transformers have significant advantages in processing sequence data (such as sound and text), mainly in the following aspects: First, the self-attention mechanism allows it to focus on all positions in the entire sequence, overcoming the disadvantages of RNNs and CNNs in long-range dependencies; second, it has strong parallel computing capabilities and faster training speed; and third, it is efficient inference and has lower computational resource requirements. Due to these advantages, Transformers have been widely used in speech recognition, sound classification, and large-scale dialogue language models (such as ChatGPT and DeepSeek). However, Transformer classification often only considers the information of the last layer, without taking into account the influence and dependencies between different layers, thus reducing accuracy. Summary of the Invention

[0004] Purpose of the invention: The purpose of this invention is to provide a method for detecting abnormal sounds in Transformer-level aggregated motor equipment that can improve detection accuracy.

[0005] Technical solution: The abnormal sound detection method for motor equipment based on Transformer hierarchical aggregation described in this invention includes:

[0006] (1) Feature extraction: Collect the motor's operating domain sound data and process it using the MFCC algorithm to obtain the spectrum feature matrix;

[0007] (2) Preprocessing: Input the spectral feature matrix into the preprocessing fully connected layer and add sinusoidal position coding to obtain the preprocessed feature matrix with added position coding;

[0008] (3) First-stage Transformer hierarchical representation: The preprocessed feature matrix with added position encoding is sequentially input into each layer of the first-stage Transformer to obtain the feature matrix of each layer of the first-stage Transformer;

[0009] (4) Averaging and splicing: Averaging the feature matrix of each layer in terms of time and frequency, and splicing the time and frequency average features of the same layer to obtain the average spliced ​​feature matrix of each layer;

[0010] (5) Compression and splicing: The average spliced ​​features of each layer are compressed by compressing the fully connected layer, spliced ​​again and added with position encoding to obtain the hierarchical feature matrix with position encoding; (6) Second-stage Transformer representation: The hierarchical feature matrix is ​​input into the second-stage Transformer and the second-stage feature matrix is ​​output;

[0011] (7) Global averaging and aggregation: The feature matrices of the second stage are globally averaged and aggregated to obtain the comprehensive feature matrix;

[0012] (8) Classification: Input the comprehensive feature matrix into the classification fully connected layer and output the binary classification result.

[0013] In step (1), the time-domain motor sound data is processed by defining the number of frames n_frame in the Fourier transform of the MFCC and the dimension n_mfcc of the MFCC feature extraction to obtain a spectral feature matrix with shape (n_frame, n_mfcc); the n_frame represents the sequence frame information in the time dimension, and the n_mfcc represents the feature dimension information in the frequency dimension.

[0014] In step (2), after the spectral feature matrix is ​​input into the preprocessed fully connected layer, a preprocessed feature matrix with shape (n_frame, n_hidden) is obtained. After adding position encoding, a preprocessed feature matrix with shape (n_frame, n_hidden) with added position encoding is obtained.

[0015] In step (3), the first-stage Transformer consists of a num_layers layer Transformer encoding structure, with a hidden layer dimension of n_hidden and a multi-head attention head count of num_heads. Each Transformer layer includes a multi-head self-attention mechanism, a feedforward neural network, residual connections, and a layer normalization structure. The preprocessed feature matrix with added position encoding is sequentially input into each layer of the first-stage Transformer to obtain a Transformer feature matrix with an output shape of (n_frame, n_hidden) for each layer. After processing by num_layers layers, a total of num_layers first-stage Transformer feature matrices are obtained.

[0016] In step (4), the feature matrix of each layer is averaged in the time dimension and the frequency dimension to obtain the frequency average feature with shape (1, n_hidden) and the time average feature with shape (1, n_frame). The frequency average feature and the time average feature of the same layer are concatenated to form the Transformer average concatenated feature with shape (1, n_hidden + n_frame). After all layers are processed, a total of num_layers Transformer average concatenated features are obtained.

[0017] In step (5), the compressed fully connected layer sequentially compresses the average stitched features of each Transformer layer from (n_hidden + n_frame) dimensions to n_hidden dimensions through linear transformation, resulting in an average compressed feature of shape (1, n_hidden), resulting in a total of num_layers average compressed features. The num_layers average compressed features are then stitched together to finally obtain the first-stage Transformer layer feature matrix of shape (num_layers, n_hidden).

[0018] In step (6), the second-stage Transformer is structurally consistent with the first-stage Transformer; after the hierarchical feature matrix is ​​input into the second-stage Transformer, a second-stage Transformer feature matrix with shape (num_layers, n_hidden) is obtained.

[0019] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: (1) Through the first stage Transformer hierarchical representation, the global feature representation of each layer is extracted, and the average compressed features of each layer are obtained by averaging, splicing and compression operations on the time dimension and frequency dimension; (2) Through the second stage Transformer representation, the features of the above layers are combined into a hierarchical sequence, and the Transformer structure models the cross-layer dependency relationship, thereby obtaining the comprehensive features that integrate multi-layer information; (3) By introducing a two-stage modeling mechanism on the basis of the traditional Transformer structure, the shallow local features and deep global semantic information are fully explored, while taking into account the feature expression of the time dimension and frequency dimension, which has stronger feature expression ability and higher classification accuracy in the task of abnormal detection of industrial motor equipment. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the principle of the present invention;

[0021] Figure 2 This is a data flow diagram of the present invention. Detailed Implementation

[0022] The technical solution of the present invention will be further described below with reference to the accompanying drawings.

[0023] Example 1

[0024] This embodiment provides a specific implementation step for a method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation. The principle block diagram of this method is as follows: Figure 1 As shown, the data flow diagram is as follows: Figure 2 As shown, the specific process includes:

[0025] (1) Feature Extraction: In feature extraction, Mel Frequency Cepstral Coefficients (MFCC) is a commonly used sound feature extraction method. It extracts useful features that can represent audio signals by mimicking the human ear's perception of sounds at different frequencies. The specific steps are as follows: First, collect time-domain sound data during the operation of an industrial motor. Then, define the number of frames n_frame in the Fourier transform of MFCC and the dimension n_mfcc of MFCC feature extraction. Finally, process the time-domain motor sound data through the MFCC feature extraction algorithm to obtain a spectral feature matrix with shape (n_frame, n_mfcc), where n_frame represents the sequence frame information in the time dimension and n_mfcc represents the feature dimension information in the frequency dimension.

[0026] (2) Preprocessing: The feature matrix of shape (n_frame, n_mfcc) is input into the preprocessing fully connected layer. Through the linear transformation and activation function of this layer, shallow features are extracted to obtain a preprocessed feature matrix of shape (n_frame, n_hidden). Since the Transformer structure itself does not have the ability to model the positional information of the sequence and cannot distinguish the order of features in the time series, sinusoidal positional encoding is added to the above preprocessed feature matrix before inputting it into the Transformer model to explicitly represent the relative positional information of each frame in the sequence. Finally, the preprocessed feature with positional encoding of shape (n_frame, n_hidden) is obtained to ensure that the subsequent model can capture the temporal correlation of the sequence.

[0027] (3) First-stage Transformer hierarchical representation: The preprocessed features with added positional encoding are input into the first-stage Transformer module. This module consists of num_layers layers of Transformer encoding structure, where the hidden layer dimension is n_hidden and the number of multi-head attention heads is num_heads. Each Transformer layer contains a multi-head self-attention mechanism, a feedforward neural network, residual connections, and a layer normalization structure. Since each layer of the Transformer is a sequence-to-sequence mapping structure, and the input feature dimension is consistent with the hidden layer dimension, the output of each layer is a Transformer feature matrix of shape (n_frame, n_hidden). After processing by num_layers layers, a total of num_layers first-stage Transformer feature matrices are obtained.

[0028] (4) Averaging and Concatenation: To fully extract the temporal and frequency information contained in the features of different layers, averaging operations are performed on the feature matrix output by each Transformer layer in both the time and frequency dimensions, resulting in frequency-averaged features with shapes of (1, n_hidden) and time-averaged features with shapes of (1, n_frame). Subsequently, the frequency-averaged features and time-averaged features of the same layer are concatenated to form Transformer averaged concatenated features with shapes of (1, n_hidden + n_frame). After the above processing, a total of num_layers Transformer averaged concatenated features are obtained.

[0029] (5) Compression and Concatenation: Since the time dimension features and the frequency dimension features are in different feature spaces, direct fusion will affect the model performance. In order to achieve a unified representation and effective fusion of the two types of features, a compressed fully connected layer is further introduced. Through linear transformation, the average concatenated features of each Transformer layer are compressed from (n_hidden + n_frame) dimension to n_hidden dimension, resulting in an average compressed feature of shape (1, n_hidden). This yields num_layers first-stage Transformer average compressed features, ensuring that the features of each layer are in the same feature space and have a unified dimension. Subsequently, the above num_layers average compressed features are concatenated along the layer dimension to form a first-stage Transformer layer feature matrix of shape (num_layers, n_hidden). This matrix contains the layer distribution information of each layer feature, and sinusoidal position encoding is added to this feature matrix to represent the layer position information between different network layers.

[0030] (6) Second-stage Transformer representation: The first-stage Transformer hierarchical feature matrix with added hierarchical position encoding is input into the second-stage Transformer module. The second-stage Transformer module is structurally consistent with the first-stage Transformer module. This module takes the hierarchical feature matrix as input, constructs the dependency relationship between different layers through a multi-head self-attention mechanism, and outputs a second-stage Transformer feature matrix of shape (num_layers, n_hidden). This matrix has fully integrated the information of each layer's features and has a stronger feature representation capability.

[0031] (7) Global averaging and aggregation: In order to obtain the final global comprehensive features, the second-stage Transformer feature matrix is ​​globally averaged in the hierarchical dimension, and the features after the fusion of the num_layers layers are further aggregated to obtain a comprehensive feature representation with shape (1, n_hidden).

[0032] (8) Classification: The comprehensive feature representation of (1, n_hidden) is input into the classification fully connected layer, and the binary classification result of industrial motor equipment is output through the activation function to achieve effective differentiation between normal and abnormal states of equipment.

[0033] Example 2

[0034] This embodiment provides a comparative experiment, as follows:

[0035] (1) Preparation of experimental data

[0036] Data source: Industrial test datasets were used. Data was collected in an environment with no background noise. The motor to be tested was placed in the test chamber to avoid interference from external environmental noise on the motor's operating sound signal.

[0037] Data composition: The actual test dataset contains 1016 samples of normal motor operation and 360 samples of abnormal motor operation.

[0038] Data partitioning: The data is divided into training and test sets in an 8:2 ratio. The training set contains 70% normal and abnormal samples; the validation set contains 15% normal and abnormal samples; and the test set contains 15% normal and abnormal samples.

[0039] (2) Parameter setting

[0040] The feature extraction parameters n_frame and n_mfcc are set to 5 and 32 respectively. The parameters of the Transformer in the first and second stages are set as follows: num_heads=2, n_hideen=32, num_layers=3. The preprocessing fully connected layer, the compressed fully connected layer, and the classification fully connected layer are all single fully connected layers. The learning rate of the optimizer Adam is set to 0.0001, the number of iterations is 100 epochs, and the batch size is 64.

[0041] (3) Experimental results and analysis

[0042] Based on the above preparations, the anomaly detection method for industrial motor equipment based on Transformer hierarchical aggregation and the Tansformer anomaly detection method for industrial motor equipment were compared. The accuracy of the anomaly detection method based on Transformer hierarchical aggregation was 97%, while the accuracy of the Tansformer method was 96%. Therefore, the anomaly detection method based on Transformer hierarchical aggregation can fuse features from different layers, thereby effectively improving the accuracy of abnormal sound detection.

Claims

1. A method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation, characterized in that, include: (1) Feature extraction: Collect the motor's operating domain sound data and process it using the MFCC algorithm to obtain the spectrum feature matrix; (2) Preprocessing: Input the spectral feature matrix into the preprocessing fully connected layer and add sinusoidal position coding to obtain the preprocessed feature matrix with added position coding; (3) First-stage Transformer hierarchical representation: The preprocessed feature matrix with added position encoding is sequentially input into each layer of the first-stage Transformer to obtain the feature matrix of each layer of the first-stage Transformer; (4) Averaging and splicing: Averaging the feature matrix of each layer in terms of time and frequency, and splicing the time and frequency average features of the same layer to obtain the average spliced ​​feature matrix of each layer; (5) Compression and splicing: The average splicing features of each layer are compressed by compressing the fully connected layer, splicing them again and adding positional encoding to obtain the layer feature matrix with added positional encoding; (6) Second-stage Transformer representation: Input the hierarchical feature matrix into the second-stage Transformer and output the second-stage feature matrix; (7) Global averaging and aggregation: The feature matrices of the second stage are globally averaged and aggregated to obtain the comprehensive feature matrix; (8) Classification: Input the comprehensive feature matrix into the classification fully connected layer and output the binary classification result.

2. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (1), the time-domain motor sound data is processed by defining the number of frames n_frame in the Fourier transform of the MFCC and the dimension n_mfcc of the MFCC feature extraction to obtain a spectral feature matrix with shape (n_frame, n_mfcc); the n_frame represents the sequence frame information in the time dimension, and the n_mfcc represents the feature dimension information in the frequency dimension.

3. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (2), after the spectral feature matrix is ​​input into the preprocessed fully connected layer, a preprocessed feature matrix with shape (n_frame, n_hidden) is obtained. After adding position encoding, a preprocessed feature matrix with shape (n_frame, n_hidden) with added position encoding is obtained.

4. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (3), the first stage Transformer consists of a num_layers layer Transformer encoding structure, with a hidden layer dimension of n_hidden and a multi-head attention head number of num_heads. Each Transformer layer contains a multi-head self-attention mechanism, a feedforward neural network, residual connections, and a layer normalization structure.

5. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (3), the preprocessed feature matrix with added position encoding is sequentially input into each layer of the first-stage Transformer to obtain a Transformer feature matrix with an output shape of (n_frame, n_hidden) for each layer. After processing by num_layers layers, a total of num_layers first-stage Transformer feature matrices are obtained.

6. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (4), the feature matrix of each layer is averaged in the time dimension and the frequency dimension to obtain the frequency average feature with shape (1, n_hidden) and the time average feature with shape (1, n_frame). The frequency average feature and the time average feature of the same layer are concatenated to form the Transformer average concatenated feature with shape (1, n_hidden + n_frame). After all layers are processed, a total of num_layers Transformer average concatenated features are obtained.

7. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (5), the compressed fully connected layer sequentially compresses the average stitched features of each Transformer layer from (n_hidden + n_frame) dimensions to n_hidden dimensions through linear transformation, resulting in an average compressed feature of shape (1, n_hidden), resulting in a total of num_layers average compressed features. The num_layers average compressed features are then stitched together to finally obtain the first-stage Transformer layer feature matrix of shape (num_layers, n_hidden).

8. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (6), the second-stage Transformer is structurally consistent with the first-stage Transformer.

9. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (6), after the hierarchical feature matrix is ​​input into the second-stage Transformer, a second-stage Transformer feature matrix with shape (num_layers, n_hidden) is obtained.

10. The method for detecting abnormal sounds in motor equipment based on Transformer hierarchical aggregation according to claim 1, characterized in that, In step (7), after the second-stage feature matrix is ​​globally averaged and aggregated, a comprehensive feature representation with shape (1, n_hidden) is obtained.