A Small Sample Fault Diagnosis Method for Planetary Gearboxes Based on MDGSAM and Swing Transformer
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-02
- Publication Date
- 2026-08-14
AI Technical Summary
在实际工业场景中,设备正常运行时间长,故障数据获取困难,且实验室模拟故障成本高,导致训练样本稀疏
本申请通过格拉姆角差场将一维振动信号转为二维图像,利用多尺度降噪全局稀疏注意力卷积模块提取全局特征,结合改进的 Swin Transformer 模块提取局部特征,并通过自适应特征选择模块融合,实现小样本下的高精度、抗噪故障诊断。
Smart Images

Figure CN122336443B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of mechanical fault diagnosis and artificial intelligence technology, specifically to a small-sample fault diagnosis method for planetary gearboxes based on MDGSAM and SwinTransformer. Background Technology
[0002] Planetary gearboxes, as core components of modern mechanical transmission systems, are widely used in aerospace, automotive, wind power, and agricultural machinery. Due to their frequent exposure to complex environments involving heavy loads, vibration, and variable operating conditions, they are highly susceptible to failures such as tooth wear, tooth breakage, and bearing damage. These failures not only affect equipment performance but can also lead to catastrophic accidents. Therefore, intelligent fault diagnosis for planetary gearboxes is of paramount importance for ensuring equipment reliability.
[0003] Traditional fault diagnosis methods rely heavily on human experience and signal processing techniques, such as spectral analysis and wavelet transform, which are insufficient for handling massive amounts of data and accurately identifying minute faults. While deep learning-based intelligent diagnostic methods have made significant progress in recent years, they heavily depend on large amounts of high-quality labeled data. In real-world industrial scenarios, equipment operates for long periods, fault data acquisition is difficult, and laboratory fault simulation is costly, resulting in sparse training samples. Furthermore, actual vibration signals are often accompanied by strong noise interference and varying operating conditions, making existing methods prone to overfitting or performance degradation under small sample sizes and high noise conditions, thus failing to meet the diagnostic needs of complex industrial scenarios. Summary of the Invention
[0004] In order to solve the above-mentioned technical problems, this application proposes the following technical solution: This application provides a small-sample fault diagnosis method for planetary gearboxes based on MDGSAM and Swin Transformer, including: One-dimensional vibration fault data of a planetary gearbox is acquired, and the one-dimensional vibration fault data is converted into a two-dimensional fault image using the Gram angle difference field; Construct a multi-scale denoising global sparse attention convolution module and an improved Swing Transformer module; After data augmentation, the two-dimensional fault image is input into the multi-scale noise reduction global sparse attention convolution module and the improved Swin Transformer module to extract global spatial features and local detail features. The extracted global spatial features and local detail features are fused together, and the fault classification result is output through an adaptive feature selection module.
[0005] In one possible implementation, acquiring one-dimensional vibration fault data of the planetary gearbox and converting the one-dimensional vibration fault data into a two-dimensional fault image using the Gram angle difference field includes: Acquire the original one-dimensional vibration time sequence signal generated by the planetary gearbox during its motion; The original one-dimensional vibration time series signal is divided into multiple one-dimensional sample segments by using a sliding window of a fixed size; The one-dimensional sample segment is normalized to map the numerical range to a preset interval, resulting in a normalized signal value. The calculation formula is as follows: in, For the first The normalized signal value corresponding to each sampling point The original one-dimensional vibration signal Values of each sampling point, The minimum value in the original signal sample segment. The maximum value in the original signal sample segment. It is a set of one-dimensional vibration signal sample segments; The timestamp is encoded as a polar axis, and the normalized signal value is encoded as a polar angle. The result is converted to polar coordinates and calculated using the following formula: in, For the first The polar angle of each sampling point As the polar axis, For time indexing, It is a constant factor; The correlation between different time points is calculated using the trigonometric difference angle formula, and a Gram angle difference field matrix is constructed to obtain a two-dimensional fault image of a preset size. The calculation formula is as follows: in, The first angular difference field matrix of Gram Line number Column elements, For the first The polar angle of each sampling point For the first The normalized signal value corresponding to each sampling point.
[0006] In one possible implementation, the multi-scale denoising global sparse attention convolutional module includes a multi-scale convolutional layer. The input of the multi-scale convolutional layer is used to receive the input two-dimensional fault image. The output of the multi-scale convolutional layer is connected to the input of the denoising layer. The output of the denoising layer is connected to the global sparse attention mechanism module. The multi-scale convolutional layer contains multiple convolutional kernels of different scales set in parallel. The denoising layer includes a noise estimation convolutional layer, a residual subtraction unit, a ReLU activation function unit, and a batch normalization unit connected in sequence. The global sparse attention mechanism module includes a channel attention branch, a spatial attention branch, and a feature fusion unit. The channel attention branch includes a global pooling unit. The output of the global pooling unit is connected to... The input of the first fully connected network is connected to the input of the second fully connected network, the output of the second fully connected network is connected to the input of the first sparse constraint unit, and the output of the first sparse constraint unit is connected to the input of the first element-wise multiplication unit. The spatial attention branch includes a first convolutional network, the output of the first convolutional network is connected to the input of the second convolutional network, the output of the second convolutional network is connected to the input of the second sparse constraint unit, the output of the second sparse constraint unit is connected to the input of the second element-wise multiplication unit, and the outputs of the first and second element-wise multiplication units are connected to the feature fusion unit.
[0007] In one possible implementation, the two-dimensional fault image is augmented and then input into the multi-scale denoising global sparse attention convolution module to extract global spatial features, including: After data augmentation, the two-dimensional fault image is input into the multi-scale convolutional layer of the multi-scale noise reduction global sparse attention convolutional module. The input two-dimensional fault image is processed in parallel by convolutional kernels of different sizes and then stitched together in the channel dimension to output a multi-scale fusion feature map. The fused feature map is input into the denoising layer of the multi-scale denoising global sparse attention convolutional module. Noise estimation is extracted through a noise estimation convolutional layer, and the calculation formula is as follows: in, To fuse feature maps, For noise estimation; The noise reduction features are calculated based on the noise estimation and the learnable scaling factor, using the following formula: in, For noise reduction features, A learnable scaling factor; The output is a denoised feature map after processing with ReLU activation function and batch normalization. The denoised feature map is input into the channel attention branch of the global sparse attention mechanism module for channel attention calculation; Global pooling is used to compress spatial dimensions to obtain channel global features, and channel attention weights are generated through two fully connected networks and activation functions. Using the first sparsity constraint, channels with channel attention weights higher than a first threshold are retained, resulting in a sparse channel weight matrix. The calculation formula is as follows: in, This is a sparse channel weight matrix. These are the original channel attention weights. The first threshold, For threshold filtering functions; The sparse channel weight matrix is multiplied element-wise with the denoised feature map to obtain the channel-weighted feature map. Spatial attention is then calculated using a two-layer 2D convolutional network. Channels with spatial attention weights exceeding a second threshold are retained using a second sparsity constraint, resulting in a sparse spatial weight matrix. The calculation formula is as follows: in, For sparse space weight matrix, For the original spatial attention weights, The second threshold; The channel-weighted feature map is fused with the sparse spatial weight matrix to obtain the final global spatial features.
[0008] In one possible implementation, the channel-weighted feature map is fused with the sparse spatial weight matrix to obtain the final global sparse attention feature map. The calculation formula is as follows: in, This is a global sparse attention feature map. For channel-weighted feature maps, The feature map after channel attention weighting.
[0009] In one possible implementation, the improved Swing Transformer module includes: a normalization layer, a noise-sensitivity-weighted hybrid displacement window multi-head self-attention module, a residual connection layer, and a residual multilayer perceptron. The normalization layer includes a first normalization layer and a second normalization layer. The residual connection layer includes a first residual connection layer and a second residual connection layer. The input of the first normalization layer is used to receive an input two-dimensional fault image. The output of the first normalization layer is connected to the input of the noise-sensitivity-weighted hybrid displacement window multi-head self-attention module. The output of the noise-sensitivity-weighted hybrid displacement window multi-head self-attention module is connected to the input of the first residual connection layer. The output of the first residual connection layer is connected to both the input of the second normalization layer and the input of the second residual connection layer. The output of the second normalization layer is connected to the input of the residual multilayer perceptron. The output of the residual multilayer perceptron is connected to the input of the second residual connection layer.
[0010] In one possible implementation, the two-dimensional fault image is augmented and then input into the improved Swing Transformer module to extract local detail features, including: The two-dimensional fault image is augmented and then input into the first normalization layer of the improved Swing Transformer module for processing to obtain the first normalized feature. The first normalized feature is input into the noise sensitivity-weighted hybrid displacement window multi-head self-attention module, and the window multi-head self-attention, horizontal stripe multi-head self-attention and vertical stripe multi-head self-attention are calculated in parallel. The window multi-head self-attention, horizontal stripe multi-head self-attention, and vertical stripe multi-head self-attention are weighted and fused using learnable weight parameters, and dynamically modulated based on noise sensitivity to output attention features. The weighted fusion formula is as follows: in, For hybrid attention output, For multi-head self-attention of windows, For horizontal stripes, multi-head self-attention, For vertical stripes, multi-head self-attention, , , These are learnable weight coefficients; The attention features are input into the first residual connection layer and added element-wise to the enhanced two-dimensional fault image to obtain the first residual connection features; The first residual connection feature is input into the second normalization layer for normalization processing to obtain the second normalized feature; The second normalized feature is input into the residual multilayer perceptron and subjected to the first linear transformation, ReLU activation function, and second linear transformation in sequence, and then the multilayer perceptron feature is output. The multilayer perceptron features are input into the second residual connection layer and added element-wise with the first residual connection features to obtain local detail features.
[0011] In one possible implementation, the calculation formula for the residual multilayer perceptron is: in, For layer normalization operation, It is a multilayer perceptron. The ReLU activation function is used to input features into the residual multilayer perceptron. , This is the weight matrix. , This is a bias term.
[0012] In one possible implementation, the step of fusing the extracted global spatial features and local detail features, and outputting the fault classification result through an adaptive feature selection module, includes: The extracted global spatial features and local detail features are fused to obtain fused features; The fused features are input into the adaptive feature selection module, where global average pooling is performed by the global average pooling unit to generate global statistical features for each channel. The calculation formula is as follows: in, For the first Global statistical characteristics of each channel For feature map height, The width of the feature map. For the first One channel, Location feature value For the feature map height orientation index, Indexed along the width direction of the feature map; The global statistical features are input into the first fully connected layer of the adaptive feature selection module for channel number compression, and then nonlinear activation is performed through the ReLU activation function unit to obtain the activated features. The activated features are input into the second fully connected layer of the adaptive feature selection module to restore the number of channels, and then channel weight coefficients are generated by the Sigmoid function. The generated channel weight coefficients are multiplied element-wise with the fused features to complete the adaptive feature weighting. The calculation formula is as follows: in, For the adaptive weighted number of th Each channel characteristic, For the first The weighting coefficients of each channel For the weighted first The fusion characteristics of each channel; After completing the adaptive feature weighting, the weighted features are converted into a fault category probability distribution, and the fault classification result corresponding to the maximum probability is output.
[0013] Compared with the prior art, the beneficial effects of this application are as follows: This application converts one-dimensional vibration signals into two-dimensional images using Gram angle difference fields, extracts global features using a multi-scale noise reduction global sparse attention convolution module, extracts local features using an improved Swin Transformer module, and fuses them using an adaptive feature selection module to achieve high-precision, noise-resistant fault diagnosis with small sample sizes.
[0014] This application effectively solves the problems of difficulty in extracting fault features and easy overfitting of models under strong noise, variable operating conditions and small sample conditions, and significantly improves the accuracy and robustness of intelligent diagnosis of planetary gearboxes. Attached Figure Description
[0015] Figure 1 A flowchart illustrating a small-sample fault diagnosis method for planetary gearboxes based on MDGSAM and Swin Transformer, provided for embodiments of this application; Figure 2 A schematic diagram of the overall fault diagnosis method for planetary gearboxes based on MDGSAM and Swin Transformer provided in the embodiments of this application; Figure 3 A schematic diagram illustrating the Gram angle difference field coding principle provided in this application embodiment; Figure 4 This is a schematic diagram of a multi-scale convolutional structure provided in an embodiment of this application; Figure 5 A structural diagram of the global sparse attention mechanism provided in the embodiments of this application; Figure 6 This is a structural diagram of the improved Swing Transformer module provided in the embodiments of this application; Figure 7 This is a structural diagram of the adaptive feature selection module provided in an embodiment of this application. Detailed Implementation
[0016] The present solution will now be described in conjunction with the accompanying drawings and specific embodiments.
[0017] Figure 1 A flowchart illustrating a small-sample fault diagnosis method for planetary gearboxes based on MDGSAM and Swin Transformer, provided as an embodiment of this application, is shown below. Figure 1 and Figure 2 This embodiment presents a small-sample fault diagnosis method for planetary gearboxes based on MDGSAM and SwinTransformer, comprising: S101, acquire one-dimensional vibration fault data of the planetary gearbox, and convert the one-dimensional vibration fault data into a two-dimensional fault image using Gram angle difference field.
[0018] In this embodiment, the original one-dimensional vibration time series signal generated by the planetary gearbox during its movement is acquired. A fixed-size sliding window is used to divide the original one-dimensional vibration time series signal into multiple one-dimensional sample segments. To overcome the limitations of one-dimensional signal feature representation, Gram Angular Difference Field (GADF) is used to map the one-dimensional time series into a two-dimensional image. GADF can effectively preserve the temporal information and dynamic characteristics of the time series and has strong robustness to noise.
[0019] The specific encoding process is as follows: Figure 3 As shown, the one-dimensional sample segment is normalized to map the numerical range to a preset interval, resulting in the normalized signal value. The calculation formula is as follows: in, For the first The normalized signal value corresponding to each sampling point The original one-dimensional vibration signal Values of each sampling point, The minimum value in the original signal sample segment. The maximum value in the original signal sample segment. Given a set of one-dimensional vibration signal sample segments, the timestamps are encoded as polar axes, and the normalized signal values are encoded as polar angles. The result is then converted to polar coordinates and calculated using the following formula: in, For the first Polar angle of each sampling point d, As the polar axis, For time indexing, As a constant factor, the correlation between different time points is calculated using the trigonometric function difference angle formula, and the Gram angle difference field matrix is constructed, ultimately yielding a matrix of size [missing information]. The two-dimensional fault image is calculated using the following formula: in, The first angular difference field matrix of Gram Line number Column elements, For the first The polar angle of each sampling point For the first The normalized signal value corresponding to each sampling point.
[0020] To enhance the model's generalization ability, data augmentation operations such as random horizontal flipping, random rotation, scaling, random cropping, image filling, and color jittering are performed on the generated two-dimensional fault images to expand the diversity of training samples.
[0021] S102, constructs a multi-scale denoising global sparse attention convolution module and an improved Swin Transformer module.
[0022] In this embodiment, the multi-scale denoising global sparse attention convolution module includes a multi-scale convolution layer. The input end of the multi-scale convolution layer is used to receive the input two-dimensional fault image. The output end of the multi-scale convolution layer is connected to the input end of the denoising layer, and the output end of the denoising layer is connected to the global sparse attention mechanism module.
[0023] like Figure 4 As shown, the multi-scale convolutional layer contains multiple convolutional kernels of different scales set in parallel. By processing the input image in parallel with convolutional kernels of different sizes, it captures multi-level features from local details to global patterns. To suppress strong noise interference, a denoising layer is introduced, which includes a noise estimation convolutional layer, a residual subtraction unit, a ReLU activation function unit, and a batch normalization unit connected in sequence.
[0024] To enhance the representation of key fault features, a global sparse attention mechanism module is designed, such as... Figure 5As shown, the global sparse attention mechanism module includes a channel attention branch, a spatial attention branch, and a feature fusion unit. The channel attention branch includes a global pooling unit, the output of which is connected to the input of a first fully connected network. The output of the first fully connected network is connected to the input of a second fully connected network. The output of the second fully connected network is connected to the input of a first sparse constraint unit. The output of the first sparse constraint unit is connected to the input of a first element-wise multiplication unit. The spatial attention branch includes a first convolutional network, the output of which is connected to the input of a second convolutional network. The output of the second convolutional network is connected to the input of a second sparse constraint unit. The output of the second sparse constraint unit is connected to the input of a second element-wise multiplication unit. The outputs of the first and second element-wise multiplication units are connected to the feature fusion unit. The first and second convolutional networks are two-dimensional convolutional networks.
[0025] like Figure 6 As shown, for traditional Swin Transformer To address the shortcomings in long-range dependency modeling, a noise-sensitivity-weighted hybrid displacement window multi-head self-attention mechanism is proposed. The improved Swing Transformer module includes: a normalization layer, a noise-sensitivity-weighted hybrid displacement window multi-head self-attention module, a residual connection layer, and a residual multilayer perceptron. The normalization layer includes a first normalization layer and a second normalization layer. The residual connection layer includes a first residual connection layer and a second residual connection layer. The input of the first normalization layer is used to receive the input two-dimensional fault image. The output of the first normalization layer is connected to the input of the noise-sensitivity-weighted hybrid displacement window multi-head self-attention module. The output of the noise-sensitivity-weighted hybrid displacement window multi-head self-attention module is connected to the input of the first residual connection layer. The output of the first residual connection layer is connected to the inputs of the second normalization layer and the second residual connection layer, respectively. The output of the second normalization layer is connected to the input of the residual multilayer perceptron. The output of the residual multilayer perceptron is connected to the input of the second residual connection layer.
[0026] S103: After data augmentation, the two-dimensional fault image is input into the multi-scale noise reduction global sparse attention convolution module and the improved Swin Transformer module to extract global spatial features and local detail features.
[0027] In this embodiment, the two-dimensional fault image, after data augmentation, is input into the multi-scale convolutional layer of the multi-scale denoising global sparse attention convolutional module. The input two-dimensional fault image is processed in parallel using convolutional kernels of different sizes, and then stitched together along the channel dimension to output a multi-scale fused feature map. The fused feature map is then input into the denoising layer of the multi-scale denoising global sparse attention convolutional module. Noise estimation is extracted through a noise estimation convolutional layer, and the calculation formula is as follows: in, To fuse feature maps, For noise estimation, the denoising features are calculated based on the noise estimate and the learnable scaling factor. The calculation formula is as follows: in, For noise reduction features, The learnable scaling factor is used to output a denoised feature map after processing with the ReLU activation function and batch normalization.
[0028] The denoised feature map is then input into the channel attention branch of the global sparse attention mechanism module for channel attention calculation. Global pooling is used to compress the spatial dimension to obtain global channel features, and two fully connected layers and activation functions are used to generate channel attention weights. Channels with attention weights higher than a first threshold are retained using the first sparsity constraint, resulting in a sparse channel weight matrix. The calculation formula is as follows: in, This is a sparse channel weight matrix. These are the original channel attention weights. The first threshold, The threshold filtering function multiplies the sparse channel weight matrix element-wise with the denoised feature map to obtain the channel-weighted feature map.
[0029] Spatial attention is then calculated using a two-layer 2D convolutional network. Channels with spatial attention weights exceeding a second threshold are retained using a second sparsity constraint, resulting in a sparse spatial weight matrix. The calculation formula is as follows: in, For sparse space weight matrix, For the original spatial attention weights, As the second threshold, the channel-weighted feature map is fused with the sparse spatial weight matrix to obtain the final global spatial feature, calculated as follows: in, This is a global sparse attention feature map. For channel-weighted feature maps, This is a feature map weighted by channel attention. This mechanism effectively reduces redundant feature computation and improves generalization ability under small sample sizes.
[0030] When extracting local detail features using the improved Swing Transformer module, the two-dimensional fault image is augmented and then input into the first normalization layer of the improved Swing Transformer module for processing to obtain the first normalized feature. The first normalized feature is then input into the noise-sensitivity-weighted hybrid displacement window multi-head self-attention module, where window multi-head self-attention, horizontal stripe multi-head self-attention, and vertical stripe multi-head self-attention are calculated in parallel. The window multi-head self-attention, horizontal stripe multi-head self-attention, and vertical stripe multi-head self-attention are weighted and fused using learnable weight parameters, and dynamically modulated based on noise sensitivity to output attention features.
[0031] The multi-head self-attention is calculated using a query matrix, a key matrix, and a value matrix, and the calculation formula is as follows: in, in, For querying the matrix, The key matrix, For value matrices, The original input feature matrix, Let the feature dimension be the feature dimension of each vector in the key matrix and query matrix. , , This is the weight matrix.
[0032] The formula for weighted fusion is: .
[0033] in, For hybrid attention output, For multi-head self-attention of windows, For horizontal stripes, multi-head self-attention, For vertical stripes, multi-head self-attention, , , These are the learnable weight coefficients.
[0034] Attention features are input into the first residual connection layer and added element-wise with the enhanced 2D fault image to obtain the first residual connection feature. This first residual connection feature is then input into the second normalization layer for normalization, resulting in the second normalized feature. The second normalized feature is then input into a residual multilayer perceptron, undergoing a first linear transformation, a ReLU activation function, and a second linear transformation in sequence, outputting the multilayer perceptron feature. This multilayer perceptron feature is then input into the second residual connection layer and added element-wise with the first residual connection feature to obtain the local detail feature.
[0035] In this embodiment, the residual multilayer perceptron introduces residual connections into the MLP to solve the gradient vanishing problem in deep networks. The calculation formula for the residual multilayer perceptron is as follows: in, For layer normalization operation, It is a multilayer perceptron. The ReLU activation function is used to input features into the residual multilayer perceptron. , This is the weight matrix. , This is a bias term. ResMLP This enhances the model's robustness to input perturbations, making it more suitable for few-shot learning.
[0036] S104 fuses the extracted global spatial features and local detail features, and outputs the fault classification result through the adaptive feature selection module.
[0037] See Figure 7 In this embodiment, the extracted global spatial features and local detail features are fused to obtain fused features. These fused features are then input into the adaptive feature selection module, where a global average pooling operation is performed by the global average pooling unit to generate global statistical features for each channel. The calculation formula is as follows: in, For the first Global statistical characteristics of each channel For feature map height, The width of the feature map. For the first One channel, Location feature value For the feature map height orientation index, This is the index for the width direction of the feature map.
[0038] The global statistical features are input into the first fully connected layer of the adaptive feature selection module for channel number compression, and then non-linearly activated using the ReLU activation function unit to obtain the activated features. These activated features are then input into the second fully connected layer of the adaptive feature selection module for channel number recovery, and channel weight coefficients are generated using the Sigmoid function. The generated channel weight coefficients are then multiplied element-wise with the fused features to complete the adaptive feature weighting. The calculation formula is as follows: in, For the adaptive weighted number of th Each channel characteristic, For the first The weighting coefficients of each channel For the weighted first The system fuses features from each channel. After adaptive feature weighting, the weighted features are converted into a fault category probability distribution, and the fault classification result corresponding to the maximum probability is output.
[0039] This embodiment effectively integrates multi-scale global features with refined local features using the above method, resists noise by utilizing sparse attention and noise reduction mechanisms, and optimizes feature representation under small sample conditions through residual connections and adaptive feature selection. This method maintains excellent diagnostic performance under conditions of limited sample size, strong noise, and variable operating conditions, providing a reliable technical solution for intelligent operation and maintenance of planetary gearboxes.
[0040] Corresponding to the planetary gearbox small sample fault diagnosis method based on MDGSAM and Swin Transformer provided in the above embodiments, this application also provides an embodiment of a planetary gearbox small sample fault diagnosis system based on MDGSAM and Swin Transformer.
[0041] This application provides a small-sample fault diagnosis of planetary gearbox based on MDGSAM and Swin Transformer, including: an acquisition module for acquiring one-dimensional vibration fault data of the planetary gearbox, and converting the one-dimensional vibration fault data into a two-dimensional fault image using Gram angle difference field.
[0042] The module is used to build a multi-scale denoising global sparse attention convolution module and an improved SwinTransformer module.
[0043] The feature extraction module is used to extract global spatial features and local detail features by inputting the two-dimensional fault image into the multi-scale noise reduction global sparse attention convolution module and the improved Swin Transformer module after data augmentation.
[0044] The fault diagnosis module is used to fuse the extracted global spatial features and local detailed features, and output the fault classification results through the adaptive feature selection module.
[0045] In this embodiment, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0046] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A small-sample fault diagnosis method for planetary gearboxes based on MDGSAM and Swing Transformer, characterized in that, include: One-dimensional vibration fault data of a planetary gearbox is acquired, and the one-dimensional vibration fault data is converted into a two-dimensional fault image using the Gram angle difference field; Construct a multi-scale denoising global sparse attention convolution module and an improved Swing Transformer module; The multi-scale denoising global sparse attention convolutional module includes a multi-scale convolutional layer. The input of the multi-scale convolutional layer is used to receive the input two-dimensional fault image. The output of the multi-scale convolutional layer is connected to the input of the denoising layer. The output of the denoising layer is connected to the global sparse attention mechanism module. The multi-scale convolutional layer contains multiple convolutional kernels of different scales set in parallel. The denoising layer includes a noise estimation convolutional layer, a residual subtraction unit, a ReLU activation function unit, and a batch normalization unit connected in sequence. The global sparse attention mechanism module includes a channel attention branch, a spatial attention branch, and a feature fusion unit. The channel attention branch includes a global pooling unit. The output of the global pooling unit is connected to the first fully connected network. The input terminals of the first fully connected network are connected to the input terminal of the second fully connected network, the output terminal of the second fully connected network is connected to the input terminal of the first sparse constraint unit, the output terminal of the first sparse constraint unit is connected to the input terminal of the first element-wise multiplication unit, and the spatial attention branch includes a first convolutional network, the output terminal of the first convolutional network is connected to the input terminal of the second convolutional network, the output terminal of the second convolutional network is connected to the input terminal of the second sparse constraint unit, the output terminal of the second sparse constraint unit is connected to the input terminal of the second element-wise multiplication unit, and the output terminals of the first element-wise multiplication unit and the second element-wise multiplication unit are connected to the feature fusion unit. The improved Swin Transformer module includes: a normalization layer, a noise-sensitivity-weighted hybrid displacement window multi-head self-attention module, a residual connection layer, and a residual multilayer perceptron. The normalization layer includes a first normalization layer and a second normalization layer. The residual connection layer includes a first residual connection layer and a second residual connection layer. The input of the first normalization layer is used to receive the input two-dimensional fault image. The output of the first normalization layer is connected to the input of the noise-sensitivity-weighted hybrid displacement window multi-head self-attention module. The output of the noise-sensitivity-weighted hybrid displacement window multi-head self-attention module is connected to the input of the first residual connection layer. The output of the first residual connection layer is connected to the inputs of the second normalization layer and the second residual connection layer, respectively. The output of the second normalization layer is connected to the input of the residual multilayer perceptron. The output of the residual multilayer perceptron is connected to the input of the second residual connection layer. After data augmentation, the two-dimensional fault image is input into the multi-scale noise reduction global sparse attention convolution module and the improved Swin Transformer module to extract global spatial features and local detail features. The extracted global spatial features and local detail features are fused together, and the fault classification result is output through an adaptive feature selection module.
2. The method for small-sample fault diagnosis of planetary gearboxes based on MDGSAM and Swing Transformer according to claim 1, characterized in that, The process of acquiring one-dimensional vibration fault data of the planetary gearbox and converting the one-dimensional vibration fault data into a two-dimensional fault image using the Gram angle difference field includes: Acquire the original one-dimensional vibration time sequence signal generated by the planetary gearbox during its motion; The original one-dimensional vibration time series signal is divided into multiple one-dimensional sample segments by using a sliding window of a fixed size; The one-dimensional sample segment is normalized to map the numerical range to a preset interval, resulting in a normalized signal value. The calculation formula is as follows: in, For the first The normalized signal value corresponding to each sampling point The original one-dimensional vibration signal Values of each sampling point It is the minimum value in the original signal sample segment. The maximum value in the original signal sample segment. It is a set of one-dimensional vibration signal sample segments; The timestamp is encoded as a polar axis, and the normalized signal value is encoded as a polar angle. The result is converted to polar coordinates and calculated using the following formula: in, For the first The polar angle of each sampling point As the polar axis, For time indexing, It is a constant factor; The correlation between different time points is calculated using the trigonometric difference angle formula, and a Gram angle difference field matrix is constructed to obtain a two-dimensional fault image of a preset size. The calculation formula is as follows: in, The first angular difference field matrix of Gram Line 1 Column elements, For the first The polar angle of each sampling point For the first The normalized signal value corresponding to each sampling point.
3. The method for small-sample fault diagnosis of planetary gearboxes based on MDGSAM and Swing Transformer according to claim 1, characterized in that, After data augmentation, the two-dimensional fault image is input into the multi-scale denoising global sparse attention convolution module to extract global spatial features, including: After data augmentation, the two-dimensional fault image is input into the multi-scale convolutional layer of the multi-scale noise reduction global sparse attention convolutional module. The input two-dimensional fault image is processed in parallel by convolutional kernels of different sizes and then stitched together in the channel dimension to output a multi-scale fusion feature map. The fused feature map is input into the denoising layer of the multi-scale denoising global sparse attention convolutional module. Noise estimation is extracted through a noise estimation convolutional layer, and the calculation formula is as follows: in, To fuse feature maps, For noise estimation; The noise reduction features are calculated based on the noise estimation and the learnable scaling factor, using the following formula: in, For noise reduction features, A learnable scaling factor; The output is a denoised feature map after processing with ReLU activation function and batch normalization. The denoised feature map is input into the channel attention branch of the global sparse attention mechanism module for channel attention calculation; Global pooling is used to compress spatial dimensions to obtain channel global features, and channel attention weights are generated through two fully connected networks and activation functions. Using the first sparsity constraint, channels with channel attention weights higher than a first threshold are retained, resulting in a sparse channel weight matrix. The calculation formula is as follows: in, This is a sparse channel weight matrix. These are the original channel attention weights. The first threshold, This is a threshold filtering function; The sparse channel weight matrix is multiplied element-wise with the denoised feature map to obtain the channel-weighted feature map. Spatial attention is then calculated using a two-layer 2D convolutional network. Channels with spatial attention weights exceeding a second threshold are retained using a second sparsity constraint, resulting in a sparse spatial weight matrix. The calculation formula is as follows: in, For sparse space weight matrix, For the original spatial attention weights, The second threshold; The channel-weighted feature map is fused with the sparse spatial weight matrix to obtain the final global spatial features.
4. The method for small-sample fault diagnosis of planetary gearboxes based on MDGSAM and Swing Transformer according to claim 3, characterized in that, The channel-weighted feature map is fused with the sparse spatial weight matrix to obtain the final global sparse attention feature map. The calculation formula is as follows: in, This is a global sparse attention feature map. For channel-weighted feature maps, The feature map after channel attention weighting.
5. The method for small-sample fault diagnosis of planetary gearboxes based on MDGSAM and Swing Transformer according to claim 1, characterized in that, The two-dimensional fault image is augmented and then input into the improved SwinTransformer module to extract local detail features, including: The two-dimensional fault image is augmented and then input into the first normalization layer of the improved Swing Transformer module for processing to obtain the first normalized feature. The first normalized feature is input into the noise sensitivity-weighted hybrid displacement window multi-head self-attention module, and the window multi-head self-attention, horizontal stripe multi-head self-attention and vertical stripe multi-head self-attention are calculated in parallel. The window multi-head self-attention, horizontal stripe multi-head self-attention, and vertical stripe multi-head self-attention are weighted and fused using learnable weight parameters, and dynamically modulated based on noise sensitivity to output attention features. The weighted fusion formula is as follows: in, For hybrid attention output, For multi-head self-attention of windows, For horizontal stripes, multi-head self-attention, For vertical stripes, multi-head self-attention, , , These are learnable weight coefficients; The attention features are input into the first residual connection layer and added element-wise to the enhanced two-dimensional fault image to obtain the first residual connection features; The first residual connection feature is input into the second normalization layer for normalization processing to obtain the second normalized feature; The second normalized feature is input into the residual multilayer perceptron and subjected to the first linear transformation, ReLU activation function, and second linear transformation in sequence, and then the multilayer perceptron feature is output. The multilayer perceptron features are input into the second residual connection layer and added element-wise with the first residual connection features to obtain local detail features.
6. The method for small-sample fault diagnosis of planetary gearboxes based on MDGSAM and Swing Transformer according to claim 5, characterized in that, The calculation formula for residual multilayer perceptron is: in, For layer normalization operation, It is a multilayer perceptron. The ReLU activation function is used to input features into the residual multilayer perceptron. , This is the weight matrix. , This is a bias term.
7. The method for small-sample fault diagnosis of planetary gearboxes based on MDGSAM and Swing Transformer according to claim 1, characterized in that, The process of fusing the extracted global spatial features and local detail features, and outputting fault classification results through an adaptive feature selection module, includes: The extracted global spatial features and local detail features are fused to obtain fused features; The fused features are input into the adaptive feature selection module, where global average pooling is performed by the global average pooling unit to generate global statistical features for each channel. The calculation formula is as follows: in, For the first Global statistical characteristics of each channel For feature map height, The width of the feature map. For the first One channel, Location feature value For the feature map height orientation index, Indexed along the width direction of the feature map; The global statistical features are input into the first fully connected layer of the adaptive feature selection module for channel number compression, and then nonlinear activation is performed through the ReLU activation function unit to obtain the activated features. The activated features are input into the second fully connected layer in the adaptive feature selection module to restore the number of channels, and then channel weight coefficients are generated by the Sigmoid function. The generated channel weight coefficients are multiplied element-wise with the fused features to complete the adaptive feature weighting. The calculation formula is as follows: in, For the adaptive weighted number of th Channel characteristics, For the first The weighting coefficients of each channel, For the weighted first The fusion characteristics of each channel; After adaptive feature weighting, the weighted features are converted into a fault category probability distribution, and the fault classification result corresponding to the maximum probability is output.
Citation Information
Patent Citations
Rotating machine fault diagnosis method suitable for strong noise background
CN119880377A
Oil extraction machine ground rotating machine fault diagnosis method based on parallel diagnosis model
CN120579000A