Mechanical fault diagnosis method based on dual-view collaborative contrast fusion network driven by prototype

By using a prototype-driven dual-view collaborative contrastive fusion network, and leveraging a multi-scale cognitive distiller and a cross-domain interactive Transformer module, combined with a collaborative contrastive learning strategy, the problems of insufficient cross-domain interaction and fine-grained feature capture in self-supervised fault diagnosis are solved, achieving efficient fault diagnosis under conditions of scarce labeled data.

CN120952053BActive Publication Date: 2026-08-25KUNMING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511250704.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-03
Publication Date
2026-08-25
Estimated Expiration
2045-09-03

AI Technical Summary

Technical Problem

Existing self-supervised fault diagnosis methods lack effective cross-domain interaction in time-frequency signal representation learning, making it difficult to fully explore the complementary information between the time and frequency domains. Furthermore, traditional contrastive learning frameworks struggle to capture fine-grained discriminative features and cluster consistency, resulting in insufficient model generalization ability and robustness in scenarios with scarce labeled data.

Method used

A prototype-driven dual-view collaborative contrastive fusion network is adopted. Through a multi-scale cognitive distiller and a cross-domain interactive Transformer module, combined with a collaborative contrastive learning strategy, global attention correlation and cluster consistency of time-frequency features are achieved, thereby enhancing feature discriminativeness and cluster consistency.

Benefits of technology

It significantly improves the accuracy and robustness of fault diagnosis under conditions of scarce labeled data, enhances the ability to characterize and distinguish complex fault modes, and shows better stability and applicability, especially in complex working conditions and noisy interference scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120952053B_ABST
    Figure CN120952053B_ABST
Patent Text Reader

Abstract

The present application relates to a mechanical fault diagnosis method based on a prototype-driven dual-view collaborative contrast fusion network, belonging to the field of intelligent fault diagnosis. The present application constructs a new self-supervised contrast learning framework. The framework uses a multi-scale semantic cognitive distiller to realize multi-level semantic alignment and adaptive fusion of local and global aspects of time-frequency signals, and introduces a cross-domain interactive Transformer module to capture global complementary features between time-frequency domains. In addition, the framework designs a collaborative contrast learning strategy, which integrates dual-view complementary contrast and adaptive prototype-driven contrast learning. Among them, the dual-view complementary contrast mechanism uses a dual-positive sample pair and a hard negative sample strategy to strengthen feature discriminability. The adaptive prototype-driven mechanism optimizes feature clustering tightness through dynamic prototype mapping and self-weighting strategy. The present application significantly improves the accuracy and robustness of fault diagnosis under limited labeled data and complex working conditions, providing an efficient solution for intelligent maintenance of industrial equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a mechanical fault diagnosis method based on a prototype-driven dual-view collaborative comparison and fusion network, belonging to the field of intelligent fault diagnosis technology. Background Technology

[0002] Mechanical equipment is the core of modern industry, and its stable operation is crucial to production efficiency and safety. Rotating machinery (such as bearings and gearboxes) is prone to failure due to complex operating conditions and harsh environments, leading to unplanned downtime and economic losses. Therefore, real-time, accurate fault diagnosis and efficient maintenance strategies are key challenges in intelligent manufacturing. Traditional diagnostics rely on expert experience or time-domain, frequency-domain, and time-frequency-domain signal analysis, offering strong interpretability but requiring a large amount of manual feature extraction, making it difficult to meet real-time and large-scale application requirements. While data-driven deep learning methods can adaptively extract features, they heavily depend on labeled data, limiting their effectiveness with new equipment or when labels are scarce. Therefore, how to improve diagnostic accuracy and robustness with limited labels has become a core problem urgently needing to be solved.

[0003] Self-supervised learning, by designing pre-training tasks to uncover inherent correlations in data, can enhance model performance without requiring a large number of labels and reduce reliance on labeled data. Among these, self-supervised methods based on contrastive learning learn universal discriminative representations from massive amounts of unlabeled data by constructing positive and negative sample pairs, and then fine-tuning with a small number of labels, achieving effective transfer to downstream fault diagnosis tasks, demonstrating great potential in scenarios where labeled data is scarce. For example, some researchers have significantly improved classification accuracy by using time-frequency consistency or multi-view comparisons, combined with data augmentation and multi-task frameworks. Other researchers have further optimized diagnostic performance by constructing cross-domain interactive networks to fuse deep time-frequency features. Despite significant progress in utilizing unlabeled data, current self-supervised fault diagnosis methods still face the following challenges in time-frequency signal representation learning: 1) Existing time-frequency fusion methods lack effective cross-domain interaction, making it difficult to fully exploit the complementary information between the time and frequency domains; 2) Traditional contrastive learning frameworks typically construct only single positive sample pairs, while negative samples are often randomly selected from irrelevant instances. Although easily distinguishable, these methods struggle to capture fine-grained discriminative features; 3) Existing methods lack sufficient clustering consistency constraints, making them susceptible to noise samples in low-label scenarios, resulting in a loose feature space structure. These issues severely restrict the generalization ability and robustness of fault diagnosis models under conditions of limited labeled data. Summary of the Invention

[0004] In view of the above challenges, this invention provides a mechanical fault diagnosis method based on a prototype-driven dual-view collaborative contrastive fusion network for intelligent fault diagnosis in highly labeled data scenarios. The method of this invention uses a multi-scale cognitive distiller to capture global attentional associations from a time-frequency dual perspective through multi-granularity feature decoupling and adaptive fusion at the local and global levels, thereby achieving efficient cross-domain complementary representation. At the same time, it combines a collaborative contrastive learning strategy to simultaneously enhance feature discriminativeness and cluster consistency.

[0005] The technical solution of this invention is a mechanical fault diagnosis method based on a prototype-driven dual-view collaborative contrastive fusion network. This invention constructs a self-supervised representation learning framework to improve fault diagnosis performance under limited labeling conditions. By designing a multi-scale semantic cognitive distiller, semantic deentanglement and information complementarity are achieved at both local and global levels, effectively overcoming the problem of insufficient cross-domain interaction in time-frequency feature fusion. Simultaneously, a cross-domain interaction Transformer module is introduced to model the global attention correlation in the time-frequency domain, further exploring deep relationships and complementarity between domains. Based on this, a collaborative contrastive learning strategy is proposed, including dual-view complementary contrast and adaptive prototype-driven contrast. The former alleviates the constraint of single positive samples and improves fine-grained feature discrimination by constructing a double positive pair and combining it with customized negative sampling; the latter utilizes the prototype layer to achieve category-level semantic alignment and dynamically balances perspective contributions through a self-weighting mechanism, thereby enhancing clustering consistency and reducing noise interference. The two strategies work in parallel and collaboratively, promoting the joint evolution of representation learning and clustering optimization, significantly improving fault diagnosis accuracy.

[0006] The specific steps of the mechanical fault diagnosis method based on prototype-driven dual-view collaborative contrast fusion network include:

[0007] Step 1: Data Acquisition: Collect mechanical failure datasets;

[0008] Step 2, Data Processing: The collected mechanical fault dataset is cleaned, and after sliding window truncation and normalization, it is divided into unlabeled training set, labeled fine-tuning set and labeled test set according to the proportion.

[0009] Step 3: Construct time-frequency sample pairs: Perform a fast Fourier transform on all the divided datasets to convert the time signal into a frequency signal, thus obtaining time-frequency sample pairs;

[0010] Step 4: Construct a self-supervised pre-training model: Construct a self-supervised pre-training model using a multi-scale cognitive distiller and a collaborative contrastive learning strategy; the multi-scale cognitive distiller extracts local time-frequency features, performs global feature distillation on the local time-frequency features to obtain global complementary features, and combines the collaborative contrastive learning strategy to construct a pre-training loss function;

[0011] Step 5: Perform self-supervised pre-training: Use the unlabeled training set processed in Step 3 as input, and then perform iterative training according to the pre-training loss function designed in Step 4 until the loss function converges or reaches the maximum number of iterations. Finally, save the pre-trained model.

[0012] Step 6: Build a fine-tuned model: Build a fine-tuned model and load the pre-trained model parameters. Use the cross-entropy loss function and obtain the target loss function for fine-tuning with label guidance.

[0013] Step 7: Perform supervised fine-tuning: Train the fine-tuning model using the divided labeled fine-tuning set, optimize the objective function by using labels, iterate and update until convergence or the maximum number of iterations is reached, and save the trained fine-tuning model.

[0014] Step 8: Perform mechanical fault diagnosis: Load the parameters of the trained fine-tuned model, input the divided labeled test set samples, select the category corresponding to the maximum value according to the class probability output by the model to obtain the predicted label, and then obtain the diagnosis result.

[0015] Furthermore, in Step 1, the mechanical fault dataset contains multiple sample pairs, each of which contains a vibration signal and its corresponding state label.

[0016] Furthermore, in Step 2, the normalization process employs Z-fractional standardization and is truncated using a sliding window.

[0017] The dataset partitioning steps are as follows:

[0018] The first step is to randomly select 80% of the sample pairs in the mechanical failure dataset and remove the labels to form an unlabeled training set.

[0019] The second step is to randomly select 10% from the remaining 20% ​​of labeled data as a labeled fine-tuning set.

[0020] The third step is to use the remaining 10% as a labeled test set.

[0021] Furthermore, Step 3 includes:

[0022] For a given one-dimensional vibration signal V, let the time-domain signal X t ≡V, then in, Let represent the i-th time series sample in the unlabeled training set, and n represent the number of samples in the mini-batch; use Fast Fourier Transform. Time domain signal Convert to frequency domain signal Where FFT stands for Fast Fourier Transform. This represents the i-th frequency domain sample after transformation.

[0023] Further, in Step 4, the multi-scale cognitive distiller extracts time-frequency local features, including: extracting time-frequency local features from time and frequency signals using time encoders and frequency encoders with identical structures but independent parameters. The processing includes:

[0024] For the original time domain signal and frequency domain signals Encoding was performed using a time-frequency encoder separately:

[0025] H t =Time_Enocer(X t ,θ t ),H f =Frequency_Enocer(X f ,θ f (1)

[0026] Where D is the length of the vibration signal. l represents the feature dimension, indicating the temporal encoded representation output by the temporal encoder. It is the i-th time-encoded representation in the mini-batch; Time_Enocer(,) indicates that the time encoder is constructed by a ResNet-1d network, θ t These are the parameters for the time encoder; This represents the frequency domain encoded representation of the frequency encoder output. It is the i-th frequency encoded representation in the mini-batch; Frequency_Enocer(,) indicates that the frequency encoder is constructed by a ResNet-1d network, θ f These are the parameters of the frequency encoder.

[0027] Further, in Step 4, the global feature distillation of the time-frequency local features includes: extracting a globally consistent representation and a time-frequency complementary representation from the obtained time-frequency local features using an attention fusion module and a cross-domain interaction Transformer module, respectively; the processing includes:

[0028] The time-frequency local features {H} extracted by the time encoder and frequency encoder t H f Mapped to the embedding space, this is used to filter private information from a single perspective. The process is defined as follows:

[0029]

[0030] in, This represents a temporal local embedding representation. d mIndicates the embedding dimension. This represents the frequency local embedding representation. and All are composed of linear MLPs with the same structure but independent parameters, ∈ t and ∈ f These are learnable parameters;

[0031] Using normalized temperature-scaled cross-entropy as the time-frequency contrastive loss function, in a mini-batch training set of size n, the temporal local embedding representation of each sample is... Constructing a time view, in which Represents the i-th time embedding; frequency local embedding represents Construct a frequency view, in which Represent the embedding of the i-th frequency; view the time of each sample. Its corresponding frequency view It is considered a positive pair and negatively paired with other samples;

[0032] Time view of the sample Contrast loss Represented as:

[0033]

[0034] Where, τ a Indicates temperature parameter, For the j-th time embedding, For the j-th frequency embedding, sim(·) represents the cosine similarity between samples, expressed as:

[0035]

[0036] Where T represents transpose, and ||·|| represents L2 norm;

[0037] Considering the time view and frequency view Symmetry between them, time-frequency contrast loss Further expressed as:

[0038]

[0039] Where n is the number of samples in the mini-batch. Time view of the sample The comparative loss, Represents sample frequency view The comparison loss is derived in a similar way to formula (3), that is, the frequency view With the corresponding time view The positive pair is considered the positive pair, and the remaining samples are considered the negative pairs.

[0040] After aligning the time-frequency features, an attention fusion module is used to process the local time-frequency features {H}. t H f The attention fusion process is performed; a globally consistent common representation G is computed using the following attention fusion formula:

[0041] C = f u ([H t H f ],∈ u (6)

[0042]

[0043] in, This represents the globally consistent public representation obtained. d g It is the public representation dimension, f u Represents the nonlinear mapping function constructed by the MLP, ∈ u These are learnable parameters, C is the intermediate vector after concatenating time-frequency local features, [·,·] represents horizontal concatenation of vectors along the row direction, and ψ v It is a dynamic fusion weight, including the time fusion weight λ. t and frequency fusion weight λ f The sigmoid function prevents the weights from approaching 1 at a particular viewpoint; τ is the scaling parameter, and H... v To represent local features of time or frequency, ⊙ denotes element-wise multiplication.

[0044] A cross-domain interactive Transformer module is introduced to generate globally complementary features from different perspectives; given time-frequency local features {H} from the dual encoders... t H f}, representing H in the time domain t As a query, the frequency domain coding represents H f As keys and values, the global complementary feature representation Z from a time-domain perspective t for:

[0045]

[0046] Z t =TT L (13)

[0047] In this context, MSA represents multi-head self-attention block, FFN represents feedforward network, MCA represents multi-head cross-attention block to facilitate information exchange between the two branches, and LN represents layer normalization. This represents the global complementary feature representation obtained from the time domain perspective, each Consistent with the dimension of the common representation G, L is the number of layers in the encoder;

[0048] Similarly, when the frequency domain coding representation H f As a query, the time-domain encoding represents H t When used as keys and values, a global complementary feature representation from a frequency domain perspective is obtained. in This represents the global complementary feature obtained by the i-th sample from the frequency domain perspective.

[0049] Furthermore, in Step 4, the pre-trained loss function constructed using the collaborative contrastive learning strategy includes time-frequency alignment, dual-view complementary contrast, and adaptive prototype-driven contrastive loss functions; defined as follows:

[0050] Based on the obtained feature triples {G,Z t Z f}, using the common representation G as the anchor sample, while the time-frequency complementary representation of the same anchor sample is {Z}. t Z f} as positive sample pairs; for negative samples N, a hard negative sample sampling strategy is adopted, selecting the representation {Z} which is very close to the anchor sample G but complementary to its corresponding time-frequency. t Z f The presence of significantly different samples prompts the model to learn more detailed discriminative features; the dual-view complementary contrast loss function is expressed as:

[0051]

[0052] Where d(·,·) represents the Euclidean distance, and α is a predefined threshold. The first term in the array is "max[d(G,Z)". t )+d(G,Z f )+d(Z t Z f The goal is to reduce the common representation G and its time-frequency complementary representation {Z}. t Z f The distance between}, while amplifying the difference with the negative sample N; the second term "max[d(G,Z t ),d(G,Z f The focus is on minimizing G and the time-frequency complementary representation {Z}. t Z f The differences between them accelerate the optimization process;

[0053] Based on feature triples {G,Z t Z f Design a prototype layer to generate three learnable prototype vectors {P, P...} t,P f The process is represented as follows:

[0054] P = Softmax(F g (G,ω g (15)

[0055] P t =Softmax(F p (Z t ,ω p (16)

[0056] P f =Softmax(F p (Z f ,ω g (17)

[0057] in, As a public prototype, and Denotes the time-domain and frequency-domain prototypes, respectively, d p Let d be the mapping dimension of the prototype vector. p Equal to the number of categories, F g and F p It is a prototype layer constructed by MLP, P t and P f Prototype layer parameter sharing, ω g and ω p These are parameters of the prototype layer;

[0058] Subsequently, the common prototype P and the perspective-specific clustering prototype P are compared. t and P f Alignment;

[0059] Specifically, in the time domain, in the case of a mini-batch size of n, each common prototype p i Its corresponding time-domain prototype The positive sample is considered positive, while all other samples are considered negative; time-domain prototype Contrast loss Represented as:

[0060]

[0061] in, For the j-th time-domain prototype in the sample, p j Let τ be the j-th common prototype in the sample, k be the number of clusters, and τ be the common prototype. p For cluster-level temperature hyperparameters;

[0062] Similarly, in the frequency domain, each common prototype p i Its corresponding frequency domain prototype The positive pair is considered the positive pair, and the other samples are considered negative pairs; frequency domain prototype Contrast loss Defined as:

[0063]

[0064] in, This is the j-th frequency domain prototype in the sample;

[0065] For {P t ,P f Introducing cross-entropy constraints

[0066]

[0067] in, Let represent the probability of the j-th sample belonging to the i-th prototype in the time domain. Let be the average probability of all samples in the batch belonging to the i-th prototype in the time domain. Let represent the probability of the j-th sample belonging to the i-th prototype in the frequency domain. Let be the average probability of all samples in the batch being assigned to the i-th prototype in the frequency domain;

[0068] In summary, adaptive prototype-driven contrastive loss The preliminary description is as follows:

[0069]

[0070] Furthermore, by using an adaptive weighting mechanism, Formula 24 can be reconstructed as follows:

[0071]

[0072] Among them, W v It represents the common prototype and the perspective-specific clustering prototype P. v The adaptive weights between them are calculated in the following way:

[0073]

[0074] Where μ is a distance function based on the maximum mean difference, defined as:

[0075]

[0076] Where σ(·,·) is a linear kernel function, i.e., σ(x,y)=x T y.

[0077] Furthermore, in Step 5, the pre-training loss function is defined as follows:

[0078] Based on the above results, Local features are initially aligned and fused to obtain global complementary features; subsequently, by employing... and Deep alignment is achieved at both the feature level and the clustering level, thereby simultaneously enhancing the discriminative power of the global representation and the consistency of clustering; the overall loss function expression for pre-training is:

[0079]

[0080] Here, λ1 and λ2 are trade-off hyperparameters.

[0081] Furthermore, the Step 5 training process includes:

[0082] The unlabeled training set is processed using a random selection method and loaded into the training data loader in batches. Each batch contains two inputs: a time-frequency signal pair. The sample pairs are fed into the time-frequency encoder for feature extraction. Then, according to the defined pre-training loss function, the parameters in the time-frequency encoder are iteratively updated until the pre-training loss function converges or the maximum number of iterations is reached. Finally, the parameters of the pre-trained model are saved.

[0083] Further, in Step 6, the construction of the fine-tuning model includes: constructing a time-frequency encoder, an attention fusion network, and an additional linear classifier; wherein the architecture of the time-frequency encoder and the attention fusion network is consistent with the pre-trained model, and the parameters of the pre-trained model are loaded; the target loss function of the fine-tuning model is... Composed of cross-entropy loss function, target loss function as follows:

[0084]

[0085] Where N is the total number of samples, C is the total number of categories, and y i,c It is the true label of the i-th sample for class c. It is the predicted probability of the i-th sample for class c.

[0086] Furthermore, in Step 3, the original vibration signal of each dataset is treated as a time-series signal, converted into a frequency signal by a fast Fourier transform, and then combined with the time-series signal to form a time-frequency sample pair.

[0087] Furthermore, in Step 4, the local feature extraction network uses an encoder based on the ResNet-1d network for feature encoding, and customizes time encoders and frequency encoders with the same structure but independent parameters for time series and frequency signals respectively.

[0088] Furthermore, in Step 4, the multi-scale semantic cognitive distiller performs global feature distillation based on the extracted time-frequency local features; for the time and frequency local features, the attention fusion module and the cross-domain interaction Transformer module respectively extract globally consistent representations and time-frequency complementary representations.

[0089] Furthermore, in Step 4, the collaborative contrastive learning strategy is essentially an objective function composed of time-frequency alignment, dual-view complementary contrast, and adaptive prototype-driven contrastive loss. By optimizing this objective function, the model can effectively learn general time-frequency features.

[0090] Furthermore, in Step 5, to ensure the model's generalization ability, the data should be processed and divided into mini-batches using a random selection method during each training iteration. After reaching the maximum number of rounds, the final pre-trained model is saved.

[0091] Furthermore, in Step 6, the fine-tuned model differs from the pre-trained model in overall structure and training task, but the model parameter structure corresponds. The fine-tuned model optimizes the classifier through labeling to adapt it to the downstream fault diagnosis task.

[0092] Furthermore, in Step 7, the fine-tuned model and the pre-trained model use different target loss functions. The fine-tuned model uses the cross-entropy loss function to optimize model parameters by comparing the predicted labels with the true labels; while the pre-trained model uses multiple contrastive loss functions to optimize the encoding network and learn better feature representations.

[0093] Furthermore, in Step 8, a fine-tuned model with frozen parameters after training is used, and the fault diagnosis result is the average value of the model after multiple training sessions, which is used as the final diagnosis result.

[0094] The beneficial effects of this invention are:

[0095] 1. The method of the present invention significantly reduces the dependence on labeled samples by self-supervised pre-training on a large amount of unlabeled data and fine-tuning on a small amount of labeled data. It can learn discriminative fault features under conditions of scarce labeling, thereby improving the accuracy and reliability of mechanical fault diagnosis.

[0096] 2. This invention designs a multi-scale cognitive distiller that semantically deentangles at the local and global levels, effectively captures complementary time-frequency information at different scales, overcomes the problem of insufficient cross-domain interaction in traditional time-frequency fusion, and enhances the integrity and robustness of feature representation.

[0097] 3. This invention introduces a cross-domain interactive Transformer module to model the global attention correlation between the time domain and the frequency domain, which can deeply explore the deep relationships and complementarities between domains, thereby improving the ability to represent and distinguish complex fault modes.

[0098] 4. This invention proposes a collaborative contrastive learning strategy, including dual-view complementary contrast and adaptive prototype-driven contrast. The former constructs a dual positive pair and combines it with customized negative sampling to enhance the sensitivity to fine-grained differences, while the latter designs prototype layer semantic alignment and self-weighted balancing of perspective contributions to improve cluster consistency and suppress noise. The two work in parallel and collaboratively to jointly enhance feature discriminativeness and intra-cluster compactness.

[0099] 5. By combining multi-level contrast loss and distillation mechanism, the present invention enables the encoding network to obtain a more robust and generalizable time-frequency feature representation in the pre-training stage, and then exhibits higher diagnostic accuracy and stronger working condition transfer capability in the downstream fine-tuning task.

[0100] 6. This invention significantly improves the accuracy and efficiency of fault diagnosis, especially in complex working conditions, low-labeling or noise interference scenarios, showing better stability and applicability, and has significant engineering application value and promotion prospects. Attached Figure Description

[0101] Figure 1 This is a flowchart of the method according to an embodiment of the present invention;

[0102] Figure 2 This is a flowchart illustrating the iterative update process of the method of the present invention;

[0103] Figure 3 This is an architectural diagram of the method of the present invention. Detailed Implementation

[0104] Example 1: As Figures 1-3 As shown, this invention proposes a mechanical fault diagnosis method based on a prototype-driven dual-view collaborative contrastive fusion network. The framework consists of two main modules: a multi-scale semantic cognitive distiller and collaborative contrastive learning. The multi-scale semantic cognitive distiller fuses consistent features through a cascaded structure and introduces a cross-domain interactive Transformer to generate time-frequency dual-view complementary representations with cross-domain attention. Collaborative contrastive learning employs a dual-path design: dual-view complementary contrastive learning enhances fine-grained discrimination by constructing dual positive sample pairs and combining them with a negative sampling strategy; adaptive prototype-driven contrastive learning, based on prototype alignment and dynamically balancing the contributions of time and frequency views, suppresses representation degradation and optimizes cluster consistency.

[0105] This algorithm is essentially a classification task. To illustrate the steps of the algorithm more intuitively, Figure 2Explain the iterative update process of the entire framework:

[0106] (1) Start training: Start training after the model is built.

[0107] (2) Data input: Input the unlabeled dataset into the pre-trained model. The unlabeled data here includes time-domain and frequency-domain signal sample pairs.

[0108] (3) Pre-training: The parameters of the pre-trained model are iteratively updated using the designed objective function, which is Equation (28): in It is the time-frequency alignment contrast loss of formula (5), and respectively by... It is the dual-view complementary contrast loss of formula (14). This is the adaptive prototype-driven contrastive loss from formula (25), where λ1 and λ2 are predefined loss tradeoff hyperparameters. The main parameter updated by the model is the time encoder parameter θ. t and frequency encoder parameters θ f and attention fusion module parameters ∈ u .

[0109] (4) Optimize the pre-trained objective function: Optimize the model parameters by using the optimizer until the objective loss function converges or the maximum number of iterations is reached. After the iteration is completed, save the pre-trained model.

[0110] (5) Supervised fine-tuning: Load the pre-trained model parameters obtained in the previous step, and optimize and fine-tune the model to adapt to the downstream task through label guidance. The objective function here is the cross-entropy loss function shown in formula (29).

[0111] (6) Optimize and fine-tune the objective function: Similar to pre-training, iteratively update the fine-tuning objective loss function, update the fine-tuning model parameters, and save the fine-tuning model.

[0112] (7) Fault diagnosis: Load the fine-tuning model and input the test sample to get the diagnosis results.

[0113] The specific steps of the method include:

[0114] Step 1: Collect mechanical failure datasets;

[0115] Furthermore, in Step 1, the mechanical fault dataset contains multiple sample pairs, each of which contains a vibration signal and its corresponding state label.

[0116] Step 2: Clean the collected mechanical fault dataset. After sliding window truncation and normalization, divide it into an unlabeled training set, a labeled fine-tuning set, and a labeled test set in an 8:1:1 ratio.

[0117] Furthermore, in Step 2, the normalization process adopts Z-fractional standardization and is truncated by a sliding window (signal length is 1024) to ensure the balance of the number of samples of each type;

[0118] The dataset partitioning steps are as follows:

[0119] The first step is to randomly select 80% of the sample pairs in the mechanical failure dataset and remove the labels to form an unlabeled training set.

[0120] The second step is to randomly select 10% from the remaining 20% ​​of labeled data as a labeled fine-tuning set.

[0121] The third step is to use the remaining 10% as a labeled test set.

[0122] Step 3: Perform a Fast Fourier Transform on all the divided datasets to convert the time signal into a frequency signal, and obtain time-frequency sample pairs;

[0123] Furthermore, Step 3 includes:

[0124] For a given one-dimensional vibration signal V, let the time-domain signal X t ≡V, then in, Let represent the i-th time series sample in the unlabeled training set, and n represent the number of samples in the mini-batch; use Fast Fourier Transform. Time domain signal Convert to frequency domain signal Where FFT stands for Fast Fourier Transform. This represents the i-th frequency domain sample after transformation.

[0125] Step 4: Construct a self-supervised pre-trained model using a multi-scale cognitive distiller and a collaborative contrastive learning strategy. The multi-scale cognitive distiller extracts local time-frequency features, performs global feature distillation on the local time-frequency features to obtain global complementary features, and combines the collaborative contrastive learning strategy to construct a pre-trained loss function.

[0126] Further, in Step 4, the multi-scale cognitive distiller extracts time-frequency local features, including: extracting time-frequency local features from time and frequency signals using time encoders and frequency encoders with identical structures but independent parameters. The processing includes:

[0127] For the original time domain signal and frequency domain signals Encoding was performed using a time-frequency encoder separately:

[0128] H t=Time_Enocer(X t ,θ t ),H f =Frquency_Enocer(X f ,θ f (1)

[0129] Where D is the length of the vibration signal. l represents the feature dimension, indicating the temporal encoded representation output by the temporal encoder. It is the i-th time-encoded representation in the mini-batch; Time_Enocer(,) indicates that the time encoder is constructed by a ResNet-1d network, θ t These are the parameters for the time encoder; This represents the frequency domain encoded representation of the frequency encoder output. It is the i-th frequency encoded representation in the mini-batch; Frequency_Enocer(,) indicates that the frequency encoder is constructed by a ResNet-1d network, θ f These are the parameters of the frequency encoder.

[0130] Further, in Step 4, the global feature distillation of the time-frequency local features includes: extracting a globally consistent representation and a time-frequency complementary representation from the obtained time-frequency local features using an attention fusion module and a cross-domain interaction Transformer module, respectively; the processing includes:

[0131] The time-frequency local features {H} extracted by the time encoder and frequency encoder t H f Mapped to the embedding space, this is used to filter private information from a single perspective. The process is defined as follows:

[0132]

[0133] in, This represents a temporal local embedding representation. d m Indicates the embedding dimension. This represents the frequency local embedding representation. and All are composed of linear MLPs with the same structure but independent parameters, ∈ t and ∈ f These are learnable parameters;

[0134] Using normalized temperature-scaled cross-entropy as the time-frequency contrastive loss function, in a mini-batch training set of size n, the temporal local embedding representation of each sample is... Constructing a time view, in which Represents the i-th time embedding; frequency local embedding represents Construct a frequency view, in which Represent the embedding of the i-th frequency; view the time of each sample. Its corresponding frequency view It is considered a positive pair and negatively paired with other samples;

[0135] Time view of the sample Contrast loss Represented as:

[0136]

[0137] Where, τ a Indicates temperature parameter, For the j-th time embedding, For the j-th frequency embedding, sim(·) represents the cosine similarity between samples, expressed as:

[0138]

[0139] Where T represents transpose, and ||·|| represents L2 norm;

[0140] Considering the time view and frequency view Symmetry between them, time-frequency contrast loss Further expressed as:

[0141]

[0142] Where n is the number of samples in the mini-batch. Time view of the sample The comparative loss, Represents sample frequency view The comparison loss is derived in a similar way to formula (3), that is, the frequency view With the corresponding time view The positive pair is considered the positive pair, and the remaining samples are considered the negative pairs.

[0143] After aligning the time-frequency features, an attention fusion module is used to process the local time-frequency features {H}. t H f The attention fusion process is performed; a globally consistent common representation G is computed using the following attention fusion formula:

[0144] C = f u ([H t H f ],∈ u (6)

[0145]

[0146] in, This represents the globally consistent public representation obtained. d g It is the public representation dimension, f u Represents the nonlinear mapping function constructed by the MLP, ∈ u These are learnable parameters, C is the intermediate vector after concatenating time-frequency local features, [·,·] represents horizontal concatenation of vectors along the row direction, and ψ v It is a dynamic fusion weight, including the time fusion weight λ. t and frequency fusion weight λ f The sigmoid function prevents the weights from approaching 1 at a particular viewpoint; τ is the scaling parameter, and H... v To represent local features of time or frequency, ⊙ denotes element-wise multiplication.

[0147] To enhance complementarity consistency, a cross-domain interactive Transformer module is introduced to generate global complementary features from different perspectives, thereby supporting subsequent contrastive learning; given the time-frequency local features {H} from the dual encoders... t H f}, representing H in the time domain t As a query, the frequency domain coding represents H f As keys and values, the global complementary feature representation Z from a time-domain perspective t for:

[0148]

[0149] Z t =TT L (13)

[0150] In this context, MSA represents multi-head self-attention block, FFN represents feedforward network, MCA represents multi-head cross-attention block to facilitate information exchange between the two branches, and LN represents layer normalization. This represents the global complementary feature representation obtained from the time domain perspective, each Consistent with the dimension of the common representation G, L is the number of layers in the encoder;

[0151] Similarly, when the frequency domain coding representation H f As a query, the time-domain encoding represents H t When used as keys and values, a global complementary feature representation from a frequency domain perspective is obtained. in This represents the global complementary feature obtained by the i-th sample from the frequency domain perspective.

[0152] Furthermore, in Step 4, the pre-trained loss function constructed using the collaborative contrastive learning strategy includes time-frequency alignment, dual-view complementary contrast, and adaptive prototype-driven contrastive loss functions; defined as follows:

[0153] Based on the obtained feature triples {G,Z t Z f}, using the common representation G as the anchor sample, while the time-frequency complementary representation of the same anchor sample is {Z}. t Z f} as positive sample pairs; for negative samples N, a hard negative sample sampling strategy is adopted, selecting the representation {Z} which is very close to the anchor sample G but complementary to its corresponding time-frequency. t Z f The presence of significantly different samples prompts the model to learn more detailed discriminative features; the dual-view complementary contrast loss function is expressed as:

[0154]

[0155] Where d(·,·) represents the Euclidean distance, and α is a predefined threshold. The first term in the array is "max[d(G,Z)". t )+d(G,Z f )+d(Z t Z f The goal is to reduce the common representation G and its time-frequency complementary representation {Z}. t Z f The distance between}, while amplifying the difference with the negative sample N; the second term "max[d(G,Z t ),d(G,Z f The focus is on minimizing G and the time-frequency complementary representation {Z}. t Z f The differences between them accelerate the optimization process;

[0156] To construct an adaptive prototype-driven contrastive loss function that fully utilizes cross-domain complementary structures and enhances cluster consistency, a feature triple {G,Z} is used. t Z f Design a prototype layer to generate three learnable prototype vectors {P, P...} t ,P f The process is represented as follows:

[0157] P = Softmax(F g (G,ω g (15)

[0158] P t =Softmax(Fp (Z t ,ω p (16)

[0159] P f =Softmax(F p (Z f ,ω g (17)

[0160] in, As a public prototype, and Denotes the time-domain and frequency-domain prototypes, respectively, d p Let d be the mapping dimension of the prototype vector. p Equal to the number of categories, F g and F p It is a prototype layer constructed by MLP, P t and P f Prototype layer parameter sharing, ω g and ω p These are parameters of the prototype layer;

[0161] Subsequently, the common prototype P and the perspective-specific clustering prototype P are compared. t and P f Alignment enhances consistency;

[0162] Specifically, in the time domain, in the case of a mini-batch size of n, each common prototype p i Its corresponding time-domain prototype The positive sample is considered positive, while all other samples are considered negative; time-domain prototype Contrast loss Represented as:

[0163]

[0164] in, For the j-th time-domain prototype in the sample, p j Let τ be the j-th common prototype in the sample, k be the number of clusters, and τ be the common prototype. p For cluster-level temperature hyperparameters;

[0165] Similarly, in the frequency domain, each common prototype p i Its corresponding frequency domain prototype The positive pair is considered the positive pair, and the other samples are considered negative pairs; frequency domain prototype Contrast loss Defined as:

[0166]

[0167] in, This is the j-th frequency domain prototype in the sample;

[0168] Furthermore, to prevent all samples from being assigned to the same cluster, resulting in empty clusters, let {P} t ,P f Introducing cross-entropy constraints

[0169]

[0170] in, Let represent the probability of the j-th sample belonging to the i-th prototype in the time domain. Let be the average probability of all samples in the batch belonging to the i-th prototype in the time domain. Let represent the probability of the j-th sample belonging to the i-th prototype in the frequency domain. Let be the average probability of all samples in the batch being assigned to the i-th prototype in the frequency domain;

[0171] In summary, adaptive prototype-driven contrastive loss The preliminary description is as follows:

[0172]

[0173] Furthermore, by employing an adaptive weighting mechanism to achieve a dynamic balance between shared information and viewpoint-specific features, Equation 24 is reconstructed as follows:

[0174]

[0175] Among them, W v It represents the common prototype and the perspective-specific clustering prototype P. v The adaptive weights between them are calculated in the following way:

[0176]

[0177] Where μ is a distance function based on the maximum mean difference (MMD), used to effectively measure distributions P and P'. v The difference between them is defined as:

[0178]

[0179] Where σ(·,·) is a linear kernel function, i.e., σ(x,y)=x T y, the calculated W v It can dynamically adjust the contribution of viewpoint-specific representations to shared representations. If a viewpoint contains rich information and has high semantic value, its contrastive learning weights will be adaptively increased; otherwise, the weights will be decreased.

[0180] Step 5: Use the unlabeled training set processed in Step 3 as input, and then iteratively train according to the pre-training loss function designed in Step 4 until the loss function converges or reaches the maximum number of iterations. Finally, save the pre-trained model.

[0181] Furthermore, in Step 5, the pre-training loss function is defined as follows:

[0182] Based on the above results, Local features are initially aligned and fused to obtain global complementary features; subsequently, by employing... and Deep alignment is achieved at both the feature level and the clustering level, thereby simultaneously enhancing the discriminative power of the global representation and the consistency of clustering; the overall loss function expression for pre-training is:

[0183]

[0184] Here, λ1 and λ2 are trade-off hyperparameters.

[0185] Furthermore, the Step 5 training process includes:

[0186] The unlabeled training set is processed using a random selection method and loaded into the training data loader in batches. Each batch contains two inputs: a time-frequency signal pair. The sample pairs are fed into the time-frequency encoder for feature extraction. Then, according to the defined pre-training loss function, the parameters in the time-frequency encoder are iteratively updated until the pre-training loss function converges or the maximum number of iterations is reached. Finally, the parameters of the pre-trained model are saved.

[0187] Step 6: Build a fine-tuned model and load the pre-trained model parameters. Use the cross-entropy loss function and, guided by labels, obtain the target loss function for fine-tuning.

[0188] Further, in Step 6, the construction of the fine-tuning model includes: constructing a time-frequency encoder, an attention fusion network, and an additional linear classifier; wherein the architecture of the time-frequency encoder and the attention fusion network is consistent with the pre-trained model, and the parameters of the pre-trained model are loaded; the target loss function of the fine-tuning model is... Composed of cross-entropy loss function, target loss function as follows:

[0189]

[0190] Where N is the total number of samples, C is the total number of categories, and y i,c It is the true label of the i-th sample for class c. It is the predicted probability of the i-th sample for class c.

[0191] Step 7: Train the fine-tuning model using the divided labeled fine-tuning set, optimize the objective function by using labels, iterate and update until convergence or the maximum number of iterations is reached, and save the trained fine-tuning model.

[0192] Step 7 includes:

[0193] The labeled fine-tuning set is randomly loaded into the fine-tuning data loader in batches. Each batch contains three inputs: time-frequency signal pairs and real labels. The predicted labels output by the fine-tuning model are compared with the real labels. The parameters of the fine-tuning model are iteratively updated according to the target loss function of the fine-tuning until convergence or the maximum number of iterations is reached. After the fine-tuning is completed, the parameters of the fine-tuning model are saved.

[0194] Step 8: Load the parameters of the trained fine-tuned model, input the divided labeled test set samples, select the category corresponding to the maximum value according to the class probability output by the model to obtain the predicted label, and then obtain the diagnostic result.

[0195] In Step 8, the fine-tuned model is a fine-tuned model with parameters frozen after training, and the final fault diagnosis result is the predicted label, which is obtained by selecting the category corresponding to the maximum category probability.

[0196] This invention constructs a self-supervised representation learning framework to improve fault diagnosis performance under finite labeling conditions. By designing a multi-scale cognitive distiller, semantic deentanglement and information complementarity are achieved at both local and global levels, effectively overcoming the problem of insufficient cross-domain interaction in time-frequency feature fusion. Simultaneously, a cross-domain interaction Transformer module is introduced to model the global attention correlation in the time-frequency domain, further exploring deep relationships and complementarity between domains. Based on this, a collaborative contrastive learning strategy is proposed, including dual-view complementary contrast and adaptive prototype-driven contrast. The former alleviates the constraint of single positive samples and improves fine-grained feature discriminativeness by constructing dual positive pairs and combining customized negative sampling; the latter utilizes a prototype layer to achieve category-level semantic alignment and dynamically balances viewpoint contributions through a self-weighting mechanism, thereby enhancing clustering consistency and reducing noise interference. The parallel collaboration of these two approaches promotes the joint evolution of representation learning and clustering optimization, significantly improving fault diagnosis accuracy.

[0197] To illustrate the effects of the present invention, the technical solution of the present invention will be further described below through specific embodiments:

[0198] 1. Simulation conditions:

[0199] This invention utilizes PyCharm software for experimental simulation. Experiments were conducted on two benchmark fault diagnosis datasets, PU and CWRU (containing one-dimensional vibration signals and labels). The experiments included two classification tasks: (1) fault diagnosis and (2) cross-device fault diagnosis. The parameters were set as follows: pre-training / fine-tuning learning rates of 3e-3 / 3e-4, batch sizes of 128 / 32, maximum number of iterations of 200 / 100, and the optimizer was AdamW. The time-frequency contrast loss was used. Temperature parameter τ a =0.5, Adaptive Prototype-Driven Contrast Loss Temperature parameter τ I =1.0, Attention fusion scaling parameter τ s =10, loss weight parameters λ1=1, λ2=2, Warmup rounds are 5.

[0200] 2. Simulation content:

[0201] The proposed method for mechanical fault diagnosis is based on a prototype-driven dual-view collaborative contrast fusion network, and is compared with existing mechanical fault diagnosis methods based on self-supervised contrastive learning. The specific comparison methods are: (1) Momentum Contrast for Unsupervised Visual Representation Learning (MoCo), (2) A Simple Framework for Contrastive Learning of Visual Representations (SimCLR), (3) Time-Series Representation Learning via Temporal and Contextual Contrasting (TS-TCC), (4) Self-Supervised Contrastive Pre-Training for Time Series via Time-Frequency Consistency (TF-C), (5) Self-Supervised Pretraining via Contrast Learning for Intelligent Incipient Fault Detection of Bearings (SSPCL), and (6) Self-Supervised Feature Extraction via Time-Frequency Contrast for Intelligent Fault Diagnosis of Rotating (7) Fault diagnosis method based on time-series self-supervised learning with time-frequency SiameseNet (TS-TFSIAM);(8) A novel self-supervised representation learning framework based on time-frequency alignment and interaction for mechanical fault diagnosis (TFAI); (9) A time-frequency perception-guided multi-level contrastive learning method for rotating machinery fault diagnosis (TFP-MCL).

[0202] 3. Simulation Results

[0203] The simulation experiments present the results of the comparative method and the method proposed in this invention on the PU and CWRU datasets, respectively. The PU dataset is divided into 13 classes, and the CWRU dataset is divided into 10 classes. Both datasets include healthy, outer race fault, inner race fault, and ball bearing fault states. In this embodiment, traditional fault diagnosis tasks, cross-condition fault diagnosis experiments, and robustness tests under high noise environments are performed on the two datasets in sequence. All experiments are repeated multiple times and the average value is taken. The final result is rounded to two decimal places. The processing method for other datasets is consistent with the above settings.

[0204] In this simulation experiment, four widely used metrics are used to measure the performance of the proposed method and other comparative methods: accuracy (ACC), precision, recall, and F1 score (F1). Given a test sample set, these four metrics can be defined as follows:

[0205] (1) Accuracy (ACC) is the proportion of the number of samples correctly predicted by the model out of the total number of samples. It measures the overall predictive performance of the model, and its formula is:

[0206]

[0207] Wherein, TP (True Positive) represents the number of samples that are true positive and correctly predicted as positive; TN (True Negative) represents the number of samples that are true negative and correctly predicted as negative; FP (False Positive) represents the number of samples that are true negative but incorrectly predicted as positive; and FN (False Negative) represents the number of samples that are true positive but incorrectly predicted as negative.

[0208] (2) Precision is the proportion of samples that are predicted to be positive but are actually positive, which measures the accuracy of the model's prediction of positive results.

[0209]

[0210] (3) Recall is the proportion of actual positive samples that are correctly predicted as positive, and measures the model’s ability to identify positive samples.

[0211]

[0212] (4) The F1 score (F1) is the harmonic mean of precision and recall, taking into account the balance between the two. The F1 score will be higher when both precision and recall are high, and it is suitable for class imbalance problems.

[0213]

[0214] These four metrics can be used to comprehensively evaluate the performance of a classification model, including the overall accuracy of predictions, the precision of positive class predictions, and the ability to identify positive classes.

[0215] Tables 1 and 2 show the performance metrics of the proposed method and other comparative methods in fault diagnosis tasks.

[0216] Table 1 shows the performance evaluation of all methods on the fault diagnosis task on the PU and CWRU datasets.

[0217]

[0218] Table 2 presents the performance evaluation of all methods on the PU and CWRU datasets for cross-device fault diagnosis tasks.

[0219]

[0220]

[0221] Tables 3 and 4 show the performance indicators of the proposed method and other comparative methods in fault diagnosis tasks under high noise environments. SNR = 0dB indicates that noise with the same power as the signal is added to the original signal, and SNR = -2dB indicates that the added noise power is greater than the signal power. This scenario is intended to evaluate the robustness of the proposed method under strong noise interference.

[0222] Table 3 shows the performance evaluation of all methods on the PU dataset for fault diagnosis tasks in high-noise environments.

[0223]

[0224] Table 4 shows the performance evaluation of all methods on the CWRU dataset for fault diagnosis tasks in noisy environments.

[0225]

[0226]

[0227] As can be seen from Tables 1 and 2, the proposed method outperforms other comparative methods in all metrics across the two fault diagnosis tasks using the PU and CWRU datasets. Tables 3 and 4 further demonstrate the strong robustness of the proposed method in fault diagnosis under high-noise environments.

[0228] The specific embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.

Claims

1. A mechanical fault diagnosis method based on a prototype-driven dual-view collaborative comparison fusion network, characterized in that: The specific steps of the method include: Step 1: Collect mechanical failure datasets; Step 2: Clean the collected mechanical fault dataset. After sliding window truncation and normalization, divide it into unlabeled training set, labeled fine-tuning set and labeled test set according to the proportion. Step 3: Perform a Fast Fourier Transform on all the divided datasets to convert the time signal into a frequency signal, and obtain time-frequency sample pairs; Step 4: Construct a self-supervised pre-trained model using a multi-scale cognitive distiller and a collaborative contrastive learning strategy. The multi-scale cognitive distiller extracts local time-frequency features, performs global feature distillation on the local time-frequency features to obtain global complementary features, and combines the collaborative contrastive learning strategy to construct a pre-trained loss function. Step 5: Use the unlabeled training set processed in Step 3 as input, and then iteratively train according to the pre-training loss function designed in Step 4 until the loss function converges or reaches the maximum number of iterations. Finally, save the pre-trained model. Step 6: Build a fine-tuned model and load the pre-trained model parameters. Use the cross-entropy loss function and, guided by labels, obtain the target loss function for fine-tuning. Step 7: Train the fine-tuning model using the divided labeled fine-tuning set, optimize the objective function by using labels, iterate and update until convergence or the maximum number of iterations is reached, and save the trained fine-tuning model. Step 8: Load the parameters of the trained fine-tuned model, input the divided labeled test set samples, select the category corresponding to the maximum value according to the class probability output by the model to obtain the predicted label, and then obtain the diagnostic result. In Step 1, the mechanical fault dataset contains multiple sample pairs, and each sample pair contains a vibration signal and its corresponding state label. Step 3 includes: For a given one-dimensional vibration signal Let the time domain signal ,but ,in, Represents the first in the unlabeled training set A number of time series samples, This represents the number of samples in a mini-batch; using Fast Fourier Transform. Time domain signal Convert to frequency domain signal ,in, Represents the Fast Fourier Transform. Indicates the transformed first... One frequency domain sample; In Step 4, the pre-trained loss function constructed using the collaborative contrastive learning strategy includes time-frequency alignment, dual-view complementary contrast, and adaptive prototype-driven contrastive loss functions; defined as follows: Based on the obtained feature triplet The common representation G is used as the anchor sample, and the time-frequency complementary representation of the same anchor sample is... As positive sample pairs; for negative samples N, a hard negative sample sampling strategy is adopted, selecting a representation that is very close to the anchor sample G but complementary to its corresponding time-frequency. The presence of significantly different samples prompts the model to learn more refined discriminative features; the dual-view complementary contrast loss function is expressed as: ; ; Where d(·,·) represents the Euclidean distance, and 𝛼 is a predefined threshold. The first item in "Aims to reduce the size of the common representation G and its time-frequency complementary representation" The distance between them amplifies the difference with the negative sample N; the second term " "Then the focus is on minimizing the complementary time-frequency representation of G." The differences between them, thereby accelerating the optimization process; Based on feature triples Design a prototype layer to generate three learnable prototype vectors. The process is represented as follows: ; ; ; in, As a public prototype, and Representing the time-domain and frequency-domain prototypes respectively. The mapping dimension of the prototype vector. Equal to the number of categories, and It is a prototype layer constructed by MLP. and Prototype layer parameter sharing, and These are parameters of the prototype layer; Subsequently, the public prototype Perspective-specific clustering prototype and Alignment; Specifically, in the time domain, when the mini-batch size is n, each common prototype Its corresponding time-domain prototype The positive sample is considered positive, while all other samples are considered negative; time-domain prototype Contrast loss Represented as: ; ; in, For the first in the sample A time-domain prototype, For the first in the sample There are 1 common prototype, and k is the number of clusters. For cluster-level temperature hyperparameters; Similarly, in the frequency domain, each common prototype Its corresponding frequency domain prototype The positive pair is considered the positive pair, and the other samples are considered negative pairs; frequency domain prototype Contrast loss Defined as: ; ; in, For the first in the sample A frequency domain prototype; for Introducing cross-entropy constraints : ; ; in, Indicates the first The nth sample in the time domain is related to the nth... The probability of belonging to each prototype, For all samples in the batch, in the time domain, the first... The average attribution probability of each prototype Indicates the first The nth sample in the frequency domain is related to the nth... The probability of belonging to each prototype, For all samples in the batch, in the frequency domain, the first... The average attribution probability of each prototype; In summary, adaptive prototype-driven contrastive loss The preliminary description is as follows: ; Furthermore, by using an adaptive weighting mechanism, Formula 24 can be reconstructed as follows: ; in, It represents a common prototype and a perspective-specific clustering prototype. The adaptive weights between them are calculated in the following way: ; in, The distance function based on the maximum mean difference is defined as follows: ; in, It is a linear kernel function, i.e. .

2. The mechanical fault diagnosis method based on a prototype-driven dual-view collaborative comparison fusion network according to claim 1, characterized in that: In Step 2, the normalization process uses Z-fractional standardization and is truncated using a sliding window. The dataset partitioning steps are as follows: The first step is to randomly select 80% of the sample pairs in the mechanical failure dataset and remove the labels to form an unlabeled training set. The second step is to randomly select 10% from the remaining 20% ​​of labeled data as a labeled fine-tuning set. The third step is to use the remaining 10% as a labeled test set.

3. The mechanical fault diagnosis method based on a prototype-driven dual-view collaborative comparison fusion network according to claim 1, characterized in that: In Step 4, the multi-scale cognitive distiller extracts time-frequency local features, including: extracting time-frequency local features from time and frequency signals using time encoders and frequency encoders with identical structures but independent parameters. The processing includes: For the original time domain signal and frequency domain signals Encoding was performed using a time-frequency encoder separately: (15); in, The length of the vibration signal. , The feature dimension represents the temporal encoded representation of the temporal encoder output. It is the first in a small batch A time-coded representation; This indicates that the time encoder is constructed using a ResNet-1d network. These are the parameters for the time encoder; This represents the frequency domain encoded representation of the frequency encoder output. It is the first in a small batch Each frequency is represented by a code. This indicates that the frequency encoder is constructed using a ResNet-1d network. These are the parameters of the frequency encoder.

4. The mechanical fault diagnosis method based on prototype-driven dual-view collaborative comparison fusion network according to claim 1, characterized in that: In Step 4, the global feature distillation of the time-frequency local features includes: extracting a globally consistent representation and a time-frequency complementary representation from the obtained time-frequency local features using an attention fusion module and a cross-domain interaction Transformer module, respectively; the processing includes: Time-frequency local features extracted from the time encoder and frequency encoder Mapping to the embedding space for filtering private information from a single perspective, the process is defined as follows: ; in, This represents a temporal local embedding representation. , Indicates the embedding dimension. This represents the frequency local embedding representation. ; and They are all composed of linear MLPs with the same structure but independent parameters. and These are learnable parameters; Using normalized temperature-scaled cross-entropy as the time-frequency contrastive loss function, in a mini-batch training set of size n, the temporal local embedding representation of each sample is... Constructing a time view, in which Indicates the first Time embedding; frequency local embedding representation Construct a frequency view, in which Indicates the first Frequency embedding; temporal view of each sample Its corresponding frequency view It is considered a positive pair and negatively paired with other samples; Time view of the sample Contrast loss Represented as: ; in, Indicates temperature parameter, For the first A time embedding, For the first Frequency embedding, The cosine similarity between samples is represented as: ; Where T represents transpose. Represents the L2 norm; Considering the time view and frequency view Symmetry between them, time-frequency contrast loss Further expressed as: ; in, This refers to the sample size in a small batch. Time view of the sample The comparative loss, Represents sample frequency view The comparison loss is derived in a similar way to formula (17), that is, the frequency view With the corresponding time view The positive pair is considered the positive pair, and the remaining samples are considered the negative pairs. After aligning the time-frequency features, an attention fusion module is used to process the local time-frequency features. Perform fusion; compute a globally consistent common representation using the following attention fusion formula. : ; ; ; in, This represents the globally consistent public representation obtained. , It is the public representation dimension. This represents the nonlinear mapping function constructed by the MLP. These are learnable parameters. Let be the intermediate vector after concatenating local time-frequency features, and [·,·] represent horizontal concatenation of vectors along the row direction. It is a dynamic fusion weight, including time fusion weight. Frequency fusion weights The sigmoid function prevents the weights from approaching 1 at a particular viewpoint. It's a scaling parameter. To represent local features of time or frequency, This represents element-wise multiplication. A cross-domain interactive Transformer module is introduced to generate globally complementary features from different perspectives; given time-frequency local features from dual encoders... Time-domain encoding representation As a query, frequency domain coding representation As keys and values, the global complementary feature representation from a time-domain perspective for: ; ; ; ; ; In this context, MSA represents multi-head self-attention block, FFN represents feedforward network, MCA represents multi-head cross-attention block to facilitate information exchange between the two branches, and LN represents layer normalization. This represents the global complementary feature representation obtained from the time domain perspective, each Consistent with the dimension of the common representation G, L is the number of layers in the encoder; Similarly, when frequency domain coding representation As a query, time-domain encoded representation When used as keys and values, a global complementary feature representation from a frequency domain perspective is obtained. ,in Indicates the first Global complementary features obtained from each sample in the frequency domain.

5. The mechanical fault diagnosis method based on a prototype-driven dual-view collaborative comparison fusion network according to claim 1, characterized in that: In Step 5, the pre-training loss function is defined as follows: Based on the above results, Local features are initially aligned and fused to obtain global complementary features; Subsequently, by adopting and Deep alignment is achieved at both the feature level and the clustering level, thereby simultaneously enhancing the discriminative power of the global representation and the consistency of clustering; the overall loss function expression for pre-training is: (28); in, and It's about balancing hyperparameters.

6. The mechanical fault diagnosis method based on prototype-driven dual-view collaborative comparison fusion network according to claim 1, characterized in that: The Step 5 training process includes: The unlabeled training set is processed using a random selection method and loaded into the training data loader in batches. Each batch contains two inputs: a time-frequency signal pair. The sample pairs are fed into the time-frequency encoder for feature extraction. Then, according to the defined pre-training loss function, the parameters in the time-frequency encoder are iteratively updated until the pre-training loss function converges or the maximum number of iterations is reached. Finally, the parameters of the pre-trained model are saved.

7. The mechanical fault diagnosis method based on a prototype-driven dual-view collaborative comparison fusion network according to claim 1, characterized in that: In Step 6, constructing the fine-tuned model includes: constructing a time-frequency encoder, an attention fusion network, and an additional linear classifier; wherein the architecture of the time-frequency encoder and the attention fusion network is consistent with the pre-trained model, and the parameters of the pre-trained model are loaded; the target loss function of the fine-tuned model is... Composed of cross-entropy loss function, target loss function as follows: (29); in, It is the total number of samples. It is the total number of categories. It is the first Each sample corresponds to a category The true label, It is the first Each sample corresponds to a category The predicted probability.