Bearing fault diagnosis method based on domain generalization

By combining shared features and private feature extractors with the CBAM attention mechanism and multi-scale feature fusion, the problem of insufficient accuracy in bearing fault diagnosis under unknown working conditions is solved, and efficient fault diagnosis and model generalization under unknown working conditions are achieved.

CN120611295APending Publication Date: 2025-09-09BEIJING UNIV OF CHEM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510344090.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

Existing technologies are unable to effectively diagnose bearing faults under unknown working conditions. The lack of fault data and type labels results in insufficient diagnostic accuracy of traditional methods.

Method used

Shared features and private feature extractors are used, combined with the CBAM attention mechanism, feature separation is performed through similarity loss, difference loss, mutual information loss and cross entropy loss, a feature space is constructed to achieve domain generalization, and multi-scale feature fusion and loss function are used to optimize model parameters.

Benefits of technology

It improves the fault diagnosis accuracy and model generalization ability under unknown working conditions, and can effectively monitor the health and diagnose faults of mechanical equipment in actual engineering sites.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120611295A_ABST
    Figure CN120611295A_ABST
Patent Text Reader

Abstract

The invention provides a bearing fault diagnosis method based on domain generalization. A model trained by known working condition data is used for unknown working condition fault diagnosis. Effective feature segments of original signal data are extracted through multi-scale fusion and an attention mechanism, deep extraction is carried out through a shared feature extractor and a private feature extractor, and weight parameter summation is superposed through calculation of mutual information loss, difference loss, similarity loss and MMD loss functions. Model parameters are updated in a back propagation and gradient optimization mode, finally, an optimal model is stored in the training process, a data set of an unknown working condition is tested, the model precision is visually fed back, and the generalization ability of the model is reflected more visually. The method comprises the following steps: (1) fan bearing and gear data acquisition; (2) sampling and slicing original data; (3) establishing a network to extract data features; (4) loss function processing; (5) model training and testing; and (6) comparing model results, and summarizing the results into a visual image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention is aimed at the actual engineering application field of bearings. Since it is impossible to predict faults on site and thus have to face unknown fault types, there is a lack of fault data and fault type labels. Conventional fault diagnosis methods have certain limitations. The use of deep learning methods, domain generalization models, and domain decoupling combined methods can well solve the diagnosis of unknown fault types and improve the diagnostic accuracy of faults in actual engineering. Background Art

[0002] Traditional deep learning-based intelligent diagnostic methods often assume that the operating conditions of the target fault are known and that sufficient fault data is available. These data are then used during model training to increase the model's diagnostic accuracy. However, in actual engineering sites, it is difficult to predict the operating conditions of a faulty component without prior preparation, and even less so to obtain the fault data for that condition. This type of diagnosis of unknown operating conditions leaves much room for improvement compared to traditional deep learning-based fault diagnosis methods. Therefore, it is necessary to develop a bearing fault diagnosis method for unknown operating conditions and for those for which fault data cannot be collected.

[0003] This paper proposes an intelligent fault diagnosis method for bearings. This method uses shared features and private feature extractors to extract valid feature fragments from the original signal data through CBAM (attention mechanism). It then distinguishes shared features from private features by combining similarity loss, difference loss, mutual information loss, and cross-entropy loss to complete feature separation. A feature space is then constructed based on the shared features between the source domains. This feature space can be effectively generalized to the unknown target domain, thereby diagnosing the fault. This paper establishes a method that combines data collection, data processing and analysis, and model diagnosis. The proposed method can be used to perform health monitoring of equipment at the construction site and can more effectively deal with mechanical equipment failures in unpredictable working conditions. Summary of the Invention

[0004] The present invention proposes a bearing fault diagnosis method based on domain generalization. The feature fragments in the fault data are effectively extracted through CBAM (attention mechanism), and the extracted rotating component fault data features are feature separated. The shared features and private features of each source domain are extracted respectively. The effectiveness of the shared features and private features is continuously optimized through similarity loss, difference loss, mutual information loss, and cross entropy loss. The feature space constructed by the extracted shared features can be effectively generalized to the unknown target domain, realizing the deep feature extraction and diagnosis of rotating component fault information, and establishing a method combining data acquisition, data processing and analysis, and model diagnosis.

[0005] S1 fan bearing data collection

[0006] The present invention tests bearing data on a wind power generation test bench and obtains data on bearing faults under different working conditions. There are six types of faults, and the working conditions of the equipment are divided into five categories. Dual-channel sampling is used, and the sampling frequencies are divided into 500k and 1M.

[0007] S2 raw data sampling and slicing

[0008] The wind turbine dataset collects vibration data from the bearings and gears of a wind turbine test bench. Each signal segment is randomly sampled to a length of one sample, with a total of 300 samples for each fault type. The data for each operating condition is then batch processed using a built-in library.

[0009] S3 builds a deep neural network to extract the required features from the collected data

[0010] This paper combines multi-scale feature fusion with the attention mechanism to extract effective features. In the traditional CNN structure, the convolution kernel in a convolution layer is of a single scale, which causes the model to ignore some data features. The multi-scale feature extraction strategy adopted in this paper has the following specific steps:

[0011] It passes through a convolutional layer with an input of 192, an output of 32, and a convolution kernel size of 5. The expansion rate of the convolutional layer is different at each scale, and the expansion rates of each scale are 1, 2, 3, and 4 respectively. Then it passes through the adaptive pooling layer and batch normalization, and finally passes through the activation function. At another scale, feature extraction is performed only through the maximum pooling layer and the adaptive pooling layer.

[0012] Convolutional Attention Module (CBAM) introduces two attention mechanisms: channel attention and spatial attention. Channel attention helps enhance feature representations across different channels, while spatial attention helps extract key information at different locations in space. Combining these two mechanisms, they adaptively adjust channel and spatial weights within feature maps. The CBAM module is typically embedded within different layers of a deep convolutional neural network (CNN) to enhance the feature modeling capabilities of the proposed model. Its multi-granularity feature selection mechanism provides an efficient solution for extracting key information in complex scenarios.

[0013] The above CBAM and deep neural network constitute the feature extraction module. In the present invention, there are respectively a domain-shared feature extraction module and a domain-private feature extraction module. The architecture of the two modules is as described above. The difference is that when backpropagation adjusts the model parameters during training, one tends to extract domain-shared features, while the other is for extracting domain-private features.

[0014] S4 loss function processing

[0015] After extracting features from the processed data, the features are evaluated in a series and the model parameters are updated based on the results. The model of the present invention includes two encoders between domains, namely a shared encoder and a private encoder. The two features extracted by the shared encoders of the two source domains are measured by similarity loss. After the shared encoder extracts the features of the two domains, the source of the features is determined by the domain discriminator. At the same time, gradient reversal adversarial training is used. The shared encoder is optimized to deceive the discriminator (minimize the domain classification ability), while the discriminator is optimized to improve the classification accuracy, forming a dynamic game.

[0016] Then the shared features and private features in the domain will be measured by a difference loss to measure the difference between the two. Minimizing the difference loss will make the features extracted by the shared encoder different from the features extracted by the private encoder. Its function is to force the two feature matrices of the shared features and the private features to be orthogonal.

[0017] Mutual information loss ensures that the features retain the core content of the original data by maximizing the mutual information between the reconstructed features and the original features (calculated based on the cross-covariance matrix), minimizing the information gap between the extracted features and the original data, and thus ensuring that the extracted features retain most of the information in the original data.

[0018] This paper adopts the maximum mean difference (MMD) loss function as the measurement criterion for the difference between the two domains. There is a certain distribution difference between the two domains. Domain adaptation is essentially to construct a mapping function that minimizes the distance between the domains after mapping. The mean difference (MMD) loss function is used as the measurement criterion for this difference. By minimizing the loss function, the distribution difference between the source domain and the target domain is reduced, thereby achieving the purpose of narrowing the distance between the two domains.

[0019] S5 model training and testing

[0020] During the model training and testing process, a source domain training dataset containing multi-working condition classification labels is first constructed. The source domain data with labeled working conditions is adaptively learned across domains through a feature extraction network to extract deep fault feature representations with working condition invariance. The feature representation is input into a composite loss function module consisting of domain alignment loss, feature decoupling loss, semantic similarity loss, and reconstruction loss. The total loss function is obtained by weighted summing up each sub-loss based on a preset weight coefficient. The gradient of the total loss with respect to the model parameters is calculated through the backpropagation algorithm, and the feature extraction network, domain discriminator, and decoder are collaboratively optimized using stochastic gradient descent or adaptive moment estimation gradient optimization algorithm. The network parameters are iteratively updated until the model converges. Finally, based on the optimized model, fault feature migration and diagnosis task tests are performed on the target domain data to verify the generalization ability and robustness of the cross-domain diagnosis performance.

[0021] Comparison of S6 model results

[0022] After training, the optimal model is retained, and the accuracy of the model is tested using unlabeled data that has not participated in training. The present invention designs a series of visual results display including line graphs of accuracy and loss, as well as confusion matrices and clustering diagrams, and plots the loss function change curve of the validation set to reveal the rationality of the multi-task loss weight configuration and the model convergence stability.

[0023] Compared with the prior art, the creativity of the present invention is mainly reflected in:

[0024] The present invention proposes a bearing fault diagnosis method based on domain generalization. For the scenario where a model trained with data from known working conditions is used to diagnose some unknown working conditions at the fault site, a domain generalization method based on domain decoupling is proposed to separate the shared features and private features between different domains, thereby enhancing the overall performance of the model when facing unknown working conditions. The present invention extracts effective feature fragments from the original signal data through an attention mechanism, performs deep extraction through shared feature extractors and private feature extractors, and then calculates and sums weight parameters through the calculation of mutual information loss, difference loss, similarity loss, and MMD loss functions. The model parameters are updated through backpropagation and gradient optimization. Finally, the optimal model is saved during the training process, and the data set of unknown working conditions is tested and the model accuracy is visually fed back, which more intuitively reflects the generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It is the overall flow chart of the present invention;

[0026] Figure 2 This is a diagram of a blower test bench of the present invention;

[0027] Figure 3 It is a feature fusion structure diagram of the present invention;

[0028] Figure 4 This is the structural diagram of the attention mechanism of the present invention;

[0029] Figure 5 is a diagram illustrating the working mode of the loss function of the present invention;

[0030] Figure 6 This is the accuracy and loss diagram of the present invention with a speed of 900 r / min as the target domain;

[0031] Figure 7 This is the confusion matrix of the present invention with the speed of 900r / min as the target domain; DETAILED DESCRIPTION

[0032] The present invention will be further described below with reference to the accompanying drawings and specific embodiments;

[0033] The main process of the present invention includes

[0034] (1) Wind turbine bearing data collection; (2) Raw data sampling and slicing; (3) Network construction to extract data features; (4) Loss function processing; (5) Model training and testing; (6) Model result comparison; Figure 1 This is a flow chart of the present invention. The bearing fault diagnosis method based on domain generalization is introduced below in conjunction with the flow chart.

[0035] In step (1) described above, the present invention collects data on various combined faults of the wind turbine test bench under different working conditions, the working conditions being 600r / min, 900r / min, 1200r / min, 1500r / min, and 1800r / min, respectively. Each working condition has 6 groups of fault types, and includes combined faults of bearing inner ring damage + gear tooth breakage fault, bearing inner ring damage + gear tooth root crack fault, bearing inner ring single damage fault (gear is normal), bearing outer ring damage + gear tooth breakage fault, bearing outer ring damage + gear tooth root crack fault, and bearing outer ring single damage fault (gear is normal). The number of teeth of the gear Z = 28.

[0036] In step (2) above, the original data is sampled and sliced. The wind turbine data set collects the vibration data of the bearings and gears of the wind power generation test bench. The computer software pycharm is used to define the file path of the original signal according to the file name, and then the data loading module is used to read the data. The data loading module automatically calculates the number of read files, and then randomly samples a sample of 1024 in length from each collected signal segment. The above operation is repeated until 300 samples are obtained for each fault type. Then, the data of the five working conditions are batch processed, and the data of each working condition are divided into 128 batches using the built-in function library. There are 6 types of fault types for each working condition.

[0037] The above step (3) builds a deep neural network to extract the required features from the collected data. The present invention adopts multi-scale feature fusion, the structure is as follows Figure 3 As shown in the figure, first, feature extraction is performed at five scales, four of which are convolution branches and the other is a pooling branch. Each branch uses a 1-dimensional convolution operation, with 192 input channels, 32 output channels, and a convolution kernel size of 5. However, each branch uses a different dilation rate (dilation), which is 1, 2, 3, and 4, respectively, to achieve effective receptive fields of 5, 9, 13, and 17, respectively. After the convolution operation, each convolution branch is sequentially provided with an adaptive maximum pooling layer with a channel length of 1 to reduce the size of the output feature map to 1; followed by a batch normalization layer and a ReLU activation function for 32 channels, and the output dimension is the sum of the output channels of the four convolution branches, which is 128. Finally, features at different scales are extracted.

[0038] CBAM modules are usually embedded in different layers of deep convolutional neural networks to enhance the model's ability to extract features. The attention mechanism structure is as follows: Figure 4 Its architecture is as follows:

[0039] First, the channel attention submodule extracts global statistical features in the channel dimension through dual-path global pooling. The input dimension is the output dimension of the multi-scale feature fusion module, which is 128. It first passes through an adaptive average pooling layer with an output length of 1, then passes through an adaptive maximum pooling layer with an output length of 1, and finally passes through a bottleneck fully connected layer with a compression ratio of 16 to generate a channel weight matrix. The outputs of the adaptive average pooling layer and the adaptive maximum pooling layer are then added and normalized using the Sigmoid function and multiplied by the input features channel by channel.

[0040] Subsequently, the spatial attention submodule aggregates the maximum and mean feature maps along the channels of the first dimension, passes through a convolution layer with a convolution kernel size of 7×7, an input dimension of 2, an output dimension of 1, and a padding of 2, and then normalizes it through the Sigmoid function and multiplies it channel by channel with the input features to generate a spatial attention mask and multiply it point by point with the channel-optimized features to obtain the output data.

[0041] Finally, the 320-dimensional output data from the previous step is fed into a linear layer, which now has an input of 320 and an output of 512. It then passes through a Dropout layer, which randomly sets the elements to zero with a default probability of 0.5. Finally, it passes through another linear layer, with an input of 512 and an output of 256-dimensional features. This output feature is used to process the loss function during training, completing the model iteration.

[0042] During the test, the probability prediction module is used to further reduce the dimension of the 256-dimensional features extracted above through a linear layer with an input dimension of 256 and an output dimension of 6, obtaining an output feature of dimension 6, which corresponds to the probabilities of the six fault types for each type of working condition.

[0043] The loss function processing in step (4) mentioned above, the specific working principle of the loss function is as follows Figure 5 As shown, the overall feature extraction module of the aforementioned claim 2 is referred to as an encoder. The model has two encoders with the same structure, namely a shared encoder and a private encoder. The outputs of the two encoders are called shared features and private features. The two working condition data extracted from the five working conditions in step 1 of the aforementioned claim 2 are both called source domain data. The two features extracted by the two source domain shared encoders will be measured by similarity loss. This loss is used to train the encoder through domain discriminator and gradient reversal to more accurately extract shared features. The specific formula is as follows:

[0044]

[0045] in Represents X s Taken from the first source domain, G D represents the domain discriminator, E s represents the shared feature encoder, X s Represents the feature data of one of the source domains, X t Represents the feature data of the second source domain.

[0046] Then, the shared features and private features in the domain are measured by a difference loss to measure the difference between the two. Minimizing the difference loss will make the features extracted by the shared encoder and the features extracted by the private encoder farther apart. The specific formula is as follows:

[0047]

[0048] in represents the squared Frobenius norm, Represents the transposition operation of the feature matrix extracted by the shared feature extractor from one of the source domains, represents the features taken from source domain 1 and passed through the shared feature extractor, represents the features taken from source domain 2 and processed by a private feature extractor, Represents the features taken from source domain 1 and passed through the private feature extractor. The role of this loss function is to enforce the orthogonality of the two feature matrices of shared features and private features to enhance the difference of features.

[0049] Mutual information loss minimizes the information loss between the extracted features and the original data, thereby ensuring that the extracted features retain most of the information in the original data. The specific formula is as follows:

[0050]

[0051] in represents the reconstructed feature matrix, Represents X i Taken from a certain package batch, B represents a certain package batch, X j Indicates that this data is taken from another bag batch, exp(g) represents the natural exponential function, and f(g) represents the covariance matrix between the original features and the reconstructed features. The covariance matrix is ​​defined as follows:

[0052] Let X1 = X i , X=(X1,X2) T It is called a matrix

[0053]

[0054] is the covariance matrix of the random variable X, where

[0055] c ij =Cov(X i ,X j )=E[(X i -μ i )(X j -μ j )] (5)

[0056] Where μ i =E[X i ],μ j =E[X j ],i,j=1,2; E[g] represents the mathematical expectation value of each component in the vector.

[0057] This paper uses the Maximum Mean Difference (MMD) loss function as a measure of the difference between two domains and minimizes the loss function to reduce the distribution difference between shared features of different domains. The specific formula is as follows:

[0058]

[0059] where X s ={x s i ,...,x s n} and X t ={x t i ,...,x t m} represents a dataset of two domains, represents the kernel function that maps the source data and target data to the reproduction kernel Hilbert space H (RKHS), where n and m are the number of source samples and target samples respectively. k The representation norm is calculated in the reproducing kernel Hilbert space generated by the kernel function k.

[0060] After calculating the above losses, all losses are weighted and summed to obtain the total loss. A certain loss function weight is taken based on experience and experiments. Finally, after multiple experiments, the convergence effect of the accuracy curve and the accuracy value are observed. The weights are obtained in the order of the loss functions introduced above: 80, 0.001, 0.05, and 1; corresponding to similarity loss, difference loss, mutual information loss, and maximum mean difference loss, respectively.

[0061] In step (5) model training and testing described above, after the above-mentioned feature extraction and loss calculation, the calculated loss is continuously updated through backpropagation and gradient optimization. The gap between the predicted value and the true label is continuously narrowed, so that the entire network tends to the optimal state. During the training process, the model will always judge the current accuracy and the previous accuracy, and always retain the optimal model. The initial value of the learning rate during model training and testing is 0.001. The model will automatically adjust the learning rate according to the results during the training process. The number of iterations is 100 and the batch size is 128.

[0062] During the model testing process, the previously saved optimal model is called out, and the model is loaded and tested using one of the operating condition data that did not participate in the training. During the test, the prediction label module is called, and the features extracted by the encoder are input into the prediction module. First, the input embedding vector is reduced in dimension through a fully connected layer, and a nonlinear transformation is introduced through the ReLU activation function. Then, another fully connected layer is connected to obtain the final output 6-dimensional data corresponding to 6 fault types.

[0063] In step (6) above, after obtaining the test results, the model results are compared and summarized into a series of visual images.

[0064] Specifically, by drawing line graphs of accuracy and loss, the convergence of the model and the accuracy improvement trend during training can be intuitively observed; using the confusion matrix to conduct a detailed analysis of the classification results of the model can clearly reveal the misjudgment between categories; at the same time, the distribution of different tasks or categories in the feature space is displayed through clustering diagrams, so that the feature extraction effects and mutual discrimination between tasks in multi-task learning can be visualized; the above series of detailed and intuitive visualization methods provide sufficient data support and theoretical basis for model performance evaluation, verification of the rationality of multi-task weight configuration, and model convergence stability.

[0065] The bearing fault diagnosis method based on domain generalization uses a 900r / min speed working condition data set as the target domain, and 600r / min, 1200r / min, and 1500r / min speed working condition data sets as three source domains. The source domains are used to train the model and the shared features between the source domains are extracted to obtain better generalization effect. The test results are as follows: Figure 6 、 Figure 7 shown.

[0066] This method uses multi-source domain data to construct a fault feature space, so that the features learned by the model can not only reflect the inherent fault mechanism of the equipment, but also adapt to the differences in data distribution caused by different working conditions in the target domain, thereby significantly improving the generalization ability, robustness and accuracy of the fault diagnosis model. At the same time, by optimizing the data acquisition and preprocessing strategies, the risk of overfitting caused by uneven sample distribution is effectively reduced. Based on this, the present invention can accurately and reliably diagnose faults of mechanical equipment when facing unknown working conditions in actual industrial environments, ensuring that the system still has excellent adaptability and stability under complex operating conditions, thereby demonstrating great engineering application value.

Claims

1. A bearing fault diagnosis method based on domain generalization, characterized by: Multi-scale feature fusion is used to extract features in the data at different scales through expansion rates of different scales. The global features and detail features in the original signal data are then extracted by the attention mechanism. After deep extraction by shared feature extractors and private feature extractors, feature separation is achieved by minimizing the mutual information loss, difference loss, similarity loss, and maximum mean difference (MMD) loss function. During the training process, the optimal model with the highest training accuracy is saved and tested using a dataset of unknown working conditions.

2. The bearing fault diagnosis method based on domain generalization according to claim 1 is characterized in that Feature extraction using a multi-scale attention mechanism follows these steps: Step 1: Deep network feature extraction; In each round of training, data from two of the five or more working conditions are extracted. Each working condition contains six types of fault data. The fault data for each working condition is divided into batches of 128 using a random sampling strategy. A total of 100 rounds of training are conducted, and each round of training uses a different combination of two working conditions. The test data in this experiment uses working conditions different from the two training conditions. Different working conditions represent different speeds. There are more than five speeds in the data set. First, the fault data is input into the encoder for preliminary feature extraction. The main structure of the encoder first expands the original input to 32 channels through 1×1 convolution, with a stride of 1 for the first time and 2 for the next three times, with padding of 1. After cross-domain feature alignment through a domain-aware batch normalization layer with the number of channels equal to the output data dimension, feature abstraction is achieved through a four-level residual coding module. Each level of the module adopts a dual-path convolution structure with a kernel size of 3×3 and a padding of 1. The dimension is gradually compressed through layer-by-layer downsampling with a stride of 2 to obtain an output feature. The same module only changes the input and output data dimensions, and there are four repeated operations. Each time, the output features of the previous operation are used as the input features of the next operation. The first input dimension is 16, the output dimension is 32, and the step size is 1. The second input dimension is 32, the output dimension is 64, and the step size is 2. The third input dimension is 64, the output dimension is 128, and the step size is 2. The fourth input dimension is 128, the output dimension is 192, and the step size is 2. The dimension of the feature increases with the increase of the layer, and finally a deep feature is extracted, and then the extracted features are subjected to multi-scale feature fusion. Step 2: Multi-scale feature fusion; Build a deep neural network to extract the required features from the collected data, and use multi-scale feature fusion; First, feature extraction is performed at five scales, four of which are convolution branches and the other is a pooling branch. Each branch uses a 1-dimensional convolution operation with 192 input channels, 32 output channels, and a convolution kernel size of 5. However, each branch uses a different dilation rate (1, 2, 3, and 4), respectively, to achieve effective receptive fields of 5, 9, 13, and 17, respectively. After the convolution operation, each convolution branch is sequentially provided with an adaptive maximum pooling layer with a channel length of 1 to reduce the size of the output feature map to 1; followed by a batch normalization layer and a ReLU activation function for 32 channels, with an output dimension of 128, the sum of the output channels of the four convolution branches, to finally extract features at different scales. Step 3: Attention mechanism extracts effective features; The CBAM module is embedded in front of the feature encoder to first enhance the model's ability to extract fault data features; Its architecture is as follows: First, the channel attention submodule extracts global statistical features in the channel dimension through dual-path global pooling. The input dimension is the output dimension of the multi-scale feature fusion module, which is 128. It first passes through the adaptive average pooling layer with an output length of 1, then passes through the adaptive maximum pooling layer with an output length of 1, and finally passes through the bottleneck fully connected layer with a compression ratio of 16 to generate the channel weight matrix. The outputs of the adaptive average pooling layer and the adaptive maximum pooling layer are then added and normalized using the Sigmoid function and multiplied by the input features channel by channel. Subsequently, the spatial attention submodule aggregates the maximum and mean feature maps along the channels of the first dimension, passes through a convolutional layer with a convolution kernel size of 7×7, an input dimension of 2, an output dimension of 1, and a padding of 2, and then normalizes it with the sigmoid function and multiplies it channel by channel with the input features to generate a spatial attention mask. This is then multiplied point by point with the channel-optimized features to obtain the output data. Finally, the output data of the previous step with a dimension of 320 is input to the linear layer again, with an input of 320 and an output of 512. Then, the elements are randomly set to zero with a default probability of 0.5 through the Dropout layer. Finally, the input is passed through a linear layer with a dimension of 512 and the output is a 256-dimensional feature. This output feature is used to process the loss function during training and complete the model iteration. During the test, the probability prediction module is used to further reduce the dimension of the 256-dimensional features extracted above through a linear layer with an input dimension of 256 and an output dimension of 6, obtaining an output feature of dimension 6, which corresponds to the probabilities of the six fault types for each type of working condition.

3. The bearing fault diagnosis method based on domain generalization according to claim 2 is characterized by the following features: The steps for decoupling and generalizing the model are as follows: Step 1: Measure the similarity of features Assume that there are two encoders with the same structure, namely a shared encoder and a private encoder. The outputs of the two encoders are called shared features and private features. The two working condition data extracted from the five working conditions in step 1 are both called source domain data. The two features extracted by the two source domain shared encoders will be measured by similarity loss. The specific formula of this loss is as follows: in Represents X s Taken from the first source domain, G D represents the domain discriminator, E s represents the shared feature encoder, X s Represents the feature data of one of the source domains, X t Represents the feature data of the second source domain; Step 2: Expand the differences between features The difference between the shared features and private features in the domain is measured through a difference loss. The specific formula is as follows: in represents the squared Frobenius norm, Represents the transposition operation of the feature matrix extracted by the shared feature extractor from one of the source domains, represents the features taken from source domain 1 and passed through the shared feature extractor, represents the features taken from source domain 2 and processed by a private feature extractor, represents the features taken from source domain 1 and processed by the private feature extractor; Step 3: Mutual Information Loss Processing The specific formula of mutual information loss is as follows: where X i Represents the features extracted by the decoder, X i represents the original input data, Represents X i Taken from a certain batch, Represents a certain package batch, X j Indicates that this data is taken from another package batch, exp(g) represents the natural exponential function, and f(g) represents the original feature X i and reconstruct feature X i The covariance matrix between is defined as follows: Let X1 = Xi, X2 = X i , X=(X1,X2) T It is called a matrix is the covariance matrix of the random variable X, where cij=Cov(X i ,X j )=E[(X i -μ i )(X j -μ j )](5) Where μi=E[Xi], μj=E[Xj], i, j=1, 2; E[g] represents the mathematical expectation value of each component in the vector; Step 4: Close the feature distance by maximizing the mean difference The specific formula of the maximum mean difference loss function is as follows: where X s ={x s i ,...,x s n } and X t ={x t i ,...,x t m } represents the datasets of the two domains, φ represents the kernel function that maps the source data and target data to the Reproducing Kernel Hilbert Space (RKHS), and n and m are the number of source samples and target samples, respectively. The representation norm is calculated in the reproducing kernel Hilbert space generated by the kernel function k; After calculating the above losses, all losses are weighted and summed to get the total loss. The weights are obtained in the order of the loss functions introduced above: 80, 0.001, 0.05, 1; corresponding to similarity loss, difference loss, mutual information loss, and maximum mean difference loss, respectively.