An interpretable rotating machinery fault diagnosis method and system
By constructing the ViT fault diagnosis network and generating interpretable fault feature masks, the problem of lack of transparency in rotating machinery fault diagnosis is solved, and the accurate location of fault features and highly accurate diagnostic results are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-19
AI Technical Summary
Existing deep learning models lack interpretability in rotating machinery fault diagnosis, making it difficult to transparently locate fault features and provide a basis for judgment.
By constructing a ViT fault diagnosis network, extracting the hidden state feature set, and using the gating unit of a multilayer perceptron to generate a binary feature mask, combined with learnable baseline vectors and KL divergence constraints, the network parameters are optimized to generate an interpretable fault feature mask, which is then superimposed onto the original time-frequency map to locate the fault frequency band.
It enables precise and interpretable localization of faults in rotating machinery, improves the credibility and transparency of diagnostic results, and ensures the accuracy and reliability of diagnostic results.
Smart Images

Figure CN122241088A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of rotating machinery fault diagnosis technology, and specifically to an interpretable rotating machinery fault diagnosis method and system. Background Technology
[0002] Rotating machinery (such as bearings and gearboxes) are core components of industrial equipment, and their fault diagnosis is crucial for ensuring production safety. With the development of deep learning, intelligent diagnostic methods based on convolutional neural networks or Transformers have achieved significant improvements in accuracy. In particular, the method of converting one-dimensional vibration signals into two-dimensional images using time-frequency analysis and then processing them using the ViT model has become the mainstream approach.
[0003] However, existing deep learning models are often considered "black boxes" because their internal decision-making mechanisms are opaque. For example, Chinese invention patent application CN118817309A, entitled "A Multi-Scale Feature Fusion Vision-Transformer Model Method for Rolling Bearing Fault Diagnosis," designs a multi-scale feature extraction module, using convolutional kernels of different sizes to extract features from one-dimensional vibration signals; it generates time-frequency images using short-time Fourier transform and pseudo-color processing techniques; finally, it segments and rearranges the time-frequency images, flattens them into one-dimensional vectors, and concatenates them as an input sequence, leveraging the advantages of self-attention mechanisms and encoders to input them into a Vision-Transformer model for rolling bearing fault diagnosis. However, in high-risk industrial scenarios, simply providing the fault category without explaining "what features were used for judgment" makes it difficult for engineers to fully trust the model. Existing interpretable methods such as Grad-CAM (Gradient Weighted Class Activation Mapping) or AttentionRollout suffer from low resolution, inaccurate localization, or lack of faithfulness; that is, removing important regions after interpretation may not significantly change the model's prediction results. Summary of the Invention
[0004] The technical problem to be solved by this invention is how to locate the fault characteristics of rotating machinery in the time and frequency domain and provide interpretable evidence for the fault diagnosis results.
[0005] The present invention solves the above-mentioned technical problems through the following technical means:
[0006] This invention provides an interpretable method for diagnosing faults in rotating machinery, comprising the following steps: S1. Collect vibration data of rotating machinery, and use short-time Fourier transform to convert the one-dimensional time series of vibration data into a two-dimensional time-frequency image. Build the dataset; S2. Construct the ViT fault diagnosis network, train and freeze the network parameters; extract the full-path hidden state feature set including the initial embedding layer, intermediate layers and the final output layer. And define a learnable baseline vector. ; S3, using the hidden state feature set As input, construct from An interpretation network consisting of gating units based on a multilayer perceptron independently computes the activation value corresponding to each hidden state. ; S4. Apply a Hard Concrete distribution to the activation values. Reparameterized sampling and interval stretching are performed to generate a binarized feature mask. And combined with the learnable baseline vector Generate image features; S5, Building based on The objective function of the regularization term and the KL divergence constraint is used to jointly optimize and interpret the network parameters using the Lagrange multiplier method. ; S6. Generate the final fault feature mask using the trained interpretation network and overlay it onto the original time-frequency map. By locating the fault frequency band, output the interpretable location diagnosis result of the fault frequency band of the rotating machinery.
[0007] Further, step S1 includes the following steps: S11. Collect vibration acceleration signals using sensors installed on the rotating machinery, and set the sampling frequency. ; S12. Slice the signal using a sliding window and perform a short-time Fourier transform using a Gaussian window function to transform the one-dimensional time-domain signal. Convert to a two-dimensional time-frequency matrix and take the modulus to obtain a two-dimensional time-frequency image. ; S13. Process the generated two-dimensional time-frequency image. Data augmentation is performed by injecting random noise to generate and divide the training and testing datasets.
[0008] Further, step S2 includes the following steps: S21. Construct a fault diagnosis model based on the ViT architecture, including a Patch Embedding layer, a location encoding layer, and... A Transformer encoder block; model pre-training is performed using the dataset; S22. Freeze all weight parameters of the pre-trained ViT model; define a learnable baseline vector. ; S23. Transform the two-dimensional time-frequency image Cut into A fixed-size image block After linear projection and position encoding superposition, the data is input into the ViT encoder to extract each hidden state generated by the ViT model during inference.
[0009] Further, step S23 includes the following steps: S231. Extract the initial embedding, denoted as... , The input layer consists of a sequence of feature vectors after PatchEmbedding and positional encoding are superimposed. S232, Extract features from the intermediate layer and the final output layer, through... The layer-by-layer mapping of the Transformer encoder extracts the output features of each layer, as shown in the following formula:
[0010] in, Indicates the first The layer encoder represents the hidden state of all image patches. The total number of layers in the ViT model; ultimately, the full path hidden state feature set is obtained. .
[0011] Further, step S3 includes the following steps: S31. Construct a system composed of Interpretation network composed of parallel gated units Among them, input gating Corresponding to the initial embedding layer Patch Embedding; Corresponding to the ViT model Layer Transformer encoder; output gating The corresponding global feature representation before entering the classification head; each gating unit adopts a lightweight multilayer perceptron (MLP) architecture, consisting of two linear transformation layers and one nonlinear activation layer; S32. The full path hidden state feature set As input to the interpreting network, all image patch features contained in each layer are used. Send to the corresponding gate control unit ; S33. Predict the retention tendency of each image patch at different levels using a gating network. The calculation formula is as follows:
[0012] in, For the first Layer The activation value of each image patch.
[0013] Further, step S4 includes the following steps: S41. Introduce a Hard Concrete distribution to the activation value. Parameterization is performed, and the non-differentiable discrete sampling process is transformed into a differentiable continuous approximation process through reparameterization; S42. Based on step S41, calculate and obtain the binarized feature mask. ; S43. Generate a binarized feature mask. It applies to features in the original image patch or intermediate layer, while discarding those features by the mask. In the region, a learnable baseline vector is used. The substitution is as follows:
[0014] in, This is the binarized feature mask for the initial embedding layer.
[0015] Further, step S42 includes the following steps: S421, Regarding the first Layer Image patches, from a uniform distribution Medium-sampled random noise; S422, Based on activation value With temperature parameters Calculate the initial contiguous mask As shown in the following formula:
[0016] S423, Introduce tensile parameters ,Will The probability value of the interval is linearly expanded to The interval, in which ;pass The function truncates the expanded values to obtain a binarized feature mask. .
[0017] Further, step S5 includes the following steps: S51. Constructing Prediction Consistency Loss Loss due to sparse constraints Based on this, a joint loss function is constructed. ; S52, Total Loss Gradients are backpropagated to each layer of gating units. During training, the parameters of the ViT diagnostic model are kept constant, and only the parameters of the interpretation network are updated. Until the mask can stably locate the fault characteristics; Further, step S51 includes the following steps: S511. By calculating the prediction difference between the ViT model and the input image after masking perturbation, the prediction consistency loss is calculated using KL divergence. ; S512. Sum the mask preservation probabilities for all levels and construct a sparse constraint term loss. As shown in the following formula:
[0018] in, Representing the Layer The probability that an image patch is preserved. The preset feature retention ratio target; S513, Introduction of Lagrange multipliers To balance the two losses mentioned above, a joint loss function is formed. As shown in the following formula:
[0019] in, It is a Lagrange multiplier.
[0020] The present invention also provides an interpretable rotating machinery fault diagnosis system, which executes the above-described method during system operation and includes the following modules: The dataset construction module is used to collect vibration data from rotating machinery and convert the one-dimensional time series of vibration data into a two-dimensional time-frequency image using short-time Fourier transform. Build the dataset; The hidden state feature generation module is used to construct the ViT fault diagnosis network, train and freeze the network parameters, and extract the full-path hidden state feature set including the initial embedding layer, intermediate layers and the final output layer. And define a learnable baseline vector. ; Activation value generation module, used to generate the hidden state feature set As input, construct from An interpretation network consisting of gating units based on a multilayer perceptron independently computes the activation value corresponding to each hidden state. ; The mask generation module is used to apply a Hard Concrete distribution to the activation values. Reparameterized sampling and interval stretching are performed to generate a binarized feature mask. And combined with the learnable baseline vector Generate image features; The loss function building module is used to build loss functions based on... The objective function of the regularization term and the KL divergence constraint is used to jointly optimize and interpret the network parameters using the Lagrange multiplier method. ; The output module is used to generate the final fault feature mask from the trained interpretive network and superimpose it onto the original time-frequency map. By locating the fault frequency band, it outputs interpretable location diagnosis results for the fault frequency band of rotating machinery.
[0021] The advantages of this invention are: This invention performs in-depth analysis of the ViT model using the generated mask heatmap. By superimposing the generated binarized feature mask onto the original two-dimensional time-frequency image space, the highlighted areas accurately lock the key frequency components related to rotating machinery faults, realizing multi-scale verification of fault location and type. This effectively solves the "black box" problem of deep learning models in rotating machinery fault diagnosis scenarios, and significantly improves the credibility and transparency of diagnostic results. Attached Figure Description
[0022] Figure 1 This is a schematic flowchart of an interpretable rotating machinery fault diagnosis method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the fault diagnosis confusion matrix of the original image processed by the VIT model in an embodiment of the present invention; Figure 3 This is a schematic diagram of the fault diagnosis confusion matrix of the VIT model after feature mask extraction in an embodiment of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] Example 1 This embodiment provides an interpretable method for diagnosing faults in rotating machinery. The specific implementation process is as follows: Figure 1 As shown, it includes the following steps: S1. Collect vibration data of rotating machinery, and use short-time Fourier transform to convert the one-dimensional time series of vibration data into a two-dimensional time-frequency image. The dataset is constructed; the specific implementation includes the following steps: S11. Collect vibration acceleration signals using sensors installed on the rotating machinery, and set the sampling frequency. ; S12. Slice the signal using a sliding window and perform a short-time Fourier transform using a Gaussian window function to transform the one-dimensional time-domain signal. Convert to a two-dimensional time-frequency matrix and take the modulus to obtain a two-dimensional time-frequency image. ; S13. Process the generated two-dimensional time-frequency image. Data augmentation is performed by injecting random noise to generate and divide the training and testing datasets.
[0025] The vibration data was obtained using an accelerometer mounted on the bearing housing. Signals were recorded at three rotational speeds: 600, 800, and 1000 rpm, with a sampling frequency of 50 kHz. Three types of faults were considered: the inner ring of the bearing, the outer ring of the bearing, and the rolling elements of the bearing, as well as normal operating conditions. Therefore, the experimental setup generated 12 different signal types, representing 4 operating conditions. The three rotational speeds are shown in the table below:
[0026] S2. Construct the ViT fault diagnosis network, train and freeze the network parameters; extract the full-path hidden state feature set including the initial embedding layer, intermediate layers and the final output layer. And define a learnable baseline vector. The specific implementation method includes the following steps: S21. Construct a fault diagnosis model based on the ViT architecture, including a Patch Embedding layer, a location encoding layer, and... A Transformer encoder block; model pre-training is performed using the dataset; S22. Freeze all weight parameters of the pre-trained ViT model; define a learnable baseline vector. The learnable baseline vector is used to replace the masked image features in subsequent steps, eliminating the interference of background noise on the interpretation results. S23. Transform the two-dimensional time-frequency image Cut into A fixed-size image block After linear projection and positional encoding, the data is input into the ViT encoder to extract the hidden states of each layer generated by the ViT model during inference. Specifically, this includes: S231. Extract the initial embedding, denoted as... , The input layer consists of a sequence of feature vectors after PatchEmbedding and positional encoding are superimposed. S232, Extract features from the intermediate layer and the final output layer, through... The layer-by-layer mapping of the Transformer encoder extracts the output features of each layer, as shown in the following formula:
[0027] in, Indicates the first The layer encoder represents the hidden state of all image patches. The total number of layers in the ViT model; ultimately, the full path hidden state feature set is obtained. .
[0028] S3, using the hidden state feature set As input, construct from An interpretation network consisting of gating units based on a multilayer perceptron independently computes the activation value corresponding to each hidden state. The specific implementation method includes the following steps: S31. Construct a system composed of Interpretation network composed of parallel gated units Among them, input gating Corresponding to the initial embedding layer Patch Embedding; Corresponding to the ViT model Layer Transformer encoder; output gating It corresponds to the global feature representation before entering the classification head; each gating unit adopts a lightweight multilayer perceptron (MLP) architecture, consisting of two linear transformation layers and one nonlinear activation layer; it aims to learn the nonlinear mapping from the high-dimensional hidden state to the mask activation space.
[0029] S32. The full path hidden state feature set As input to the interpreting network, all image patch features contained in each layer are used. Send to the corresponding gate control unit ; S33. Predict the retention tendency of each image patch at different levels using a gating network. The calculation formula is as follows:
[0030] in, For the first Layer The activation value of each image patch. The magnitude of this value reflects the importance of the features of this time-frequency region to the current fault diagnosis result. The higher the activation value, the more critical the fault features contained in the region are, and the greater the probability that they will be retained in subsequent steps.
[0031] S4. Apply a Hard Concrete distribution to the activation values. Reparameterized sampling and interval stretching are performed to generate a binarized feature mask. And combined with the learnable baseline vector The method generates image features; the specific implementation includes the following steps: S41. To address the issue of non-differentiability of discrete masks, a Hard Concrete distribution is introduced for the activation values. Parameterization is performed, and the non-differentiable discrete sampling process is transformed into a differentiable continuous approximation process through reparameterization; S42. Based on step S41, calculate and obtain the binarized feature mask. Specifically, it includes: S421, Regarding the first Layer Image patches, from a uniform distribution Medium-sampled random noise; S422, Based on activation value With temperature parameters Calculate the initial contiguous mask As shown in the following formula:
[0032] S423. To enable the mask to produce precise 0 (completely masked) or 1 (completely preserved) states, a stretching parameter is introduced. ,Will The probability value of the interval is linearly expanded to The interval, in which ;pass The function truncates the expanded values to obtain a binarized feature mask. This operation ensures that the probability of falling into the negative region is forced to zero, and the probability of falling into the region above 1 is forced to 1. This "stretched truncation" mechanism allows the interpreter network to generate physically meaningful sparse binary feature masks while maintaining training differentiability. .
[0033] S43. Generate a binarized feature mask. It applies to features in the original image patch or intermediate layer, while discarding those features by the mask. In the region, a learnable baseline vector is used. The substitution is as follows:
[0034] in, This is a binary feature mask for the initial embedding layer. This operation ensures that the masked area does not carry any fault feature information, thereby verifying the contribution of the remaining area to the diagnostic results.
[0035] S5, Building based on The objective function of the regularization term and the KL divergence constraint is used to jointly optimize and interpret the network parameters using the Lagrange multiplier method. The specific implementation method includes the following steps: S51. Constructing Prediction Consistency Loss Loss due to sparse constraints Based on this, a joint loss function is constructed. Specifically, it includes: S511. By calculating the prediction difference between the ViT model and the input image after masking perturbation, the prediction consistency loss is calculated using KL divergence. Ensure that the few features retained are sufficient to maintain the accuracy of the original diagnostic results.
[0036] S512. Summation constraints are applied to the mask preservation probabilities at all levels to force the interpretation network to mask irrelevant regions as much as possible, thus constructing a sparse constraint term loss. As shown in the following formula:
[0037] in, Representing the Layer The probability that an image patch is preserved. The preset feature retention ratio target; S513, Introduction of Lagrange multipliers To balance the two losses mentioned above, a joint loss function is formed. As shown in the following formula:
[0038] in, It is a Lagrange multiplier.
[0039] S52, Total Loss Gradients are backpropagated to each layer of gating units. During training, the parameters of the ViT diagnostic model are kept constant, and only the parameters of the interpretation network are updated. Until the mask can stably locate the fault characteristics; S6. Generate the final fault feature mask using the trained interpretation network and overlay it onto the original time-frequency map. By locating the fault frequency band, output the interpretable location diagnosis result of the fault frequency band of the rotating machinery.
[0040] The masks of each layer of the trained interpretation network are aligned and weighted in spatial dimensions and then fused. Random noise in single-layer features is eliminated by taking the intersection or weighted average of the multi-layer masks, and key fault regions with consistent contributions to the deep representation of the model are extracted. The fused masks are then mapped back to the original two-dimensional time-frequency image space to generate a heatmap of fault feature saliency. Highlighted areas: represent the parts with a mask value of 1, corresponding to the actual fault frequency components of the rotating machinery; Masked area: Represents the part with a mask value of 0, corresponding to irrelevant interference such as environmental noise and normal equipment rotation frequency.
[0041] The system outputs the final fault diagnosis results, along with the aforementioned significant heatmap as a basis for judgment, thus transforming the system from a "black box" to a "white box" and providing accurate location references for subsequent equipment maintenance plans.
[0042] This embodiment also provides experimental verification data for the above method, as shown in the table below:
[0043] From the classification report results in the table and Figure 2 and Figure 3 As can be seen from the confusion matrix of the test set, the method proposed in this embodiment exhibits excellent classification performance. A detailed analysis follows: Diagnostic performance analysis: The ViT model was used to classify 12 complex operating condition labels, including inner ring fault (ib), normal state (n), outer ring fault (ob), and rolling element fault (tb). The experimental results are as follows: Figure 2 As shown in the confusion matrix, the model exhibits excellent classification accuracy under various speeds and fault types, with an average test accuracy of 94.46%, providing an accurate model foundation for subsequent interpretability analysis.
[0044] Decision reliability verification: After extracting key failure features and performing re-decision verification, the results are as follows: Figure 3 As shown, the average accuracy after re-decision remains at a high level of 93.93%, which proves that the model does not rely on random noise or background information to make judgments, but rather captures key features with physical meaning.
[0045] Example 2 It should be further explained that, based on the same inventive concept, this embodiment provides an interpretable rotating machinery fault diagnosis system. When the system is running, it executes the method described in Embodiment 1, including the following modules: The dataset construction module is used to collect vibration data from rotating machinery and convert the one-dimensional time series of vibration data into a two-dimensional time-frequency image using short-time Fourier transform. Build the dataset; The hidden state feature generation module is used to construct the ViT fault diagnosis network, train and freeze the network parameters, and extract the full-path hidden state feature set including the initial embedding layer, intermediate layers and the final output layer. And define a learnable baseline vector. ; Activation value generation module, used to generate the hidden state feature set As input, construct from An interpretation network consisting of gating units based on a multilayer perceptron independently computes the activation value corresponding to each hidden state. ; The mask generation module is used to apply a Hard Concrete distribution to the activation values. Reparameterized sampling and interval stretching are performed to generate a binarized feature mask. And combined with the learnable baseline vector Generate image features; The loss function building module is used to build loss functions based on... The objective function of the regularization term and the KL divergence constraint is used to jointly optimize and interpret the network parameters using the Lagrange multiplier method. ; The output module is used to generate the final fault feature mask from the trained interpretive network and superimpose it onto the original time-frequency map. By locating the fault frequency band, it outputs interpretable location diagnosis results for the fault frequency band of rotating machinery.
[0046] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An interpretable method for diagnosing faults in rotating machinery, characterized in that, Includes the following steps: S1. Collect vibration data of rotating machinery, and use short-time Fourier transform to convert the one-dimensional time series of vibration data into a two-dimensional time-frequency image. Build the dataset; S2. Construct the ViT fault diagnosis network, train and freeze the network parameters; extract the full-path hidden state feature set including the initial embedding layer, intermediate layers and the final output layer. And define a learnable baseline vector. ; S3, using the hidden state feature set As input, construct from An interpretation network consisting of gating units based on a multilayer perceptron independently calculates the activation value corresponding to each hidden state. ; S4. Apply a Hard Concrete distribution to the activation values. Reparameterized sampling and interval stretching are performed to generate a binarized feature mask. And combined with the learnable baseline vector Generate image features; S5, Building based on The objective function of the regularization term and the KL divergence constraint is used to jointly optimize and interpret the network parameters using the Lagrange multiplier method. ; S6. Generate the final fault feature mask using the trained interpretation network and overlay it onto the original time-frequency map. By locating the fault frequency band, output the interpretable location diagnosis result of the fault frequency band of the rotating machinery.
2. The interpretable rotating machinery fault diagnosis method according to claim 1, characterized in that, Step S1 includes the following steps: S11. Collect vibration acceleration signals using sensors installed on the rotating machinery, and set the sampling frequency. ; S12. Slice the signal using a sliding window and perform a short-time Fourier transform using a Gaussian window function to transform the one-dimensional time-domain signal. Convert to a two-dimensional time-frequency matrix, and take the modulus to obtain a two-dimensional time-frequency image. ; S13. Process the generated two-dimensional time-frequency image. Data augmentation is performed by injecting random noise to generate and divide the training and testing datasets.
3. The interpretable rotating machinery fault diagnosis method according to claim 1, characterized in that, Step S2 includes the following steps: S21. Construct a fault diagnosis model based on the ViT architecture, including a Patch Embedding layer, a location encoding layer, and... A Transformer encoder block; model pre-training is performed using the dataset; S22. Freeze all weight parameters of the pre-trained ViT model; define a learnable baseline vector. ; S23, Transform the two-dimensional time-frequency image Cut into A fixed-size image block After linear projection and position encoding superposition, the data is input into the ViT encoder to extract each hidden state generated by the ViT model during inference.
4. The interpretable rotating machinery fault diagnosis method according to claim 3, characterized in that, Step S23 includes the following steps: S231. Extract the initial embedding, denoted as... , The input layer consists of a sequence of feature vectors after Patch Embedding and positional encoding are superimposed. S232, Extract features from the intermediate layer and the final output layer, through... The layer-by-layer mapping of the Transformer encoder extracts the output features of each layer, as shown in the following formula: in, Indicates the first The layer encoder represents the hidden state of all image patches. The total number of layers in the ViT model; ultimately, the full path hidden state feature set is obtained. .
5. The interpretable rotating machinery fault diagnosis method according to claim 1, characterized in that, Step S3 includes the following steps: S31. Construct a system composed of Interpretation network composed of parallel gated units Among them, input gating Corresponding to the initial embedding layer Patch Embedding; Corresponding to the ViT model Layer Transformer encoder; output gating The corresponding global feature representation before entering the classification head; each gating unit adopts a lightweight multilayer perceptron (MLP) architecture, consisting of two linear transformation layers and one nonlinear activation layer; S32. The full path hidden state feature set As input to the interpreting network, all image patch features contained in each layer are used. Send to the corresponding gate control unit ; S33. Predict the retention tendency of each image patch at different levels using a gating network. The calculation formula is as follows: in, For the first Layer The activation value of each image patch.
6. The interpretable rotating machinery fault diagnosis method according to claim 1, characterized in that, Step S4 includes the following steps: S41. Introduce a Hard Concrete distribution to the activation value. Parameterization is performed, and the non-differentiable discrete sampling process is transformed into a differentiable continuous approximation process through reparameterization; S42. Based on step S41, calculate and obtain the binarized feature mask. ; S43. Generate a binarized feature mask. It applies to features in the original image patch or intermediate layer, while discarding those that are masked. In the region, a learnable baseline vector is used. The substitution is as follows: in, This is the binarized feature mask for the initial embedding layer.
7. The interpretable rotating machinery fault diagnosis method according to claim 6, characterized in that, Step S42 includes the following steps: S421, Regarding the first Layer Image patches, from a uniform distribution Medium-sampled random noise; S422, Based on activation value With temperature parameters Calculate the initial contiguous mask As shown in the following formula: S423, Introduce tensile parameters ,Will The probability value of the interval is linearly expanded to The interval, in which ;pass The function truncates the expanded values to obtain a binarized feature mask. .
8. The interpretable rotating machinery fault diagnosis method according to claim 1, characterized in that, Step S5 includes the following steps: S51. Constructing Prediction Consistency Loss Loss due to sparse constraints Based on this, a joint loss function is constructed. ; S52, Total Loss Gradients are backpropagated to each layer of gating units. During training, the parameters of the ViT diagnostic model are kept constant, and only the parameters of the interpretation network are updated. Until the mask can stably locate the fault characteristics.
9. The interpretable rotating machinery fault diagnosis method according to claim 8, characterized in that, Step S51 includes the following steps: S511. By calculating the prediction difference between the ViT model and the input image after masking perturbation, the prediction consistency loss is calculated using KL divergence. ; S512. Sum the mask preservation probabilities for all levels and construct a sparse constraint term loss. As shown in the following formula: in, Representing the Layer The probability that an image patch is preserved. The preset feature retention ratio target; S513, Introduction of Lagrange multipliers To balance the two losses mentioned above, a joint loss function is formed. As shown in the following formula: in, It is a Lagrange multiplier.
10. An interpretable rotating machinery fault diagnosis system, characterized in that, Includes the following modules: The dataset construction module is used to collect vibration data from rotating machinery and convert the one-dimensional time series of vibration data into a two-dimensional time-frequency image using short-time Fourier transform. Build the dataset; The hidden state feature generation module is used to construct the ViT fault diagnosis network, train and freeze the network parameters, and extract the full-path hidden state feature set including the initial embedding layer, intermediate layers and the final output layer. And define a learnable baseline vector. ; The activation value generation module is used to generate the hidden state feature set. As input, construct from An interpretation network consisting of gating units based on a multilayer perceptron independently calculates the activation value corresponding to each hidden state. ; The mask generation module is used to apply a Hard Concrete distribution to the activation values. Reparameterized sampling and interval stretching are performed to generate a binarized feature mask. And combined with the learnable baseline vector Generate image features; The loss function building module is used to build loss functions based on... The objective function of the regularization term and the KL divergence constraint is used to jointly optimize and interpret the network parameters using the Lagrange multiplier method. ; The output module is used to generate the final fault feature mask from the trained interpretive network and superimpose it onto the original time-frequency map. By locating the fault frequency band, it outputs interpretable location diagnosis results for the fault frequency band of rotating machinery.