Method for detecting motor based on Transform model of UMAP
By adopting the UMAP-based Transformer model in motor sound data processing, combining UMAP feature compression and feature extraction methods of multiple UMAP parameters, the problem of low classification accuracy of motor sound data with high noise and low signal-to-noise is solved, and higher classification accuracy and recognition capabilities are achieved.
Patent Information
- Application Number
- CN202510159184.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2045-02-13
AI Technical Summary
When the prior art processes motor sound data with high noise and low signal-to-noise, the classification accuracy is low, making it difficult to effectively identify abnormal motor sounds.
The method of detecting motors based on UMAP is adopted, and redundant information is removed through UMAP feature compression, and feature extraction and classification are combined with multiple UMAP parameters to improve classification accuracy.
Through the combination of UMAP feature compression and a variety of UMAP parameters, it can effectively remove noise redundant information, improve the classification accuracy of motor sound data, and significantly improve the recognition ability of motor sound data with relatively low signal-to-noise.
Smart Images

Figure CN119622609A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of motor testing, and in particular to a method for detecting a motor using a Transformer model based on UMAP. Background Art
[0002] Motors are important electromechanical equipment in modern production and life, and are of great significance to the smooth progress of industrial processes and the safe operation of equipment. However, motors are prone to abnormal conditions, which can lead to failures and thus create safety hazards. Rapid detection of abnormal equipment can reduce the number of defective products and prevent damage from spreading. The sound of the motor can be used to determine whether the motor is normal or abnormal. For manual detection, manual detection of abnormal sounds and other features will greatly occupy human and material resources, but machine recognition of abnormal equipment can reduce human and economic losses.
[0003] The steps for machine identification of abnormal devices are: feature extraction first, then model prediction.
[0004] In the feature extraction step of the motor, a common method is to extract the time domain data of the motor into a feature matrix through Mel Frequency Cepstral Coefficients, or MFCC. However, sometimes the sound of the motor is accompanied by noise, so the extracted feature matrix often has a lot of useless redundant information, so feature compression can be used to remove redundant information. Common feature dimensionality reduction methods include principal component analysis PCA, Principal Component Analysis, t-Distributed Stochastic Neighbor Embedding t-SNE, and uniform manifold approximation and projection UMAP, Uniform Manifold Approximation and Projection. However, PCA is a linear feature compression, which limits the application scenarios of PCA. t-SNE is slow and cannot maintain global information.
[0005] Commonly used classification methods include time domain analysis, frequency domain analysis, support vector machine (SVM) for machine learning, convolutional neural network (CNN) for deep learning, long short-term memory-recurrent neural network (LSTM-RNN) for deep learning, and Transformer model for deep learning.
[0006] For the complex situation where abnormal sounds of industrial equipment are accompanied by noise, time domain analysis and frequency domain analysis cannot effectively extract features, thereby reducing the accuracy of classification. Machine learning models such as support vector machines (SVM) effectively fit the data, but their generalization ability is insufficient.
[0007] Therefore, improving the classification accuracy of motor sound data with high noise and low signal-to-noise ratio has become a technical problem that needs to be solved urgently. Summary of the invention
[0008] The present invention provides a method for detecting a motor based on a Transformer model of UMAP, which solves the technical problem of low classification accuracy of motor sound data with more noise and lower signal-to-noise ratio.
[0009] In order to solve the above technical problems, the technical solutions adopted by the present invention are as follows: A method for detecting a motor based on a Transformer model of UMAP comprises the following steps: Step S1: extracting features from the time domain signal of the motor to obtain a feature matrix of shape (n_frame, n_mfcc), wherein the time domain signal is a time domain signal of a sound signal or a time domain signal of a vibration signal; Step S2: UMAP feature compression, step S2 includes steps S201 to S204, Step S201: setting K n_neighbor parameters to obtain K different types of UMAPs; Step S202: split the feature matrix with a shape of (n_frame, n_mfcc) obtained in step S1 to obtain n_frame feature vectors with a shape of (n_mfcc, 1); Step S203: Each feature vector of shape (n_mfcc, 1) is independently input to each UMAP, and one UMAP is trained to obtain n_frame trained UMAPs of the same type and K different types of UMAPs, and a total of K*n_frame trained UMAPs are obtained; Step S204: input n_frame feature vectors of shape (n_mfcc, 1) to each trained UMAP, each trained UMAP outputs n_frame feature vectors of shape (n_umap_dim, 1), concatenate n_frame feature vectors of shape (n_umap_dim, 1) to obtain a feature matrix of shape (n_frame, n_umap_dim), K different types of UMAP, obtain K feature matrices of shape (n_frame, n_umap_dim), concatenate K feature matrices of shape (n_frame, n_umap_dim) to obtain a feature matrix of shape (n_frame, n_umap_dim*K); Step S3: The feature matrix with a shape of (n_frame, n_umap_dim*K) obtained in step S2 is mean-normalized and input into the Transformer model, and the Transformer model outputs the classification result.
[0010] A further technical solution is: in step S1, Mel-frequency cepstral coefficients MFCC are used for feature extraction.
[0011] A further technical solution is that it also includes a training process, wherein the training process includes: obtaining a training data set, extracting features through step S1, and obtaining a feature matrix with a shape of (n_frame, n_mfcc) for training; obtaining K types of trained UMAPs through steps S201, S202, and S203, and obtaining K*n_frame trained UMAPs in total; obtaining a feature matrix with a shape of (n_frame, n_umap_dim*K) for training through step S204; training a normalization module with the feature matrix with a shape of (n_frame, n_umap_dim*K) obtained in step S204 to obtain a trained normalization module, and training a Transformer model with the normalized features output by the trained normalization module to obtain a trained Transformer model, that is, a trained Transformer model based on K types of UMAPs.
[0012] A further technical solution is that: the step of training the normalization module includes calculating the mean and standard deviation of each dimension of the feature matrix of shape (n_frame, n_umap_dim * K) used for training to obtain a trained mean matrix and standard deviation matrix of shape (n_frame, n_umap_dim * K), and subtracting the trained mean matrix from the feature matrix of shape (n_frame, n_umap_dim * K) used for training and dividing it by the trained standard deviation matrix to obtain a normalized training feature matrix of shape (n_frame, n_umap_dim * K); the trained mean matrix and standard deviation matrix form a trained normalization module, and the features in the normalized training feature matrix of shape (n_frame, n_umap_dim * K) are the normalized features output by the trained normalization module; the Transformer model includes a fully connected layer, an Encoder layer, a mean function and a fully connected classification layer connected in sequence, and the step of training the Transformer model includes The normalized training feature matrix of n_umap_dim * K) is input into the Transformer model, and the Transformer model outputs the classification result. Back propagation is used in training to optimize the Transformer model parameters according to the loss value calculated by the loss function. After multiple iterations, the trained Transformer model is obtained.
[0013] A further technical solution is that it also includes a testing process, which includes: obtaining a test data set, extracting features through step S1, and obtaining a feature matrix with a shape of (n_frame, n_mfcc) for testing; obtaining a feature matrix with a shape of (n_frame, n_umap_dim*K) for testing through step S202, K*n_frame trained UMAPs and step S204; using the feature matrix with a shape of (n_frame, n_umap_dim*K) for testing obtained in step S204, sequentially predicting through a trained normalized model and a trained Transformer model to obtain a classification result of the test set.
[0014] A further technical solution is that the step of predicting in sequence through the trained normalized model and the trained Transformer model includes obtaining a normalized test feature matrix with a shape of (n_frame, n_umap_dim * K) by subtracting the trained mean matrix from the feature matrix with a shape of (n_frame, n_umap_dim * K) used for testing and dividing it by the trained standard deviation matrix, and inputting the normalized test feature matrix with a shape of (n_frame, n_umap_dim * K) into the trained Transformer model to obtain a classification result.
[0015] A further technical solution is: in step S201, K=2, or K=3.
[0016] A further technical solution is: in step S201, when K=2, n_neighbor of the first UMAP=10, and n_neighbor of the second UMAP=20; when K=3, n_neighbor of the first UMAP=10, n_neighbor of the second UMAP=15, and n_neighbor of the third UMAP=20.
[0017] A further technical solution is that: in the step S1, a filterbank filter bank feature is used for feature extraction, or a Mel Spectrogram feature is used for feature extraction.
[0018] The beneficial effects of adopting the above technical solution are: A method for detecting a motor using a Transformer model based on UMAP comprises step S1: extracting features from a time domain signal of the motor to obtain a feature matrix with a shape of (n_frame, n_mfcc); step S2: setting K n_neighbor parameters to obtain K types of UMAPs; splitting the feature matrix with a shape of (n_frame, n_mfcc) to obtain n_frame feature vectors with a shape of (n_mfcc, 1); inputting them into each UMAP respectively, and obtaining K*n_frame trained UMAPs in total; inputting n_frame feature vectors with a shape of (n_mfcc, 1) into each trained UMAP, obtaining n_frame feature vectors with a shape of (n_umap_dim, 1), concatenating them to obtain a feature matrix with a shape of (n_frame, n_umap_dim), and obtaining K feature matrices with a shape of (n_frame, n_umap_dim) in total, and concatenating them to obtain a feature matrix with a shape of (n_frame, n_umap_dim*K) feature matrix; Step S3: After mean normalization, the classification result is obtained through the Transformer model; it uses K types of UMAP to remove redundant information in the features and improve the accuracy.
[0019] Please refer to the detailed description of the specific implementation method. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a flow chart of the present invention; Figure 2 This is a flowchart of the UMAP feature compression steps during training and testing; Figure 3 It is the data flow diagram of the UMAP feature compression step during training and testing. DETAILED DESCRIPTION
[0021] The purpose of this application is to provide a method for detecting motors based on a Transformer model of multiple UMAPs for noisy motor sounds in industry.
[0022] By setting the n_neighbor parameter in UMAP, you can set the n_neighbor parameter in UMAP to different values to obtain the corresponding different types of UMAP. The n_neighbor parameter in UMAP is an important parameter that affects the result of feature compression, which determines the local neighborhood range of each point in the data set. A smaller n_neighbor value makes UMAP more inclined to maintain the local details of the data, while a larger n_neighbor value makes the model pay more attention to the overall structure of the data. Therefore, when UMAP compresses the feature matrix, you can use different types of UMAP with K different n_neighbor parameters at the same time, so that the compressed feature matrix can maintain both the local details of the data and the overall structure of the data.
[0023] In the field of deep learning, compared with convolutional neural networks (CNN) and recurrent neural networks (RNN), Transformer has the advantages of parallel processing, long-distance dependency modeling, stronger context capture capabilities, and easier expansion and adjustment. It has been successfully applied to natural language processing, computer vision, audio processing and other fields, replacing CNN and RNN.
[0024] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present application and its application or use. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present application. Therefore, the present application is not limited to the specific embodiments disclosed below.
[0026] like Figure 1 to Figure 3 As shown, the present invention discloses a method for detecting a motor based on a Transformer model of UMAP, comprising the following steps: Step S1: MFCC feature extraction.
[0027] The time domain signal of the motor is extracted through Mel-frequency cepstral coefficient (MFCC) feature extraction to obtain a feature matrix with the shape of (n_frame, n_mfcc).
[0028] Training process: A training data set is obtained, and through step S1: MFCC feature extraction, a feature matrix of the shape (n_frame, n_mfcc) used for training is obtained.
[0029] Testing process: A test data set is obtained, and through step S1: MFCC feature extraction, a feature matrix with a shape of (n_frame, n_mfcc) for testing is obtained.
[0030] Details are as follows: like Figure 1 As shown in the figure, the time domain signal of the motor is transformed through the Mel Frequency Cepstral Coefficients (MFCC) to obtain a feature matrix with a shape of (n_frame, n_mfcc), where n_frame is the number of frames of the MFCC Fourier transform and n_mfcc is the dimension of MFCC feature extraction.
[0031] In feature extraction, Mel Frequency Cepstral Coefficients, or MFCC for short, is a commonly used sound feature extraction method. It extracts useful features that can represent audio signals by imitating the human ear's perception of sounds of different frequencies. The specific steps are: input time-domain motor sound data, define the number of Fourier transform frames (n_frame) and the dimension of MFCC feature extraction (n_mfcc), and obtain a feature matrix with a shape of (n_frame, n_mfcc).
[0032] Step S2: UMAP feature compression.
[0033] Step S201: setting K n_neighbor parameters to obtain K different types of UMAPs; Step S202: split the feature matrix with a shape of (n_frame, n_mfcc) obtained in step S1 to obtain n_frame feature vectors with a shape of (n_mfcc, 1); Step S203: Each feature vector of shape (n_mfcc, 1) is independently input to each UMAP, and one UMAP is trained to obtain n_frame trained UMAPs of the same type and K different types of UMAPs, and a total of K*n_frame trained UMAPs are obtained; Step S204: n_frame feature vectors with a shape of (n_mfcc, 1) are input to each trained UMAP, and each trained UMAP outputs n_frame feature vectors with a shape of (n_umap_dim, 1). The n_frame feature vectors with a shape of (n_umap_dim, 1) are concatenated to obtain a feature matrix with a shape of (n_frame, n_umap_dim). For K different types of UMAPs, a total of K feature matrices with a shape of (n_frame, n_umap_dim) are obtained. The K feature matrices with a shape of (n_frame, n_umap_dim) are concatenated to obtain a feature matrix with a shape of (n_frame, n_umap_dim*K).
[0034] Training process: The feature matrix of the shape (n_frame, n_mfcc) obtained by MFCC feature extraction in step S1 is subjected to steps S201, S202 and S203 to obtain K trained UMAPs, and a total of K*n_frame trained UMAPs are obtained; and the feature matrix of the shape (n_frame, n_umap_dim*K) used for training is obtained in step S204.
[0035] Testing process: The feature matrix with the shape of (n_frame, n_mfcc) obtained by step S1: MFCC feature extraction for testing is subjected to step S202, K*n_frame trained UMAPs and step S204 to obtain a feature matrix with the shape of (n_frame,n_umap_dim*K) for testing.
[0036] Details are as follows: In industrial motor anomaly detection, motor sound is often accompanied by large noise, so there is a lot of useless redundant information in the feature extraction. Therefore, feature compression can be used to remove redundant information. UMAP is a feature compression method. The core idea of UMAP is to maintain the structure of the data as much as possible, map high-dimensional data to low-dimensional space by constructing and optimizing graphs, and try to preserve the topological structure in the high-dimensional space.
[0037] UMAP's technical ideas: UMAP training steps technical ideas: 1) Build a neighborhood graph: Input n_train_sample n_dim_pre dimensional training feature vector sets. For each data point in the feature vector set, UMAP will find the nearest n_neighbor neighbor points, calculate the distance, and assign weights to each edge to construct a neighborhood graph.
[0038] 2) Fitted neighborhood graph mapping: Continuously optimize and converge, map the high-dimensional graph to the low-dimensional space, compress the n_train_sample n_dim_pre-dimensional training feature vector set to the n_train_sample n_dim_post-dimensional training feature vector set, and save the fitted neighborhood graph mapping.
[0039] Technical idea of UMAP test steps: By fitting the good neighborhood graph mapping, insert the n_test_sample n_dim_pre-dimensional test feature vector set into the trained low-dimensional space to obtain the n_test_sample n_dim_post-dimensional test feature vector set.
[0040] like Figure 2 As shown, the features extracted by UMAP compression MFCC are divided into training steps and testing steps. Figure 2 belong Figure 1 part of.
[0041] UMAP feature compression is divided into training steps and testing steps, that is, the features extracted by UMAP compression MFCC are divided into training steps and testing steps. The specific steps are detailed as follows.
[0042] Since the feature after MFCC feature extraction is a feature matrix with a shape of (n_frame, n_mfcc), and UMAP compression is a set of feature vectors, the (n_frame, n_mfcc) feature matrix is split into n_frame feature vectors with a shape of (n_mfcc, 1), and then each feature vector is independently input into the UMAP operation.
[0043] The training steps of a UMAP compressed MFCC feature matrix are as follows: extract features from the training set data through MFCC into a feature matrix with a shape of (n_frame, n_mfcc), and then split it into n_frame feature vectors with a shape of (n_mfcc, 1). Train n_frame UMAPs, and then input the n_frame feature vectors with a shape of (n_mfcc, 1) into the trained n_frame UMAPs to obtain n_frame feature vectors with a shape of (n_umap_dim, 1), which are then spliced into a (n_frame, n_umap_dim) feature matrix.
[0044] Therefore, the specific steps for training multiple UMAP compressed MFCC feature matrices are as follows: 1) Input the training feature matrix after MFCC feature extraction with a shape of (n_frame, n_mfcc). 2) Define K different types of UMAP with different n_neighbor parameters. Each different type of UMAP trains n_frame trained UMAPs and obtains a feature matrix with a shape of (n_frame, n_umap_dim). K different types of UMAPs, a total of K*n_frame trained UMAPs and K feature matrices with a shape of (n_frame, n_umap_dim). 3) Concatenate the K feature matrices with a shape of (n_frame, n_umap_dim) into a feature matrix with a shape of (n_frame, n_umap_dim*K).
[0045] The test steps of a UMAP compressed MFCC feature matrix are as follows: extract features from the test set data through MFCC into a feature matrix of shape (n_frame, n_mfcc), and then split it into n_frame feature vectors of shape (n_mfcc, 1). Then input the n_frame feature vectors of shape (n_mfcc, 1) into the trained n_frame UMAPs to obtain n_frame feature vectors of shape (n_umap_dim, 1), and then splice them into a feature matrix of shape (n_frame, n_umap_dim).
[0046] like Figure 3 As shown, a data flow diagram of UMAP training and testing MFCC feature matrix. Figure 3 yes Figure 2 part of.
[0047] At the same time, the n_neighbor parameter in UMAP is an important parameter that affects the dimensionality reduction result, which determines the local neighborhood range of each point in the data set. A smaller n_neighbor value makes UMAP more inclined to maintain the local details of the data, while a larger n_neighbor value makes the model pay more attention to the overall structure of the data. Therefore, when UMAP compresses the MFCC feature matrix, different types of UMAP with K different n_neighbor parameters can be used at the same time, so that the compressed MFCC feature matrix can maintain both the local details and the overall structure of the data.
[0048] The specific steps of testing the UMAP compressed MFCC feature matrix are as follows: 1) Input the test feature matrix with a shape of (n_frame, n_mfcc) after MFCC feature extraction. 2) Compress the K*n_frame trained UMAP test feature matrices to obtain K feature matrices with a shape of (n_frame, n_umap_dim). 3) Concatenate the K feature matrices with a shape of (n_frame, n_umap_dim) into a feature matrix of (n_frame, n_umap_dim*K).
[0049] Step S3: Obtain classification results.
[0050] The feature matrix with a shape of (n_frame, n_umap_dim*K) obtained in step S2 is mean-normalized and input into the Transformer model, and the Transformer model outputs the classification result.
[0051] After mean normalization, the shape of the feature matrix does not change.
[0052] Training process: Step S204 is used to obtain a feature matrix with a shape of (n_frame, n_umap_dim*K) for training, and a normalization module is trained to obtain a trained normalization module. The normalized features output by the trained normalization module are used to train the Transformer model to obtain a trained Transformer model, that is, a trained Transformer model based on K types of UMAP.
[0053] The training process of the normalization module: The feature matrix with the shape of (n_frame, n_umap_dim * K) used for training is used as the training data, that is, the training feature matrix. In the training stage, the mean and standard deviation are calculated based on the data of each dimension in the training feature matrix with a shape of (n_frame, n_umap_dim * K) to obtain the mean matrix and standard deviation matrix with a shape of (n_frame, n_umap_dim * K), and the training feature matrix with a shape of (n_frame, n_umap_dim * K) is subtracted from the mean matrix with a shape of (n_frame, n_umap_dim * K) and divided by the standard deviation matrix with a shape of (n_frame, n_umap_dim * K) to obtain the normalized training feature matrix with a shape of (n_frame, n_umap_dim * K), that is, the normalized module is trained, and the features in the normalized training feature matrix with a shape of (n_frame, n_umap_dim * K) are the normalized features output by the trained normalized module, and the shape is (n_frame, n_umap_dim * K). The mean matrix is the trained mean matrix, the standard deviation matrix of shape (n_frame, n_umap_dim *K) is the trained standard deviation matrix, and the trained mean matrix and standard deviation matrix form a trained normalization module.
[0054] To further illustrate, the training feature matrix is mean normalized, that is, for each element in the matrix, the mean of the corresponding dimension is subtracted and divided by the standard deviation of the dimension to obtain the normalized training matrix. The dimension of the normalized training matrix is still (n_frame, n_umap_dim * K).
[0055] The training process of the Transformer model: The Transformer model includes a fully connected layer, an Encoder layer, a mean function, and a fully connected classification layer connected in sequence. The normalized training feature matrix of the shape (n_frame, n_umap_dim * K) is input into the Transformer model, and the Transformer model outputs the classification result. Back propagation is used in training to optimize the Transformer model parameters according to the loss value calculated by the loss function. After multiple iterations, the trained Transformer model is obtained. Details are as follows: First, the normalized training feature matrix of shape (n_frame, n_umap_dim * K) is taken as input. This input passes through a fully connected layer of shape (n_umap_dim * K, n_umap_dim * K) and outputs a training Transformer fully connected layer matrix of shape (n_frame, n_umap_dim * K).
[0056] Next, the training Transformer fully connected layer matrix is sent to the Encoder layer of the Transformer model. This layer adopts a four-head attention mechanism. Due to its sequence-to-sequence mapping characteristics, the input and output dimensions remain unchanged, and the training Transformer Encoder layer matrix with a shape of (n_frame, n_umap_dim * K) is obtained.
[0057] Then, the training Transformer Encoder layer matrix is averaged to obtain a training Transformer mean vector of shape (1, n_umap_dim *K), which is a comprehensive representation of the input sequence.
[0058] Finally, the training Transformer mean vector is input into a fully connected classification layer with a shape of (n_umap_dim * K, 2) and mapped to a two-dimensional space through a linear transformation to obtain the classification result. Back propagation is used in training to optimize the model parameters according to the loss value calculated by the loss function, and a trained Transformer model is obtained after multiple iterations.
[0059] Testing process: The feature matrix of the shape (n_frame, n_umap_dim*K) for testing obtained in step S204 is sequentially predicted by the trained normalized model and the trained Transformer model to obtain the accuracy of the test set.
[0060] The testing process of the normalization module: The feature matrix of shape (n_frame, n_umap_dim * K) used for testing is used as the test data, that is, the test feature matrix. The test feature matrix of shape (n_frame, n_umap_dim * K) used for testing is subtracted from the trained mean matrix of shape (n_frame, n_umap_dim * K) and divided by the trained standard deviation matrix of shape (n_frame,n_umap_dim * K) to obtain the normalized test feature matrix of shape (n_frame, n_umap_dim * K). Details are as follows: First, load the mean matrix and standard deviation matrix obtained in the training phase, that is, load the trained normalization module.
[0061] Then, the test data is mean normalized, that is, for each element in the test feature matrix, the mean of the corresponding dimension is subtracted and divided by the standard deviation of the dimension to obtain the normalized test feature matrix. The dimension of the normalized test feature matrix is still (n_frame, n_umap_dim * K).
[0062] Testing process of Transformer model: First, load the trained Transformer model and take the normalized test feature matrix of shape (n_frame, n_umap_dim *K) as input. This input passes through a fully connected layer of shape (n_umap_dim * K, n_umap_dim * K) and outputs a test Transformer fully connected layer matrix of shape (n_frame, n_umap_dim * K).
[0063] Next, the test Transformer fully connected layer matrix is sent to the Encoder layer of the Transformer model. This layer adopts a four-head attention mechanism. Due to its sequence-to-sequence mapping characteristics, the input and output dimensions remain unchanged, and the test Transformer Encoder layer matrix of (n_frame, n_umap_dim * K) is obtained.
[0064] Then, the test Transformer Encoder layer matrix is averaged to obtain a test Transformer mean vector of dimension (1, n_umap_dim *K), which is a comprehensive representation of the input sequence.
[0065] Finally, the test Transformer mean vector is input into a fully connected classification layer with a dimension of (n_umap_dim * K, 2) and mapped to a two-dimensional space through a linear transformation to obtain the classification result, which is normal or abnormal.
[0066] Details are as follows: like Figure 1 As shown, Transformer model training and testing based on various UMAPs.
[0067] During the training process, the training data set is input, and after MFCC feature extraction, K types of UMAP feature compression training, normalization module training, and Transformer model training, a trained Transformer model based on K types of UMAP is finally obtained.
[0068] During the testing process, the test data set is input, MFCC feature extraction is performed, K types of UMAP compression features are trained, features are normalized using the trained normalized model, and the trained Transformer model is predicted, and finally the accuracy of the test set is obtained.
[0069] The Transformer model is an existing technology and is briefly described as follows: The Transformer model is divided into training and testing steps.
[0070] The architecture of the Transformer model is: fully connected layer, Transformer encoder, mean, fully connected classification layer. The Transformer encoder is the Encoder layer, and the mean function is the mean.
[0071] The training steps of the Transformer model are: input (n_frame, n_umap_dim*K) training feature matrix, training normalization module, and training Transformer model.
[0072] The test steps of the Transformer model are as follows: input the test feature matrix of (n_frame, n_umap_dim*K), normalize the test feature matrix with the trained normalization module, and then input the normalized test feature matrix into the trained Transformer model to obtain the classification result. The classification result includes two results: the motor is normal or abnormal.
[0073] Experimental Example: This application uses the public dataset MIMII Dataset to verify the superiority of the method of detecting motors based on the Transformer model of multiple UMAPs. MIMII Dataset is a reliable dataset for investigating and inspecting faulty industrial machines. It contains the sounds generated by four types of industrial machines, namely valves, pumps, fans, and slide rails. Each valve, pump, fan, and slide rail has four models (id0, id2, id4, id6) published respectively, and each model has -6db, 0db, 6db signal-to-noise ratio sound data published. Under different signal-to-noise ratios of each model, the corresponding data contains normal and abnormal sounds.
[0074] This application selects the pump motor sound with a signal-to-noise ratio of -6db, that is, more noise, id0 as experimental data, and divides the training set and the test set into a ratio of 8:2.
[0075] In feature extraction: MFCC obtains a feature matrix of shape (n_frame, n_mfcc) with n_frame=5 and n_mfcc=64.
[0076] In feature compression: K=2; K n_neighbors are divided into 10, 20; n_umap_dim=32.
[0077] Experimental results show: We compared the Transformer model that did not use UMAP compressed features, the Transformer model that only used one UMAP, and the Transformer model based on multiple UMAPs.
[0078] The Transformer model without UMAP compressed features has an accuracy of 95.2%.
[0079] K=1, n_neighbor=10, and a UMAP Transformer model with an accuracy of 95.5% was used.
[0080] K=1, n_neighbor=20, and a UMAP Transformer model with an accuracy of 95.4 was used.
[0081] K=2; n_neighbor=10 for the first UMAP and n_neighbor=20 for the second UMAP. The accuracy of the Transformer model based on multiple UMAPs is 95.7%.
[0082] K=3; n_neighbor=10 for the first UMAP, n_neighbor=15 for the second UMAP, and n_neighbor=20 for the third UMAP. The accuracy of the Transformer model based on multiple UMAPs is also 95.7. It can be seen that as K is greater than 2, the accuracy does not increase, but the operating efficiency of the model decreases. Therefore, the best parameter of K is 2.
[0083] If K≥4, the running speed will drop significantly, which will not be explained in detail.
[0084] It can be seen that in the data set with relatively large motor sound noise, UMAP compression features are used to remove redundant features, and different types of UMAP with K different n_neighbor parameters are used to improve the classification of motor sounds with low signal-to-noise ratio.
[0085] Technical effect: It has higher accuracy for motor sound data with lower signal-to-noise ratio.
[0086] UMAP was used to remove redundant information with more noise.
[0087] By using different types of UMAP with K different n_neighbor parameters at the same time, the compressed MFCC feature matrix can maintain both the local details and the overall structure of the data, which can improve the accuracy.
[0088] The combination of UMAP and Transformer is applied to the classification of motor sound data with high noise.
[0089] Compared with the above embodiment, in step S1, Filterbank filter bank feature extraction may be used to replace MFCC feature extraction, or Mel Spectrogram feature extraction may be used to replace MFCC feature extraction.
[0090] Mel Spectrogram is the Mel spectrum graph; Mel-Frequency Cepstral Coefficients, abbreviated as MFCC, is the Mel frequency cepstral coefficient.
[0091] The time domain signal of the motor is the data expressed by the motor on the time axis, which is usually a time series that changes with time and is generated by the vibration of the motor during operation. The time domain signal of the motor is a sound signal, and the sound signal is recorded by a microphone to obtain the corresponding time domain signal of the motor, or the time domain signal of the motor is a vibration signal, and the vibration signal is obtained by a vibration sensor to obtain the corresponding time domain signal of the motor.
[0092] Common time domain signal acquisition methods include: Air acoustic signal obtained by the microphone sensor: The microphone captures the pressure changes of sound waves in the air and converts them into corresponding voltage signals.
[0093] Motor vibration signal obtained by the vibration sensor: The mechanical vibration generated during the operation of the motor is captured by the sensor and converted into a voltage signal.
Claims
1. A method for detecting a motor based on a Transformer model of UMAP, characterized in that: The following steps are included: Step S1: extracting features from the time domain signal of the motor to obtain a feature matrix of shape (n_frame, n_mfcc), wherein the time domain signal is a time domain signal of a sound signal or a time domain signal of a vibration signal; Step S2: UMAP feature compression, step S2 includes steps S201 to S204, Step S201: setting K n_neighbor parameters to obtain K different types of UMAPs; Step S202: split the feature matrix with a shape of (n_frame, n_mfcc) obtained in step S1 to obtain n_frame feature vectors with a shape of (n_mfcc, 1); Step S203: Each feature vector of shape (n_mfcc, 1) is independently input to each UMAP, and one UMAP is trained to obtain n_frame trained UMAPs of the same type and K different types of UMAPs, and a total of K*n_frame trained UMAPs are obtained; Step S204: input n_frame feature vectors of shape (n_mfcc, 1) to each trained UMAP, each trained UMAP outputs n_frame feature vectors of shape (n_umap_dim, 1), concatenate n_frame feature vectors of shape (n_umap_dim, 1) to obtain a feature matrix of shape (n_frame, n_umap_dim), K different types of UMAP, obtain K feature matrices of shape (n_frame, n_umap_dim), concatenate K feature matrices of shape (n_frame, n_umap_dim) to obtain a feature matrix of shape (n_frame, n_umap_dim*K); Step S3: The feature matrix with a shape of (n_frame, n_umap_dim*K) obtained in step S2 is mean-normalized and input into the Transformer model, and the Transformer model outputs the classification result.
2. The method for detecting a motor using a Transformer model based on UMAP according to claim 1, characterized in that: In the step S1, Mel-frequency cepstral coefficients (MFCC) are used for feature extraction.
3. The method for detecting a motor based on the Transformer model of UMAP according to claim 1, characterized in that: The method also includes a training process, which includes: obtaining a training data set, extracting features through step S1, and obtaining a feature matrix with a shape of (n_frame, n_mfcc) for training; obtaining K types of trained UMAPs through steps S201, S202, and S203, and obtaining K*n_frame trained UMAPs in total; obtaining a feature matrix with a shape of (n_frame, n_umap_dim*K) for training through step S204; training a normalization module with the feature matrix with a shape of (n_frame, n_umap_dim*K) obtained in step S204 to obtain a trained normalization module, and training a Transformer model with the normalized features output by the trained normalization module to obtain a trained Transformer model, that is, a trained Transformer model based on K types of UMAPs.
4. The method for detecting a motor based on the Transformer model of UMAP according to claim 3 is characterized in that: The step of training the normalization module includes calculating the mean and standard deviation of each dimension of the feature matrix of the shape (n_frame, n_umap_dim * K) used for training to obtain a trained mean matrix and a standard deviation matrix of the shape (n_frame, n_umap_dim * K), and subtracting the trained mean matrix from the feature matrix of the shape (n_frame, n_umap_dim * K) used for training and dividing it by the trained standard deviation matrix to obtain a normalized training feature matrix of the shape (n_frame, n_umap_dim * K); the trained mean matrix and standard deviation matrix form a trained normalization module, and the features in the normalized training feature matrix of the shape (n_frame, n_umap_dim * K) are the normalized features output by the trained normalization module; the Transformer model includes a fully connected layer, an Encoder layer, a mean function and a fully connected classification layer connected in sequence, and the step of training the Transformer model includes The normalized training feature matrix of n_umap_dim * K) is input into the Transformer model, and the Transformer model outputs the classification result. Back propagation is used in training to optimize the Transformer model parameters according to the loss value calculated by the loss function. After multiple iterations, the trained Transformer model is obtained.
5. The method for detecting a motor based on the Transformer model of UMAP according to claim 4 is characterized in that: The test process is also included. The test process is as follows: obtaining a test data set, extracting features through step S1, and obtaining a feature matrix with a shape of (n_frame, n_mfcc) for testing; After step S202, K*n_frame trained UMAPs and step S204, a feature matrix with a shape of (n_frame, n_umap_dim*K) for testing is obtained; the feature matrix with a shape of (n_frame, n_umap_dim*K) for testing obtained in step S204 is predicted by the trained normalized model and the trained Transformer model in turn to obtain the classification result of the test set.
6. The method for detecting a motor based on the Transformer model of UMAP according to claim 5, characterized in that: The step of predicting by the trained normalized model and the trained Transformer model in sequence includes obtaining a normalized test feature matrix with a shape of (n_frame, n_umap_dim * K) by subtracting the trained mean matrix from the feature matrix with a shape of (n_frame, n_umap_dim * K) for testing and dividing it by the trained standard deviation matrix, and inputting the normalized test feature matrix with a shape of (n_frame, n_umap_dim * K) into the trained Transformer model to obtain a classification result.
7. The method for detecting a motor based on the Transformer model of UMAP according to claim 1, characterized in that: In step S201, K=2, or K=3.
8. The method for detecting a motor based on the Transformer model of UMAP according to claim 7, characterized in that: In the step S201, when K=2, n_neighbor of the first UMAP=10, and n_neighbor of the second UMAP=20; when K=3, n_neighbor of the first UMAP=10, n_neighbor of the second UMAP=15, and n_neighbor of the third UMAP=20.
9. The method for detecting a motor based on the Transformer model of UMAP according to claim 1, characterized in that: In the step S1, filterbank filter bank feature extraction is performed, or Mel Spectrogram feature extraction is performed.
Citation Information
Patent Citations
Motor imagery electroencephalogram signal classification system based on TimesNet and convolutional neural network
CN118094317A
Data processing device, data processing method, program, and model
JP2021089483A
Neural network techniques for appliance creation in digital oral care
WO2024127315A1
Cited By
Multilayer feature fusion Transform neural network and method for detecting motor
CN119940417A
Multi-layer Feature Fusion Transformer Neural Network and Method for Detecting Electric Motors
CN119940417B
Transform neural network and method for multi-feature grouping
CN120804841A
Transform neural network and method for detecting motor based on SE attention mechanism
CN121031671A