Few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism

By using a method based on WRNN and cross-block attention mechanism, continuous wavelet convolution and global-local feature learning modules, the accuracy problem of bearing fault diagnosis under few-sample conditions is solved, efficient fault feature extraction and diagnosis are achieved, and the accuracy and computational efficiency of fault detection are improved.

CN120822129APending Publication Date: 2025-10-21DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510945734.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-10-21

AI Technical Summary

Technical Problem

In actual industrial scenarios, the scarcity of bearing failures leads to insufficient training samples, reducing the effectiveness of existing data-driven fault diagnosis technologies. Especially when the early fault characteristics are not obvious, model-based fault diagnosis methods cannot effectively detect them, resulting in a decrease in fault diagnosis accuracy or even inability to achieve them.

Method used

A method based on WRNN and cross-block attention mechanism is adopted to extract multi-scale time-frequency information through continuous wavelet convolution module. Combined with global and local feature learning modules, cross-block attention mechanism and WRNN algorithm are used to extract and diagnose fault features under few-sample conditions. The method includes continuous wavelet convolution module, global feature learning module, local feature learning module and fault classification module, and the cross-entropy and contrast loss functions are used to optimize the model.

Benefits of technology

The accuracy of bearing fault diagnosis is improved under the condition of few samples, the probability of misdiagnosis and missed diagnosis is reduced, an accurate basis for equipment maintenance and repair is provided, and computing efficiency and resource utilization are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120822129A_ABST
    Figure CN120822129A_ABST
Patent Text Reader

Abstract

The invention discloses a few-sample bearing fault diagnosis method based on a WRNN and a cross-block attention mechanism. The method comprises the steps that S1, a bearing fault data set with insufficient samples is acquired; s2, establishing a bearing fault diagnosis model, including a continuous wavelet convolution module used for extracting bearing fault features fused with multi-scale time-frequency information from a bearing fault data set, and better learning bearing fault features of limited samples; the global feature learning module is used for extracting global bearing fault features based on a cross-block attention mechanism, the computing resource demand is reduced, and the computing efficiency is improved; the local feature learning module is used for extracting local bearing fault features by adopting a WRNN algorithm; and S3, bearing fault diagnosis is carried out based on the trained bearing fault diagnosis model and actually acquired bearing operation data. The probability of misdiagnosis and missed diagnosis can be reduced under the condition of few samples, and an accurate basis is provided for maintenance and repair of equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of bearing fault diagnosis, and in particular to a few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism. Background Art

[0002] Bearings are a common and essential component of modern machinery and are widely used in industry. Prolonged operation can lead to bearing failure, which can lead to increased maintenance costs, reduced productivity, and even serious financial losses and safety hazards. Fault diagnosis can reduce operating expenses and ensure stable bearing performance.

[0003] Bearing fault diagnosis methods fall into two main categories: model-based approaches and data-driven technologies. Model-based approaches rely on thresholds of different signals at the fault frequency to determine whether a fault has occurred. By analyzing collected data, data-driven technologies can schedule maintenance measures to ensure bearing safety.

[0004] The scarcity of faults in real industrial scenarios leads to insufficient training samples, reducing the effectiveness of data-driven fault diagnosis techniques. When early fault features are not obvious, model-based fault diagnosis methods may fail to detect them. Data-driven fault diagnosis techniques, when dealing with limited samples, hinder the effective extraction of fault features and accurate fault diagnosis. Summary of the Invention

[0005] The present invention provides a few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism to overcome the technical problem that in actual industry, sufficient fault diagnosis data cannot be collected, resulting in a decrease in the accuracy of the fault diagnosis model or even the inability to perform fault diagnosis.

[0006] In order to achieve the above object, the technical solution of the present invention is:

[0007] A few-shot bearing fault diagnosis method based on WRNN and cross-block attention mechanism is proposed. The specific steps include:

[0008] S1: Obtain a bearing fault dataset with insufficient sample size, where the bearing fault dataset includes N types of faults, each type of fault includes K sample data, where N>0 and K>0;

[0009] S2: establishing a bearing fault diagnosis model, training the bearing fault diagnosis model based on the bearing fault data set, and obtaining a trained bearing fault diagnosis model when a set loss function converges;

[0010] The bearing fault diagnosis model includes a continuous wavelet convolution module, a global feature learning module, a local feature learning module and a fault classification module;

[0011] The continuous wavelet convolution module is used to extract bearing fault features that integrate multi-scale time-frequency information from the bearing fault data set;

[0012] The global feature learning module is used to extract the global bearing fault feature from the bearing fault feature fused with multi-scale time-frequency information based on the cross-block attention mechanism;

[0013] The local feature learning module is used to extract local bearing fault features from the bearing fault features fused with multi-scale time-frequency information using a WRNN algorithm;

[0014] The fault classification module is used to perform weighted summation on the global bearing fault features and the local bearing fault features, and output a bearing fault diagnosis result based on the weighted summation result;

[0015] S3: Perform bearing fault diagnosis based on the trained bearing fault diagnosis model and the actually acquired bearing operation data.

[0016] Furthermore, the specific steps of extracting the bearing fault features integrating multi-scale time-frequency information from the bearing fault data set by the continuous wavelet convolution module include:

[0017] The bearing fault data set is subjected to continuous wavelet transform using wavelet basis functions with different scale parameters and translation parameters to obtain multi-scale time-frequency features.

[0018] Perform convolution operation on multi-scale time-frequency features to obtain bearing fault features that integrate multi-scale time-frequency information;

[0019] The processing formula of the continuous wavelet convolution module is:

[0020] h=ψ a,b (t)*x

[0021] Among them, h represents the output feature, ψ a,b (t) represents the wavelet basis function with scale a and translation b, * represents the continuous signal convolution, and x is the input bearing fault dataset.

[0022] Furthermore, the global feature learning module includes a cross-block attention mechanism, a normalization layer, a first linear layer, a GELU activation function layer, and a second linear layer;

[0023] The specific steps of extracting the global bearing fault feature from the bearing fault feature fused with multi-scale time-frequency information based on the cross-block attention mechanism by the global feature learning module include:

[0024] After performing attention calculation processing on the bearing fault features of the fused multi-scale time-frequency information through the cross-block attention mechanism, the feature is transmitted to the normalization layer;

[0025] The output result of the attention calculation is normalized by the normalization layer and then transmitted to the first linear layer;

[0026] After the data transmitted by the normalization layer is linearly processed by the first linear layer, it is transmitted to the GELU activation function layer;

[0027] After performing nonlinear processing on the data transmitted by the first linear layer through the GELU activation function layer, the data is transmitted to the second linear layer;

[0028] After the second linear layer performs linear processing on the data transmitted by the GELU activation function layer, the global bearing fault feature is output.

[0029] Furthermore, the specific steps of performing attention calculation on the bearing fault feature integrating the multi-scale time-frequency information by the cross-block attention mechanism include:

[0030] Compressing the bearing fault features fused with multi-scale time-frequency information to obtain a feature vector with a size of 1×1;

[0031] Dynamically model the association of feature vectors of size 1×1 through a parameterized attention mechanism to generate multi-headed queries, keys, and values;

[0032] Using multi-head query, the key and value are weighted summed to obtain multi-head results;

[0033] The multi-head results are concatenated and linear transformation is applied to generate the attention calculation processing result.

[0034] Furthermore, the specific steps of extracting local bearing fault features from the bearing fault features fused with multi-scale time-frequency information by the local feature learning module using the WRNN algorithm include:

[0035] Set the initial number of neighbors p;

[0036] Dividing the bearing fault features fused with multi-scale time-frequency information into test samples to be classified and labeled samples, and calculating the distance between the test samples to be classified and all training samples;

[0037] After sorting in ascending order according to distance, for each test sample to be classified, select p samples with the smallest distance value from the training samples and use them as the final neighbors to form the initial neighbor set;

[0038] Furthermore, if there are tied values ​​that result in the number of samples exceeding the required number, one or more samples are randomly selected from the tied values ​​so that the number of samples meets the requirement;

[0039] Eliminate the point with the largest distance value from the initial nearest neighbor set to obtain a streamlined nearest neighbor set;

[0040] Assign weights based on the distance values ​​of samples in the reduced neighbor set;

[0041] Calculate the weighted label distribution based on the labels of the samples in the streamlined nearest neighbor set and the corresponding weights, and select the label with the highest probability as the predicted label;

[0042] Aggregate the features of the samples in the streamlined neighbor set according to the weights to obtain aggregated features;

[0043] The aggregated features and predicted labels are used as local bearing fault features of the test sample.

[0044] Furthermore, the set loss function includes: a cross entropy loss function and a contrast loss function;

[0045] The cross entropy loss function is used to calculate the loss of the global feature learning module. The cross entropy loss function is expressed as:

[0046]

[0047] Where i is the category index, P(i) and Q(i) represent the probability of the i-th category fault in the real distribution and the predicted distribution, respectively;

[0048] The contrast loss function is used to calculate the loss of the local feature learning module. The contrast loss function is expressed as:

[0049] L=1 / N*∑[y*d 2 +(1-y)*max(margin-d,0) 2 ]

[0050] Where d represents the Euclidean distance between two points, y is a binary indicator variable, margin is the set boundary threshold, and N is the total number of samples.

[0051] Beneficial Effects: The present invention establishes a bearing fault diagnosis model capable of diagnosing bearing faults based on a small number of sample data. It utilizes a continuous wavelet convolution module for feature extraction to better learn the bearing fault characteristics of a limited number of samples. Based on a cross-block attention mechanism, global bearing fault characteristics are extracted from bearing fault characteristics that fuse multi-scale time-frequency information, reducing computational resource requirements and improving computational efficiency. The WRNN algorithm is used to more meticulously explore the intrinsic connections between samples, achieving better local feature learning. In the case of a small number of samples, the probability of misdiagnosis and missed diagnosis can be reduced, providing an accurate basis for equipment maintenance and repair. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0053] Figure 1 This is a flowchart of a few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism in the present invention;

[0054] Figure 2 1 is a diagnostic flow chart of a bearing fault diagnosis model according to an embodiment of the present invention;

[0055] Figure 3 The confusion matrix diagram of the fault diagnosis of five samples in the embodiment of the present invention is shown;

[0056] Figure 4 FIG4 is a confusion matrix diagram of a sample fault diagnosis in an embodiment of the present invention. DETAILED DESCRIPTION

[0057] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0058] This embodiment provides a few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism. Figure 1 and Figure 2 As shown, the specific steps include:

[0059] S1: Obtain a bearing fault dataset with insufficient sample size, where the bearing fault dataset includes N types of faults, each type of fault includes K sample data, where N>0 and K>0;

[0060] Specifically, the bearing fault data set is in the form of N-way, K-shot. In this embodiment, the value of N is 10, and the value of K is generally 1 or 5.

[0061] S2: establishing a bearing fault diagnosis model, training the bearing fault diagnosis model based on the bearing fault data set, and obtaining a trained bearing fault diagnosis model when a set loss function converges;

[0062] The bearing fault diagnosis model includes a feature extraction module, a global feature learning module, a local feature learning module and a fault classification module;

[0063] The feature extraction module is used to extract bearing fault features that integrate multi-scale time-frequency information from the bearing fault data set;

[0064] The global feature learning module is used to extract the global bearing fault feature from the bearing fault feature fused with multi-scale time-frequency information based on the cross-block attention mechanism;

[0065] The local feature learning module is used to extract local bearing fault features from the bearing fault features fused with multi-scale time-frequency information using a WRNN algorithm;

[0066] The fault classification module is used to perform weighted summation on the global bearing fault features and the local bearing fault features, and output a bearing fault diagnosis result based on the weighted summation result;

[0067] S3: Perform bearing fault diagnosis based on the trained bearing fault diagnosis model and the actually acquired bearing operation data.

[0068] In a specific embodiment, the specific steps of extracting the bearing fault features by the continuous wavelet convolution module from the bearing fault data set by integrating multi-scale time-frequency information include:

[0069] First, we use the wavelet basis function ψ with different scale parameters and translation parameters a,b (t) Performing continuous wavelet transform (CWT) on the bearing fault dataset to obtain multi-scale time-frequency features;

[0070] Then, convolution operation is performed on the multi-scale time-frequency features to obtain the bearing fault features that integrate the multi-scale time-frequency information;

[0071] The processing formula of the continuous wavelet convolution module is:

[0072] h=ψ a,b (t)*x

[0073] Among them, h represents the output feature, ψ a,b (t) represents the wavelet basis function with scale a and translation b, * represents the continuous signal convolution, and x is the input bearing fault dataset.

[0074] Specifically, as a joint time-scale analysis method, continuous wavelet transform can extract multi-scale time-frequency features from the bearing fault data set by utilizing its multi-resolution characteristics. The continuous wavelet transform can be expressed as:

[0075]

[0076] Among them, Wx(a,b) is the result of wavelet transform,<x(t),ψa,b(t)> represents the inner product of the signal to be analyzed x(t) and the wavelet basis function ψa,b(t), represents the complex conjugate, a is the scale parameter, b is the translation parameter, and ψ(·) represents the mother wavelet.

[0077] Specifically, a convolutional neural network (CNN) is used to perform convolution operations on multi-scale time-frequency features. The basic principle of CNN is to extract local features through convolution layers and reduce dimensionality through pooling operations. It can directly extract the optimal feature representation from the original input data, avoiding the limitations of traditional methods that rely on manually designed features. The convolutional neural network is represented as:

[0078]

[0079] Where x' is the input tensor, ω is the convolution kernel, b' is the offset term, i, j are the output spatial position indexes of the feature map, and m, n are the spatial position indexes of the convolution kernel; is the output of the convolutional layer, is the output of the pooling layer.

[0080] Specifically, this embodiment employs continuous wavelet convolution (CWConv), fusing CWT with a convolutional neural network to achieve multi-scale time-frequency feature extraction, effectively capturing local signal variations and complex patterns. CWConv utilizes wavelet kernels with varying scales and transformation parameters, enabling processing of non-stationary signals and multi-scale feature extraction, enabling deeper feature extraction compared to traditional CWT.

[0081] In a specific embodiment, the global feature learning module includes a cross-block attention mechanism, a normalization layer, a first linear layer, a GELU activation function layer, and a second linear layer;

[0082] The specific steps of extracting the global bearing fault feature from the bearing fault feature fused with multi-scale time-frequency information based on the cross-block attention mechanism by the global feature learning module include:

[0083] After performing attention calculation processing on the bearing fault features of the fused multi-scale time-frequency information through the cross-block attention mechanism, the feature is transmitted to the normalization layer;

[0084] The output result of the attention calculation is normalized by the normalization layer and then transmitted to the first linear layer;

[0085] After the data transmitted by the normalization layer is linearly processed by the first linear layer, it is transmitted to the GELU activation function layer;

[0086] After performing nonlinear processing on the data transmitted by the first linear layer through the GELU activation function layer, the data is transmitted to the second linear layer;

[0087] After the second linear layer performs linear processing on the data transmitted by the GELU activation function layer, the global bearing fault feature is output.

[0088] Specifically, the cross-block attention mechanism CAT is a novel Transformer architecture. By alternately applying global and local attention, CAT solves the bottlenecks of Transformer in computational complexity and efficiency, significantly reducing computational costs.

[0089] This embodiment reconstructs the calculation mode of CAT by simplifying its structure to obtain a cross-block attention mechanism.

[0090] In a specific embodiment, the specific steps of performing attention calculation on the bearing fault feature of the fused multi-scale time-frequency information through the cross-block attention mechanism include:

[0091] Compressing the bearing fault feature fused with the multi-scale time-frequency information to obtain a feature vector with a size of 1×1;

[0092] Specifically, this embodiment uses adaptive pooling to compress the feature map into a feature vector of size 1×1, that is, by compressing the spatial dimension of the bearing fault feature that integrates multi-scale time-frequency information into a single step, the data structure is simplified, laying the foundation for subsequent processing.

[0093] Dynamically model the association of feature vectors of size 1×1 through a parameterized attention mechanism to generate multi-headed queries, keys, and values;

[0094] Specifically, through the multi-head self-attention mechanism (MultiheadAttention) of the Encoder module in the Transformer model, data samples are interactively modeled to achieve multi-head projection of features. At the same time, by dividing the input features into multiple subspaces for parallel processing, the computational efficiency is optimized. At the same time, it can effectively capture the dependencies between samples and improve the expressiveness of features.

[0095] Using multi-head query, the key and value are weighted summed to obtain multi-head results;

[0096] The multi-head results are concatenated and linear transformation is applied to generate the attention calculation processing result.

[0097] The global feature learning module of this embodiment can effectively capture global features through the cross-block attention mechanism. The proposed lightweight CAT significantly improves the efficiency of computing resources while ensuring the accurate extraction of global features. When processing bearing fault features, it can complete the feature processing task more efficiently with limited computing resources, providing strong support for bearing fault diagnosis.

[0098] In a specific embodiment, the specific steps of extracting local bearing fault features from the bearing fault features fused with multi-scale time-frequency information by the local feature learning module using the WRNN algorithm include:

[0099] Set the initial number of neighbors p;

[0100] Dividing the bearing fault features fused with multi-scale time-frequency information into test samples to be classified and labeled training samples, and calculating the distance between the test samples to be classified and all training samples;

[0101] After sorting in ascending order according to distance, for each test sample to be classified, select p samples with the smallest distance value from the training samples and use them as the final neighbors to form the initial neighbor set;

[0102] Furthermore, if there are tied values ​​that result in the number of samples exceeding the required number, one or more samples are randomly selected from the tied values ​​so that the number of samples meets the requirement;

[0103] Eliminate the point with the largest distance value from the initial nearest neighbor set to obtain a streamlined nearest neighbor set;

[0104] Assign weights based on the distance values ​​of samples in the reduced neighbor set;

[0105] Calculate the weighted label distribution based on the labels of the samples in the streamlined nearest neighbor set and the corresponding weights, and select the label with the highest probability as the predicted label;

[0106] Aggregate the features of the samples in the streamlined neighbor set according to the weights to obtain aggregated features;

[0107] The aggregated features and predicted labels are used as local bearing fault features of the test sample.

[0108] Specifically, because conventional KNN only calculates the distance between k adjacent points and does not consider the weighting of samples, this embodiment uses the WKNN algorithm to reduce computational overhead and improve efficiency. This algorithm combines the distance between the test and training samples and assigns variable weights to each neighbor. By weighting the samples, samples that are more similar to and relevant to the target sample play a greater role in feature learning, reducing information omission and waste. For example, if a certain type of fault sample is relatively rare, but its distance relationship with other samples indicates unique characteristics, the WRNN algorithm can fully learn the characteristics of this type of fault by assigning appropriate weights.

[0109] In a specific embodiment, the set loss function includes: a cross entropy loss function and a contrast loss function;

[0110] The cross entropy loss function is used to calculate the loss of the global feature learning module. The cross entropy loss function is expressed as:

[0111]

[0112] Where i is the category index, P(i) and Q(i) represent the probability of the i-th category fault in the real distribution and the predicted distribution, respectively;

[0113] The contrast loss function is used to calculate the loss of the local feature learning module. The contrast loss function is expressed as:

[0114] L=1 / N*∑[y*d 2 +(1-y)*max(margin-d,0) 2 ]

[0115] Where d represents the Euclidean distance between two points, y is a binary indicator variable used to indicate whether the sample is similar to the label, margin is the set boundary threshold, and N is the total number of samples.

[0116] In order to verify the effectiveness of the method proposed in this embodiment, a CWRU bearing data set was used. The bearing data of the CWRU was collected by an accelerometer fixed at the 12 o'clock position on the motor housing. The test bench was driven by a motor on a shaft equipped with a torque sensor and an encoder. The dynamometer and the electronic system controlled the shaft to apply torque. Single-point corrosion faults were set on the bearings using electrospark machining technology to collect fault data. The fault types included inner ring faults, outer ring faults, and rolling element faults. At the same time, the faulty bearings were located in different positions, at the drive end and the fan end respectively. During the fault data collection process, faults of different diameters (7 mils, 14 mils, 21 mils) were injected into the rolling elements and inner and outer rings of the motor bearings respectively. The sampling frequency was set to 12 kHz, and each condition was recorded for approximately 10 seconds. The sampling length was set to 1024 data points. The bearing fault dataset has a total of 10 categories, including 3 normal fault locations (inner race, outer race, and ball) and 3 different fault sizes (0.007, 0.014, and 0.021 inches), and the faults are collected under four different loads (0, 1, 2, and 3 horsepower).

[0117] This example divides the bearing fault dataset into 10-way, 5-shot, and 10-way, 1-shot models for accuracy verification and ablation experiments. The ablation experiments include: using only the WKNN for local feature extraction (WKNN), using only the RNN for local feature extraction (RNN), eliminating the CWT to verify that CWT extraction improves model learning (CWT), and using global fault diagnosis (CAT) and local fault diagnosis (WRNN).

[0118] This example mainly verifies the feasibility of the solution in two different situations:

[0119] Table 1 shows the experimental results based on a 10-way, 5-shot dataset, when only 5 samples were trained. As can be seen from the table, the method proposed in this embodiment achieves a maximum fault diagnosis accuracy of 98.4%. The fault diagnosis accuracy rates for WKNN, RNN, CWT, CAT, and WRNN are 93.9%, 93.3%, 95.2%, 94.8%, and 37.7%, respectively. While RNNs primarily reduce resource consumption, WKNN improves the accuracy of KNN classification results by assigning different weights. Therefore, WKNN achieves higher accuracy than RNNs, while RNNs consume fewer computing resources during training.

[0120] Table 1 10-way, 5-shot fault diagnosis accuracy

[0121]

[0122] Specifically, the confusion matrix results are as follows Figure 3 As shown in FIG. 1 , under the condition of extremely few samples (5 samples), the method proposed in this embodiment improves the accuracy of fault diagnosis.

[0123] In order to further verify the feasibility of the model, 10-way, 1-shot validation was also used. As shown in Table 2, with only one training sample, the model given in this embodiment achieved a fault diagnosis accuracy of 94.8%. The accuracy of WKNN was 90.6%, the accuracy of RNN was 89.6%, and the accuracy of CWT was 90.1%. The accuracy of CAT and WRNN was 91.5% and 21.6% respectively. The confusion matrix results are shown in Table 2. Figure 4 shown.

[0124] Table 2 10-way, 1-shot fault diagnosis accuracy

[0125]

[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A few-shot bearing fault diagnosis method based on WRNN and cross-block attention mechanism, characterized by: The specific steps include: S1: Obtain a bearing fault dataset with insufficient sample size, where the bearing fault dataset includes N types of faults, each type of fault includes K sample data, where N>0 and K>0; S2: establishing a bearing fault diagnosis model, training the bearing fault diagnosis model based on the bearing fault data set, and obtaining a trained bearing fault diagnosis model when a set loss function converges; The bearing fault diagnosis model includes a continuous wavelet convolution module, a global feature learning module, a local feature learning module and a fault classification module; The continuous wavelet convolution module is used to extract bearing fault features that integrate multi-scale time-frequency information from the bearing fault data set; The global feature learning module is used to extract the global bearing fault feature from the bearing fault feature fused with multi-scale time-frequency information based on the cross-block attention mechanism; The local feature learning module is used to extract local bearing fault features from the bearing fault features fused with multi-scale time-frequency information using a WRNN algorithm; The fault classification module is used to perform weighted summation on the global bearing fault features and the local bearing fault features, and output a bearing fault diagnosis result based on the weighted summation result; S3: Perform bearing fault diagnosis based on the trained bearing fault diagnosis model and the actually acquired bearing operation data.

2. The few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism according to claim 1 is characterized in that: The specific steps of extracting the bearing fault features integrating multi-scale time-frequency information from the bearing fault data set by the continuous wavelet convolution module include: The bearing fault data set is subjected to continuous wavelet transform using wavelet basis functions with different scale parameters and translation parameters to obtain multi-scale time-frequency features. Perform convolution operation on multi-scale time-frequency features to obtain bearing fault features that integrate multi-scale time-frequency information; The processing formula of the continuous wavelet convolution module is: h=ψ a,b (t)*x Among them, h represents the output feature, ψ a,b (t) represents the wavelet basis function with scale a and translation b, * represents the continuous signal convolution, and x is the input bearing fault dataset.

3. The few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism according to claim 2 is characterized in that: The global feature learning module includes a cross-block attention mechanism, a normalization layer, a first linear layer, a GELU activation function layer and a second linear layer; The specific steps of extracting the global bearing fault feature from the bearing fault feature fused with multi-scale time-frequency information based on the cross-block attention mechanism by the global feature learning module include: After performing attention calculation processing on the bearing fault features of the fused multi-scale time-frequency information through the cross-block attention mechanism, the feature is transmitted to the normalization layer; The output result of the attention calculation is normalized by the normalization layer and then transmitted to the first linear layer; After the data transmitted by the normalization layer is linearly processed by the first linear layer, it is transmitted to the GELU activation function layer; After performing nonlinear processing on the data transmitted by the first linear layer through the GELU activation function layer, the data is transmitted to the second linear layer; After the second linear layer performs linear processing on the data transmitted by the GELU activation function layer, the global bearing fault feature is output.

4. The few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism according to claim 3 is characterized in that: The specific steps of performing attention calculation on the bearing fault feature of the fused multi-scale time-frequency information by the cross-block attention mechanism include: Compressing the bearing fault features fused with multi-scale time-frequency information to obtain a feature vector with a size of 1×1; Dynamically model the association of feature vectors of size 1×1 through a parameterized attention mechanism to generate multi-headed queries, keys, and values; Using multi-head query, the key and value are weighted summed to obtain multi-head results; The multi-head results are concatenated and linear transformation is applied to generate the attention calculation processing result.

5. The few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism according to claim 4 is characterized in that: The specific steps of extracting local bearing fault features from the bearing fault features fused with multi-scale time-frequency information by the local feature learning module using the WRNN algorithm include: Set the initial number of neighbors p; Dividing the bearing fault features fused with multi-scale time-frequency information into test samples to be classified and labeled samples, and calculating the distance between the test samples to be classified and all training samples; After sorting in ascending order according to distance, for each test sample to be classified, select p samples with the smallest distance value from the training samples and use them as the final neighbors to form the initial neighbor set; Furthermore, if there are tied values ​​that result in the number of samples exceeding the required number, one or more samples are randomly selected from the tied values ​​so that the number of samples meets the requirement; Eliminate the point with the largest distance value from the initial nearest neighbor set to obtain a streamlined nearest neighbor set; Assign weights based on the distance values ​​of samples in the reduced neighbor set; Calculate the weighted label distribution based on the labels of the samples in the streamlined nearest neighbor set and the corresponding weights, and select the label with the highest probability as the predicted label; Aggregate the features of the samples in the streamlined neighbor set according to the weights to obtain aggregated features; The aggregated features and predicted labels are used as local bearing fault features of the test sample.

6. The few-sample bearing fault diagnosis method based on WRNN and cross-block attention mechanism according to claim 5 is characterized in that: The set loss functions include: cross entropy loss function and contrast loss function; The cross entropy loss function is used to calculate the loss of the global feature learning module. The cross entropy loss function is expressed as: Where i is the category index, P(i) and Q(i) represent the probability of the i-th category fault in the real distribution and the predicted distribution, respectively; The contrast loss function is used to calculate the loss of the local feature learning module. The contrast loss function is expressed as: L=1 / N*∑[y*d 2 +(1-y)*max(margin-d,0) 2 ] Where d represents the Euclidean distance between two points, y is a binary indicator variable, margin is the set boundary threshold, and N is the total number of samples.