Method for bearing fault migration diagnosis with few samples based on multi-condition supervised contrast learning

By training a classification model through supervised comparative learning under multiple operating conditions and combining global and local feature optimization, the problem of low diagnostic accuracy of traditional bearing fault diagnosis methods under different operating conditions is solved, and efficient fault diagnosis is achieved with limited sample data.

CN121256224BActive Publication Date: 2026-05-08DONGGUAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DONGGUAN UNIV OF TECH
Filing Date
2025-09-02
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Traditional bearing fault diagnosis methods struggle to effectively diagnose faults across different operating conditions when faced with limited sample data, resulting in low diagnostic accuracy and a lack of effective adjustment to decision boundaries.

Method used

A multi-condition supervised contrastive learning approach is adopted. By constructing a multi-condition supervised contrastive learning training model, vibration signal data from the source and target domains are used, and global and local feature optimization is combined to calculate supervised contrastive loss and cross-entropy loss, optimize model parameters, and achieve fault category prediction.

Benefits of technology

It improves diagnostic capabilities when label data is scarce under target operating conditions, effectively overcomes differences between operating conditions, and improves diagnostic accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121256224B_ABST
    Figure CN121256224B_ABST
Patent Text Reader

Abstract

The application provides a few-shot bearing fault migration diagnosis method based on multi-working condition supervised contrast learning, which comprises the following steps: taking a plurality of vibration signals of bearings under different working conditions and having a large number of labels as source domain data and taking vibration signals under a working condition different from that of the source domain data and having only a small number of labels as target domain data; obtaining feature representation and prediction probability distribution of each fault category according to a pre-constructed contrast learning training classification model and the source domain data and the target domain data; then, respectively calculating a supervised contrast loss and a cross-entropy loss, and combining them into a total loss function by weighting; and finally, obtaining a trained contrast learning training classification model by updating model parameters through an adaptive learning rate optimization algorithm and back propagation according to the combined total loss function. The application extracts features by using a plurality of different source domain data through an improved supervised contrast loss function, and optimizes model parameters in combination with a cross-entropy loss function, so as to diagnose the target domain with scarce data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of mechanical equipment fault diagnosis technology, and in particular to a method, system, and computer-readable storage medium for few-sample bearing fault migration diagnosis based on multi-condition supervised comparative learning. Background Technology

[0002] Bearings are critical components widely used in mechanical equipment, serving to reduce friction and support rotating parts. They are extensively used in high-speed railways, aerospace, and other fields. The operating condition of bearings directly affects the normal operation of equipment; once a failure occurs, mechanical production will be forced to stop, resulting in economic losses. Therefore, developing deep learning algorithms that can efficiently and accurately diagnose the health status of bearings is of significant practical importance.

[0003] Traditional bearing fault diagnosis methods primarily rely on signal processing and feature extraction techniques. They analyze bearing vibration signals to extract relevant fault features, then use classification algorithms for fault identification. These methods typically require a large number of labeled training samples and mostly focus on fault diagnosis under a single operating condition. However, in real-world operations, equipment needs to operate under different conditions. When only a small number of labeled samples are available, the training effectiveness of traditional fault diagnosis algorithms drops significantly. Therefore, traditional diagnostic algorithms are difficult to apply in real-world industrial settings. To address cross-condition fault diagnosis, transfer learning has gradually become an important technique. The core idea of ​​transfer learning is to transfer knowledge learned from the source condition to the target condition, reducing the need for labeled data on the target condition. However, most transfer methods only utilize a single operating condition as the source domain, and most only focus on global feature sharing between the single source and target conditions, lacking effective adjustment of the decision boundary and ignoring potential local feature differences between different operating conditions. This makes it difficult for these methods to handle the differences between operating conditions when dealing with cross-condition fault diagnosis, resulting in low diagnostic accuracy.

[0004] ‌ Summary of the Invention

[0005] The purpose of this disclosure is to provide a method, system, and computer-readable storage medium for few-sample bearing fault migration diagnosis based on multi-condition supervised comparative learning, thereby solving the aforementioned problems existing in the prior art.

[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this disclosure are as follows:

[0007] This disclosure proposes a few-sample bearing fault migration diagnosis method based on multi-condition supervised contrastive learning, the method comprising:

[0008] Vibration signals of the bearing under at least two different operating conditions with a large amount of tag information are used as source domain data, and vibration signals under operating conditions with only a small amount of tag information that are different from the source domain data are used as target domain data. The tag information includes: fault information and operating condition information.

[0009] Based on the pre-built initial contrastive learning training classification model, labeled source domain data and target domain data are input into the feature extractor to obtain feature representations; the feature representations are input into the classifier to obtain the predicted probability distribution of each fault category.

[0010] Based on the global and local sample pair strategies pre-constructed for source and target data, positive and negative sample pairs are constructed based on feature representations, and the supervised contrast loss is calculated. The cross-entropy loss is calculated based on the predicted probability distribution of each fault category and the true label. The supervised contrast loss and the cross-entropy loss are then weighted and combined into a total loss function.

[0011] Based on the combined total loss function, the model parameters are updated through an adaptive learning rate optimization algorithm and backpropagation to optimize the model, so that the loss value decreases to convergence, and a well-trained contrastive learning classification model is obtained.

[0012] The unlabeled target domain data is input into the trained contrastive learning classification model to obtain the prediction results.

[0013] Optionally, 50% to 80% of the data from each working condition in the source domain data can be used as a training sample set, and the remainder as a test sample set. Each working condition in the training sample set includes all fault types. K samples can be randomly selected from each type of fault in the target domain data as training sample data, where K can be any one of 0, 1, 2, or 4.

[0014] Optionally, after determining the training samples, the method further includes:

[0015] The overlapping sliding window method is used to divide each continuous vibration signal in the training samples into multiple small segments to obtain a corresponding number of samples;

[0016] A standardization formula was used to standardize each segment of the vibration signal data after segmentation, resulting in standardized sample data; the details are as follows:

[0017]

[0018] in, x This refers to the vibration signal data of each segment after division; μ This represents the average value of the current data segment. σ The standard deviation of the current data segment; z This is the standardized data.

[0019] Optionally, the contrastive learning training classification model includes: a feature extractor consisting of a convolutional neural network (CNN) module and a bidirectional LSTM module that captures contextual information of temporal data, as well as a classifier based on a multilayer perceptron (MLP).

[0020] Optionally, the pre-built global sample pair and local sample pair strategy includes:

[0021] All fault samples of the same type under all operating conditions are treated as positive samples, and fault samples of different types under all operating conditions are treated as negative samples to construct global sample pairs;

[0022] Samples of the same type of fault within the same operating condition are considered positive samples, and all samples of the same type of fault under other operating conditions are considered negative samples, thus constructing local sample pairs.

[0023] Optionally, the total loss function includes: a supervised contrastive loss function and a cross-entropy loss function; wherein, the supervised contrastive loss function includes: a weighted combination of a global contrastive loss function and a local contrastive loss function;

[0024] Global contrastive loss function: Based on global sample pairs, calculate the feature similarity of samples of the same type and the feature difference of samples of different types in all working conditions;

[0025] Local contrast loss function: Based on local sample pairs, calculate the feature similarity of similar samples within the same working condition and the feature difference of similar samples from other working conditions.

[0026] Optionally, the total loss function includes: a supervised contrastive loss function and a cross-entropy loss function; L = λ · L con + σ · L cro ;in, L con This represents the supervised contrastive loss function. L cro Represents the cross-entropy loss function;

[0027] The formula for the comparative loss function is as follows: ,

[0028] in, L con The overall supervised contrastive loss function; w This indicates the number of operating conditions, which is the sum of the number of source domain operating conditions and the number of target domain operating conditions used. α This is a hyperparameter that determines the weights of the global contrast loss and the local contrast loss; L global For global contrastive loss function,L locak,k This is the local contrast loss function.

[0029] Optionally, the global contrastive loss function L global The formula is as follows:

[0030]

[0031] in, sim (z i ,z p ) indicates anchor point sample i eigenvector z i and samples p eigenvector z p Cosine similarity between them sim (z i ,z p )= z i z pj / ||z i ||||z p || ; sim (z i ,z n ) indicates anchor point sample i eigenvector z i and samples n eigenvector z n Cosine similarity between them; Represents anchor point sample i eigenvector z i and samples eigenvectors The cosine similarity between them; τ represents the temperature parameter; Pos i It is a sample i The set of positive samples; Neg i It is a sample i The set of negative samples; N total This is the total number of samples;

[0032] The local contrast loss function L local,k The formula is as follows:

[0033]

[0034] in, k Indicates any single working condition; Nk Indicates working conditions k The total number of samples; P ( l ) represents a sample l The set of positive samples; all l Indicates sample l A set of samples of the same category across all operating conditions; sim (z l ,z p″ ) indicates anchor point sample l eigenvector z l and samples p″ eigenvector z p″ Cosine similarity between them; Represents anchor point sample l eigenvector z l and samples eigenvectors Cosine similarity between them;

[0035] The cross-entropy loss function L cro The calculation formula is as follows:

[0036]

[0037] in, x i Indicates the sample being predicted. y i This represents the true label corresponding to the sample. p ( x i ) represents the probability distribution output by the classifier, which is the predicted probability distribution output by the contrastive learning training classification model.

[0038] Optionally, the fault information includes normal, inner ring fault, outer ring fault, and rolling element fault; the operating condition information includes: motor speed and / or bearing load.

[0039] This disclosure proposes a few-sample bearing fault migration diagnosis system based on multi-condition supervised contrastive learning, the system comprising:

[0040] The data partitioning module is used to take the vibration signals of the bearing under at least two different operating conditions with a large amount of tag information as source domain data, and the vibration signals under operating conditions with only a small amount of tag information that are different from the source domain data as target domain data. The tag information includes: fault information and operating condition information.

[0041] The probability prediction module is used to train a classification model based on a pre-built initial contrastive learning. Labeled source domain data and target domain data are input into the feature extractor to obtain feature representations. The feature representations are then input into the classifier to obtain the predicted probability distribution of each fault category.

[0042] The loss function calculation module is used to construct positive and negative sample pairs based on feature representation according to the global sample pairs and local sample pairs pre-built for the source domain data and target data, calculate the supervised contrast loss, calculate the cross-entropy loss according to the predicted probability distribution of each fault category and the true label, and weight the supervised contrast loss and the cross-entropy loss to form the total loss function.

[0043] The training module is used to optimize the model by updating the model parameters through an adaptive learning rate optimization algorithm and backpropagation based on the combined total loss function, so that the loss value decreases to convergence and a well-trained contrastive learning classification model is obtained.

[0044] The diagnostic module is used to input unlabeled target domain data into a pre-trained contrastive learning classification model to obtain prediction results.

[0045] One aspect of this disclosure is to provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described above.

[0046] The beneficial effects of the embodiments disclosed herein are:

[0047] The method of this disclosure uses multiple source domain data and single target domain data to train a contrastive learning classification model. At the same time, it optimizes the model parameters by using supervised contrastive loss function and cross-entropy loss function, so that the model can not only learn effectively in the source operating conditions, but also overcome the differences between operating conditions through the optimization of global and local features, thereby improving the diagnostic ability of the target operating condition in the case of scarce label data. Attached Figure Description

[0048] Figure 1 This disclosure presents a schematic flowchart of a few-sample bearing fault migration diagnosis method based on multi-condition supervised comparative learning.

[0049] Figure 2 This disclosure presents an overall flowchart of a few-sample bearing fault migration diagnosis method based on multi-condition supervised comparative learning.

[0050] Figure 3 This disclosure presents a schematic diagram of the sample pair construction structure required by the supervised contrast loss function in a few-sample bearing fault migration diagnosis method based on multi-condition supervised contrastive learning.

[0051] Figure 4 This is a schematic diagram of the T-SNE distribution of signal features of the contrastive learning training classification model output by the feature extractor in the few-sample bearing fault migration diagnosis method based on multi-condition supervised contrastive learning proposed in Example 1.

[0052] Figure 5 It is a confusion matrix of target classification results in 6 tasks, where A1~A6 correspond to the diagnostic tasks respectively;

[0053] Figure 6 This is a comparison of diagnostic accuracy for different K values ​​in Task A1 of Example 1;

[0054] Figure 7 Example 2 investigates the impact of different global contrastive loss function weight parameters α on the accuracy of different diagnostic tasks in six tasks based on a proposed multi-condition supervised contrastive learning method for few-sample bearing fault migration diagnosis.

[0055] Figure 8 This disclosure presents a schematic diagram of a few-sample bearing fault migration diagnosis system based on multi-condition supervised comparative learning. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the embodiments of this disclosure will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of this disclosure and are not intended to limit the embodiments of this disclosure.

[0057] This disclosure presents a method for diagnosing mechanical equipment faults based on supervised contrastive learning, particularly applicable to bearing fault diagnosis. This method uses data from multiple different source domains to extract features through an improved variant of supervised contrastive training, ultimately applying these features to the diagnosis of data-scarce target domains.

[0058] like Figure 1 As shown, one embodiment of this disclosure proposes a few-sample bearing fault migration diagnosis method based on multi-condition supervised contrastive learning, the method comprising:

[0059] Step S100: Take the vibration signals of the bearing under at least two different operating conditions with a large amount of tag information as source domain data, and take the vibration signal under one operating condition with only a small amount of tag information that is different from the source domain data as target domain data. The tag information includes: fault information and operating condition information.

[0060] Before step S100, the vibration signal data of the bearing under different operating conditions are collected. The bearing vibration data under different operating conditions can be obtained from the BJTU-RAO dataset. The operating conditions include different types of operating conditions, such as motor speed, load, lubrication, vibration, etc.

[0061] In the model training phase, the method of this disclosure can collect bearing monitoring vibration data from the BJTU-RAO dataset to acquire bearing vibration signals under different operating conditions. This can involve multiple bearing vibration signals from different types of operating conditions, each with corresponding label information. The label information includes fault information and operating condition information. Fault types include normal, inner race fault, outer race fault, and rolling element fault. In practical use, accelerometers can be used to collect bearing vibration signals under different operating conditions.

[0062] The source domain data includes bearing vibration signals under at least two different operating conditions, and the target domain data includes bearing vibration signals under an operating condition different from the source domain data. Operating condition data with sufficient labeling information (which can be multiple operating conditions) is selected as the source domain data. 50%–80% of the source domain data for each operating condition is used as the training set, and each operating condition in the training samples includes all fault types. Preferably, 70% of the source domain data for each operating condition is used as the training set, and the remaining data is used for testing. Operating conditions with only a very small amount of labeled data and a large amount of unlabeled data are used as the target domain data. During the experiment, vibration signal data under operating conditions with only a few labels, different from the source domain data, are used as the target domain data. The target domain data also includes all fault types. K samples from each type of fault in the target domain are randomly selected as training data, where k can be 0, 1, 2, or 4. The remaining data is unlabeled data and used as the test set. For example, K samples are selected for each fault type among normal, inner race fault, outer race fault, and rolling element fault to construct a small sample training set.

[0063] In the experimental setup, the source domain samples account for 70% of the data for that operating condition. This is primarily determined by the amount of data contained in the corresponding operating condition within the dataset. For datasets with sufficient data samples, the proportion can be appropriately reduced. For example, in the two subsequent embodiments, actual measurements showed no significant difference between 50% and 80%. Based on the bearing fault migration diagnosis method applied to a small sample size according to the embodiments of this disclosure, K can be any one of 0, 1, 2, or 4, i.e., K = 0 / 1 / 2 / 4. All of these can demonstrate the superiority of the method of the embodiments of this disclosure. In the later Embodiments 1 and 2, the method of the embodiments of this disclosure is superior to the other two methods.

[0064] The embodiments disclosed herein can perform data augmentation (adding Gaussian noise) on scarce samples in the target domain, which can slightly improve diagnostic accuracy.

[0065] For example, consider vibration signals from motor speed operating conditions one, two, and three. Conditions one and two have sufficient labels, so these vibration signals are used as source domain data. Condition three has only a small amount of labeled data and a large amount of unlabeled data; therefore, the vibration signals from condition three are used as target domain data. In actual tasks, there are operating conditions with different electrical frequencies, different loads, etc., far exceeding two types. Conditions one through three refer to data of the same type of operating condition but with different parameters, while other operating conditions are the same. For example, the electrical frequency of condition one is 20 Hz, condition two is 40 Hz, and condition three is 60 Hz. Conditions one through three operate at different speeds, but other operating conditions, such as load, are the same. The selection of source and target domain data follows the principles of step S100 combined with the actual situation. The source and target domains can be manually selected. The operating condition domain with sufficient or complete category label information is used as the source domain, while the operating condition domain with only a few category label information is used as the target domain. Here, the distinction between source and target domain data is mainly to simulate situations in real-world scenarios where cost constraints prevent the labeling of a large amount of information.

[0066] After obtaining the source domain data and target domain data in step S100 and selecting the corresponding training samples, the training sample data is processed. In this embodiment of the present disclosure, the overlapping sliding window method is used to segment the data, and the data is then standardized after segmentation.

[0067] Specifically, in step S110, the overlapping sliding window method is used, with a window length of 2048 sampling points, an overlap length of 256 sampling points, and a sliding step size of 1792 sampling points. Each continuous vibration signal in the training samples is divided into multiple small segments to obtain the corresponding number of samples.

[0068] Vibration signal segment in the first window Vibration signal segment in the second window And so on. The number of samples M = ┕(N-2048) / (2048-256)┙+1, where the length of the original vibration signal is N points.

[0069] Step S120: Standardize each segmented sample to obtain standard sample data.

[0070] The standardized formula is: z = (x - μ) / σ, where, x The original data, i.e., each segment of the vibration signal data after being divided, x 1 x 2 wait; μ This represents the average value of the current data segment. σis the standard deviation of the current data segment, representing the "dispersion" of this data; z is the standardized data.

[0071] The processed data is a time-domain signal conforming to a standard normal distribution. The core purpose of processing is to make the data more suitable as input for subsequent models. Standardization can reduce numerical calculation errors and improve computational stability. The core effect of processing is to enable different signals to more accurately highlight the changes in fault characteristics themselves, specifically by eliminating DC offset and suppressing the influence of background noise, thereby making the extracted features more effective and improving the model's generalization ability.

[0072] To obtain source domain data training samples by uniformly sampling each fault type, the method further includes:

[0073] Step S130: Fusion of time-domain and frequency-domain information for each type of fault sample in the source domain.

[0074] The time-domain features retain the complete time-domain signal, while the frequency-domain features are obtained by using envelope demodulation, performing FFT on the envelope signal, and extracting data points from the lower frequency range as frequency-domain features.

[0075] Each standardized time-domain vibration signal sequence serves as time-domain information. Standardization alters the energy distribution and relative amplitude of the original signal, causing the absolute amplitude of the envelope to lose its original physical meaning. Here, the envelope spectrum extracted from the original data segment serves as frequency-domain information, and the two together form a feature vector. The time-domain features include: the standardized time-domain signal z=[х i ,x i+1 ,…x i+2047 Frequency domain characteristics: The envelope signal, e, is obtained by performing a Hilbert transform on the original window signal. ω =|H{x i}|, where H represents the Hilbert transform, and then the envelope signal is subjected to an FFT transform, i.e., f ω =|F{e ω}| 1:M Where F represents the FFT transform and M is the truncation length (e.g., 512). The concatenation results in the final feature vector. X i =[х i ,x i+1 ,…x i+2047 ,f ω1 , f ω2 …, f ωM ].

[0076] In envelope spectrum analysis, the focus is usually on modulation frequencies associated with mechanical faults. These fault frequencies (such as the repetition frequencies of the inner and outer rings and rolling elements of a bearing) are typically relatively low, and the high-frequency components usually no longer contain valuable fault modulation information because this information has been "demodulated" to the low-frequency band.

[0077] Truncating effectively removes high-frequency noise and irrelevant information, allowing the model to focus more on discriminative low-frequency features during learning. 512 is a common choice, as it covers the envelope modulation frequencies of most mechanical faults.

[0078] Step S140: Calculate the mutual information (MI) between sample features and fault labels, and screen samples with high MI.

[0079] The formula for calculating the mutual information (MI) value of each type of fault sample is as follows:

[0080]

[0081] in, X Represents the feature vector of segmented samples, such as X i ; Y The label represents the fault category, such as y∈{normal, inner circle fault, ...}. p ( x , y ) represents a feature x The joint probability distribution with the label y can be estimated using kernel density or histogram statistics. p ( x ), p ( y ) represent the marginal probability distributions.

[0082] For all samples of type k fault ,calculate I ( ; Y = k For each type of fault, retain the top M samples with the highest MI values, e.g., M =min(200, N k )

[0083] Step S150: Select high MI samples evenly according to fault category to construct the final source domain sample training set.

[0084] Ensure the final number of training samples is the same for each type of fault, e.g., 200 samples per class. Mutual information calculation is performed on the feature vector Xi of each independent sample, without fusion across segments. During selection: For all samples of each fault type, calculate the mutual information value between its features and the class label; sort by MI value, and retain the top M samples with the highest discriminative power.

[0085] Step S200: Train the classification model based on the pre-built initial contrastive learning, input the labeled source domain data and target domain data into the feature extractor to obtain feature representations; input the feature representations into the classifier to obtain the predicted probability distribution of each fault category.

[0086] It should be noted that inputting source domain data and target domain data into a pre-built contrastive learning model yields the predicted probability distribution for each fault category under all operating conditions. This is because in the application scenario, the source domain data is known to be sufficient and contains label information, while due to factors such as cost, only a very small amount of labeled data can be collected for the target domain. This labeled data is also used as training data. In other words, the training process mixes training data from the source domain operating conditions with a small sample of training data from the target domain operating conditions.

[0087] A contrastive learning-trained classification model is pre-built. This model structure includes a feature extractor and a classifier. The feature extractor extracts fault features from samples, and the classifier predicts the fault category of the samples. The feature extractor includes a Convolutional Neural Network (CNN) module and a bidirectional LSTM module to capture contextual information from temporal data. The classifier includes a Multilayer Perceptron (MLP). The CNN module consists of three 1D convolutional layers, ReLU, and a max-pooling layer to extract local features. The kernel size of the three 1D convolutional layers is 16, the stride is 2, and the number of channels is 32 / 64 / 128. The max-pooling layer has a pool size of 2. The BiLSTM module includes a 128-dimensional hidden layer to capture temporal dependencies. The hidden layer dimension is 128, and after bidirectional concatenation, it outputs 256-dimensional temporal features. The classifier is a two-layer MLP that outputs fault category probabilities. The two-layer MLP takes 256 dimensions as input and outputs 128 dimensions and four categories, corresponding to the fault types.

[0088] CNNs possess efficient local feature extraction capabilities, while bidirectional LSTMs can capture temporal information (using a dataset of collected vibration time-series signals), helping the model better understand feature relationships. MLPs are used for efficient classification of fused features (normal / inner race fault / rolling element fault / outer race fault, etc.).

[0089] The contrastive learning training classification model of this disclosure employs a combination of a convolutional neural network (CNN) and a bidirectional long short-term memory (BiLSTM) network to process temporal signals. Specifically, convolutional layer modules are used for feature extraction, then a bidirectional LSTM is used to capture the contextual information of the temporal data, and finally a multilayer perceptron (MLP) is used for feature projection and classification.

[0090] The classification model is trained using initial contrastive learning and then propagated forward. Labeled source domain data (condition 1, condition 2) and labeled target domain data (condition 3) are processed by a feature extractor to obtain their feature representations. These features are then input into the classifier to obtain the predicted probability distribution for each fault category. The source and target domain data input to the contrastive learning training model can be segmented and standardized training samples. The source domain samples undergo equalization sampling, but an additional dimension is added in the `forward()` function to accommodate convolutional layer calculations. The mathematical formulas for the model's output feature representation and logits are as follows:

[0091]

[0092] Wherein, the input signal is z 0 , The data segments, after preprocessing, are given an additional dimension; MLP(·) is a multilayer perceptron, and the data is finally compressed into a discriminative fault feature display f;

[0093] Flatten(·), a flattening operation, transforms temporal features into feature vectors; BiLSTM(·), a bidirectional long short-term memory network, models the temporal evolution of fault features, captures temporal dependencies, has 128 hidden layers, and outputs 256-dimensional features; ConvBlock(z), a convolutional feature extraction function, extracts local fault features. Represented as a vector space of dimension , C Number of fault categories W cls This is the classification weight matrix. b cls The classification bias matrix is ​​used to obtain the classification log. its .

[0094] For each vibration signal, the feature extractor outputs a set of feature vectors. Where m represents the number of segments after the signal is divided (e.g., 2560 points / segment, m segments in total). This represents the 256-dimensional feature vector of the i-th segment, containing CNN local features and BiLSTM temporal context. Each It corresponds to a local time period of the original signal, but the global signal information is implicitly included through BiLSTM. Each Independent input classifiers (MLPs) produce prediction results for each segment. The predictions of all segments can be integrated using methods such as voting or confidence to arrive at the final diagnostic result.

[0095] After the model is updated, in the next round of forward propagation, the same input vibration signal will extract more discriminative features. That is, the feature extractor accepts the gradient backpropagation of supervised contrastive loss and cross-entropy loss, updates the CNN weights and BiLSTM weights, and outputs the optimized feature representation; the classifier accepts the gradient backpropagation of cross-entropy loss, updates the weights of the fully connected layer, and performs prediction and classification on the optimized feature representation.

[0096] Step S300: Based on the global sample pairs and local sample pairs strategy pre-constructed from the source domain data and target data, construct positive and negative sample pairs based on feature representation, calculate the supervised contrast loss, calculate the cross-entropy loss based on the predicted probability distribution of each fault category and the true label, and weight the supervised contrast loss and the cross-entropy loss to form the total loss function.

[0097] This embodiment of the disclosure is based on the feature matrix representations corresponding to each working condition output by the CNN, BiLSTM, and MLP feature extractors after the source domain data and target domain data in step S200 are processed by the feature extractor. It calculates the feature similarity between samples of the same type of fault and the feature difference between samples of different types of fault, and performs supervised contrastive loss calculation. The predicted probability distribution of each fault category obtained in step S200 is combined with the real labels to calculate cross-entropy loss. Then, the supervised contrastive loss and cross-entropy loss are weighted and combined to obtain the total loss function for training the contrastive learning classification model. The main innovation of this embodiment of the disclosure lies in the innovation of local contrastive loss in the traditional supervised contrastive loss. It proposes a sample pair construction strategy suitable for multi-source domain learning, including global sample pairs and local sample pairs, thereby adding local contrastive loss to the traditional supervised contrastive loss.

[0098] Supervised contrastive loss consists of global contrastive loss and local contrastive loss. While cross-entropy loss and global contrastive loss share a similar ultimate goal, their mechanisms of action and optimization directions differ. Cross-entropy loss focuses on the decision-making level, directly optimizing the classification boundary; whereas contrastive loss operates at the feature level, optimizing the feature representation space. Combining the two can enhance feature discriminative power and decision-making performance, improve feature transferability, and better adapt to few-shot learning.

[0099] like Figure 3 As shown, the sample pairs used to construct the supervised contrastive loss function for the training samples include: treating samples of the same type of fault across all operating conditions as positive samples and treating samples of different types of faults across all operating conditions as negative samples, thus constructing global sample pairs. These global sample pairs are used to calculate the global contrastive loss. In other words, samples of the same type of fault across operating conditions are positive samples, and samples of different types of faults are negative samples.

[0100] Local sample pairs are constructed by treating similar fault samples within the same operating condition as positive samples and all similar fault samples under other operating conditions as negative samples. These local sample pairs are used to calculate the local contrast loss. In other words, similar fault samples within the same operating condition are positive samples, and similar fault samples under other operating conditions are negative samples.

[0101] Global contrastive loss function: Based on global sample pairs, calculate the feature similarity of samples of the same type and the feature difference of samples of different types in all operating conditions; samples of the same type refer to samples with the same fault category; samples of different types refer to samples with different fault categories.

[0102] Local contrast loss function: Based on local sample pairs, calculate the feature similarity of similar samples within the same working condition and the feature difference of similar samples in other working conditions; similar samples refer to samples with the same fault category.

[0103] Contrastive learning optimization: Based on supervised contrastive loss function, the function f is optimized to generate discriminative features. This involves optimizing the features, calculating the feature similarity matrix between samples, narrowing the distance between similar samples, and widening the distance between dissimilar samples. The feature extractor parameters are then updated to ensure... It possesses stronger category discrimination capabilities. Input each data point into the classifier and output the fault category.

[0104] Specifically, for positive samples, similar fault feature pairs are constructed; for negative samples, dissimilar fault feature pairs are constructed. The feature extractor simultaneously receives gradient feedback from supervised contrastive loss and cross-entropy loss, jointly updating parameters to minimize the distance between similar samples and maximize similarity, maximize the distance between dissimilar samples, and minimize similarity. The supervised contrastive loss function optimizes features in the following ways: Bringing positive sample pairs closer: minimizing the distance between features of similar samples (similarity → 1). Pushing negative sample pairs apart: maximizing the distance between features of dissimilar samples (similarity → 0).

[0105] The supervised contrastive loss function is a weighted combination of the global contrastive loss function and the local contrastive loss function. The roles of the supervised contrastive loss and the cross-entropy loss are as follows: 1) Global contrastive loss: focuses on samples under all working conditions, ensuring that samples with the same label are closer in the feature space and increasing the distance between samples of different classes in the feature space; Local contrastive loss: focuses on further converging similar samples under the same working condition, helping the model to better adapt to the detailed features within the working condition and improve the accuracy of fault diagnosis; The overall supervised contrastive loss uses data from two or more different working conditions as the source domain. By combining global loss and local loss, it assists the model in acquiring globally shared features to improve the knowledge transfer effect. At the same time, it can also learn the local differences between working conditions, reducing the possibility of ignoring the feature differences between working conditions when learning across working conditions. 2) Reduce the difference between the model's prediction results and the actual results.

[0106] The supervised contrastive loss function includes a global contrastive loss function and a local contrastive loss function, wherein the formula for the global contrastive loss function is as follows:

[0107] in, L global This is the global contrastive loss function; sim (z i ,z p ) indicates anchor point sample i eigenvector z i and samples p eigenvector z p Cosine similarity between them sim (z i ,z p )= z i z p / ||z i ||||z p || ; Eigenvector z p The sample extracted by the feature extractor in step S200 p eigenvectors; sim (z i ,z n ) represents the eigenvector z i and eigenvector z n Cosine similarity between them; sim (z i ,z p' ) represents the eigenvector z i and eigenvector z p' The cosine similarity between them; τ represents the temperature parameter; Pos i It is a sample i The set of positive samples; Neg i It is a sample i The set of negative samples; z i Indicates sample i The feature representation vector is obtained after feature extraction. An innovative approach is proposed to fuse a global contrastive loss function with a local supervised contrastive loss. The global loss is used to extract globally shared features, while the local contrastive loss is used to extract fine-grained features specific to the working conditions. This fusion reduces the risk of overfitting that may occur in few-shot learning.

[0108] Global positive samples refer to samples of the same fault category as the anchor sample across all operating conditions. Global negative samples are samples of a different fault category than the anchor sample. Local positive samples refer to samples of the same fault category as the anchor sample within the same operating condition. Local negative samples are samples of the same fault category as the anchor sample but under different operating conditions. N total That is the total number of samples.

[0109] The formula for the local contrast loss function is as follows:

[0110]

[0111] in, L local,k For working conditions k Local contrast loss; k Indicates any single working condition; N k Indicates working conditions k The total number of samples; P ( l ) represents a sample l The set of positive samples; all l Indicates sample l The set of samples of the same fault category under all operating conditions. τ represents the temperature parameter. sim (z l ,z p″ ) indicates anchor point sample l eigenvector z l and samples p″ eigenvector z p″ Cosine similarity between them sim (z l ,z p″ )= z l z p″ / ||z l ||||z p″ || .

[0112] The Softmax function built into the cross-entropy loss algorithm calculates the cross-entropy loss based on the logits output of the classifier according to the feature representation. The Softmax classifier, and the cross-entropy loss function... L cro The calculation formula is as follows:

[0113]

[0114] in, x i Indicates the sample being predicted.y i This represents the true label corresponding to the sample. p ( x i The probability distribution represented by represents the output probability distribution of the classifier, which is the predicted probability distribution of the classification model trained by contrastive learning. In the experimental case, the supervised contrastive loss function and the cross-entropy loss function are weighted equally, each accounting for 50%.

[0115] The supervised contrastive loss function is a weighted sum of the global contrastive loss function and the local contrastive loss function.

[0116] in, L con The overall supervised contrastive loss function; w This indicates the number of operating conditions, which is the sum of the number of source domain operating conditions and the number of target domain operating conditions used. α This is a hyperparameter that determines the weights of the global contrast loss and the local contrast loss; L global For global contrastive loss function, L locak,k For example, the local contrastive loss function; Figure 7 As shown in the figure and table below, experiments have revealed a trade-off between global and local contrastive losses. There exists an optimal α value that can balance the conflict between global and local contrastive losses and, to some extent, jointly optimize the overall performance of the model. The preferred α value is... α= At a value of 0.7, the contrastive learning training classification model achieved the highest diagnostic accuracy.

[0117] The loss function L for training the contrastive learning classification model is obtained by weighting the supervised contrastive loss function and the cross-entropy loss function, as shown in the following formula:

[0118] L = λ · L con + σ · L cro ;

[0119] Among them, the preferred ones are λ Both σ and L are 0.5. Initially, L is set to L = λ·L. con +(1-λ)·L cro

[0120] For λ∈{0.01, 0.1, 0.3, 0.5, 0.7, 0.9}, multiple sets of tasks were selected for testing. The results showed that for any of the above λ values, the average accuracy obtained from the tests was very close. However, the fluctuation range at 0.5 was relatively small. Therefore, the two values ​​were weighted equally.

[0121] Step S400: Based on the combined total loss function, update the model parameters using an adaptive learning rate optimization algorithm and backpropagation to optimize the model until the loss value decreases to convergence, thus obtaining the trained model.

[0122] Learn and train the classification model.

[0123] The training period is 50 epochs. Iterative observation shows that the loss function converges significantly, and the model is optimized by minimizing the loss function. The adaptive learning rate optimization algorithm is the AdamW optimizer. The joint parameter update refers to: (1) the parameters of the feature extractor are adjusted by the gradients of both supervised contrastive loss and cross-entropy loss; (2) the parameters of the classifier are adjusted only by the gradient of cross-entropy loss. Lcon feature space alignment (same class is closer, different class is farther away). Lcro classification boundary optimization.

[0124] Step S500: Input the unlabeled target domain data into the trained contrastive learning classification model to obtain the prediction result.

[0125] like Figure 2 As shown, in bearing fault diagnosis, after training, unlabeled working condition data is input into the trained model for forward propagation to obtain the model's prediction results, thus realizing bearing fault diagnosis.

[0126] This disclosure uses multiple different working condition data for training, and optimizes the model parameters by using supervised contrastive loss function and cross-entropy loss function. This enables the model to not only learn effectively in the source working conditions, but also overcome the differences between working conditions through the optimization of global and local features, thereby improving the diagnostic ability of the target working condition when label data is scarce.

[0127] like Figure 8 As shown, another aspect of this disclosure provides a few-sample bearing fault migration diagnosis system based on multi-condition supervised contrastive learning, the system comprising:

[0128] The data partitioning module 100 is used to take the vibration signals of the bearing under at least two different operating conditions with a large amount of tag information as source domain data, and the vibration signals under operating conditions with only a small amount of tag information that are different from the source domain data as target domain data. The tag information includes fault information and operating condition information.

[0129] The probability prediction module 200 is used to train a classification model based on a pre-built initial contrastive learning, input labeled source domain data and target domain data into a feature extractor to obtain feature representations, and input the feature representations into a classifier to obtain the predicted probability distribution of each fault category.

[0130] The loss function calculation module 300 is used to construct positive and negative sample pairs based on feature representation according to the global sample pairs and local sample pairs strategy pre-constructed for the source domain data and target data, and calculate the supervised contrast loss; calculate the cross-entropy loss according to the predicted probability distribution of each fault category and the true label, and weight the supervised contrast loss and the cross-entropy loss to form the total loss function.

[0131] The training module 400 is used to optimize the model by updating the model parameters through an adaptive learning rate optimization algorithm and backpropagation based on the combined total loss function, so that the loss value decreases to convergence, and a well-trained contrastive learning classification model is obtained.

[0132] The diagnostic module 500 is used to input unlabeled target domain data into a trained contrastive learning classification model to obtain prediction results.

[0133] This disclosure embodiment uses data from multiple different source domains to extract features through an improved variant supervised contrastive training method, ultimately for the diagnosis of data-scarce target domains. The data partitioning module further includes: determining training samples: dividing 50% to 80% of the data from each working condition in the source domain data as a training sample set, with the remainder as a test sample set. Each working condition in the training samples includes all fault types; the target domain data also includes all fault types, and K samples are randomly selected from each type of fault in the target domain data as training sample data, where K can be any one of 0, 1, 2, or 4.

[0134] The data partitioning module further includes: preprocessing the training samples: using the overlapping sliding window method, each continuous vibration signal in the training samples is divided into multiple small segments to obtain a corresponding number of samples;

[0135] A standardization formula was used to standardize each segment of the vibration signal data after segmentation, resulting in standardized sample data; the details are as follows:

[0136]

[0137] in, x This refers to the vibration signal data of each segment after division; μ This represents the average value of the current data segment. σ The standard deviation of the current data segment; z This is the standardized data.

[0138] The data partitioning module further includes: equal sampling of each fault type in the preprocessed source domain data; and fusion of time domain information and frequency domain information for each type of fault sample in the source domain.

[0139] Each segment of the standardized time-domain vibration signal sequence is treated as time-domain information. Standardization alters the energy distribution and relative amplitude of the original signal, causing the absolute amplitude of the envelope to lose its original physical meaning. Here, the envelope spectrum extracted from the original data segment is used as frequency-domain information. The two together form a feature vector, where the time-domain features include: the standardized time-domain signal z=[х i ,x i+1 ,…x i+2047 Frequency domain characteristics: The envelope signal, e, is obtained by performing a Hilbert transform on the original window signal. ω =|H{x i}|, where H represents the Hilbert transform, and then the envelope signal is subjected to an FFT transform, i.e., f ω =|F{e ω}| 1:M Where F represents the FFT transform and M is the truncation length (e.g., 512). The concatenation results in the final feature vector. X i =[х i ,x i+1 ,…x i+2047 ,f ω1 , f ω2 …, f ωM ].

[0140] In envelope spectrum analysis, the focus is usually on modulation frequencies associated with mechanical faults. These fault frequencies (such as the repetition frequencies of the inner and outer rings and rolling elements of a bearing) are typically relatively low, and the high-frequency components usually no longer contain valuable fault modulation information because this information has been "demodulated" to the low-frequency band.

[0141] Truncating effectively removes high-frequency noise and irrelevant information, allowing the model to focus more on discriminative low-frequency features during learning. 512 is a common choice, as it covers the envelope modulation frequencies of most mechanical faults.

[0142] Calculate the mutual information (MI) between sample features and fault labels, and filter samples with high MI. The formula for calculating the MI value and mutual information of each type of fault sample is as follows:

[0143]

[0144] in, X Represents the feature vector of segmented samples, such as X i ; Y The label represents the fault category, such as y∈{normal, inner circle fault, ...}. p ( x , y ) represents a feature xThe joint probability distribution with the label y can be estimated using kernel density or histogram statistics. p ( x ), p ( y ) represent the marginal probability distributions.

[0145] For all samples of type k fault ,calculate I ( ; Y = k For each type of fault, retain the top M samples with the highest MI values, e.g., M =min(200, N k );

[0146] High-MI samples are selected evenly according to fault category to construct the final source domain sample training set. Ensure that the final training sample count is the same for each fault category.

[0147] Another aspect of this disclosure provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described above.

[0148] Example 1 uses the health status identification and diagnosis of the drive gear support bearing in the bogie of the BJTU-RAO (Rail Transit Train Bogie Transmission System Fault Simulation Dataset) as an example to specifically illustrate the process of the bearing diagnosis method of this disclosure. As shown in Table 1, the dataset used includes four health states of the bearing: normal, inner ring fault, outer ring fault, and rolling element fault. Six different operating conditions are represented as vibration signals obtained under the following conditions: motor no-load, motor speed corresponding to electrical frequencies of 20Hz, 40Hz, and 60Hz, and lateral load of 10KN applied, with motor speed corresponding to electrical frequencies of 20Hz, 40Hz, and 60Hz respectively; and operating conditions of 20Hz-10KN, 40Hz-10KN, and 60Hz-10KN respectively. During the test, the sampling frequency of the vibration signal samples is 64kHz. Signal segments are obtained through data segmentation. A window of 2048 is used as a fixed length to slide over the complete vibration signal, with an overlap length of 256 and a sliding step size of 1792, dividing the continuous signal into small segments to obtain data samples. The source domain samples contain 70% of the training data under multiple operating conditions, while the target domain training samples contain only 4 randomly selected samples for each fault type under operating conditions with a small number of labels that are different from the source domain data conditions.

[0149] Table 1 shows the training samples for different faults under different operating conditions in BJTU-RAO.

[0150]

[0151] Table 1 shows that each operating condition in the experimental scenario includes four fault types, with 357 samples for each fault. When using a certain operating condition as the training sample for the target domain, a small number of K fault data points are extracted as the target domain samples.

[0152] Table 2 shows the operating conditions selected for the BJTU-RAO data diagnostic task.

[0153]

[0154] Based on the sample set and data partitioning in Table 1, a transfer diagnostic algorithm was constructed. It was tested on different diagnostic tasks in Table 2 to verify the actual effectiveness and feasibility of this first embodiment. To eliminate the interference of random factors, the experiment was repeated 10 times, and the average value of the diagnostic results was calculated as the basis. As shown in Table 3, this first embodiment achieved accuracies of 94.513%, 99.979%, 99.799%, 90.534%, 98.733%, and 69.482% respectively on the six cross-validation transfer diagnostic tasks.

[0155] Table 3. Comparison of diagnostic accuracy in Example 1

[0156]

[0157] Method 1 employs the same model architecture and data selection strategy as Example 1, but differs in that it does not use supervised contrastive learning to deeply extract global and local features from anchor samples; instead, it only uses the cross-entropy loss function for supervised training. The diagnostic accuracies of this method on cross-validation are 90.547%, 99.708%, 99.415%, 87.99%, 97.472%, and 56.466%, respectively, which are lower than those of Example 1. Method 2 employs the same model architecture and data selection strategy as Example 1, but differs in that it does not use supervised contrastive learning to deeply extract global and local features from anchor samples. Instead, it performs data augmentation on a small number of samples in the target domain and performs self-supervised contrastive training, aligning the feature distributions of the source and target domains using the MMD loss function, and finally using cross-entropy loss to learn class discriminative features. The diagnostic accuracies of this method on cross-validation are 93.259%, 99.85%, 99.607%, 88.343%, 97.824%, and 58.574%, respectively, which are lower than those of Example 1. (See attached...) Figure 4 In a feature comparison, this embodiment demonstrates more stable clustering results and clearer category decision boundaries compared to the two common diagnostic algorithms. Task A6 clearly shows that when the source domain conditions differ significantly from the target domain conditions, the diagnostic accuracies of Method 1 and Method 2 are only 56.466% and 58.574%, respectively, far lower than the 69.482% diagnostic performance of this method. This further illustrates the feasibility of feature transfer under fusion conditions in this embodiment. Figure 5 As shown, the confusion matrix can provide a more intuitive way to view the difference between the classifier's prediction results and the actual labels, which can help to make possible targeted improvements to this method in the future.

[0158] By comparing this first embodiment with the other two diagnostic methods Figure 4 The T-SNE distribution diagram shown demonstrates that the embodiments of this disclosure can effectively extract globally shared features and differential features under different working conditions, and effectively adjust the decision boundary, thereby improving the diagnostic accuracy of the transfer diagnostic model.

[0159] Meanwhile, to demonstrate the improved supervised contrastive learning strategy in this embodiment, different sample pair construction strategies were adopted, and a local supervised contrastive loss was added to the supervised contrastive loss function, which is more suitable for cross-domain diagnostic tasks based on multi-condition data. The experimental setup and diagnostic results are shown in Table 4.

[0160] Table 4 compares the diagnostic accuracy of single-source domain versus dual-source domain diagnostics.

[0161]

[0162] In Table 4, since the diagnostic performance of the source domain composed of working conditions 2 and 3 in task A1 is significantly better compared to that of the target domain composed of working condition 1, a source domain removal and merging test comparison was conducted. Because very few data points in the target domain participate in the training, and the designed supervised contrastive loss function treats each working condition's data equally, the training data for each working condition participates in the calculation of contrastive loss and cross-entropy loss.

[0163] Observing Table 4, it can be clearly seen that, based on the learning strategy of this embodiment, increasing the amount of working condition data is beneficial to improving the cross-domain diagnostic accuracy. This shows that the improved variant supervised contrast loss in this embodiment can cope with richer multi-domain data. By jointly optimizing the global loss and local loss, the model has a stronger feature mining capability.

[0164] To further demonstrate the superiority of the method of this disclosure for few-shot learning, a few-shot control test is performed on the A1 task in this embodiment, that is, the diagnostic accuracy is explored for different K values. Observation Figure 6The method of this disclosure achieves accuracies of 89.83%, 92.34%, 93.13%, and 94.51% respectively for the A1 task when K=0 / 1 / 2 / 4. Even without any target domain data (K=0) during training, the method of this disclosure achieves a high diagnostic accuracy of 89.83%. Furthermore, the diagnostic accuracy increases with the number of trainable samples in the target domain, and both accuracy and stability are significantly higher than the other two methods. Based on the A1 task with K=1 / 2 / 4, data augmentation is performed on the target domain training samples, with each data point receiving two augmentations. The augmentation method involves adding Gaussian noise with standard deviations of 0.1 and 0.2. Since the source domain data is relatively abundant, data augmentation is only performed on the target domain training data. The diagnostic accuracy of the method of this disclosure is improved to 93.24%, 95.03%, and 96.37% respectively. The remaining experimental groups also achieved certain improvements through data augmentation, which further confirms that the method of this disclosure is suitable for few-shot learning tasks when the target domain samples are scarce.

[0165] Example 2 uses the health status identification and diagnosis of a bearing in the HUST-Bearing dataset as a case study. Data acquisition was performed using a triaxial accelerometer at a sampling frequency of 25.6 kHz. The bearing has three different fault locations: inner ring, outer ring, and rolling elements. Different fault severity levels and normal health states were set at different speeds. The operating condition data in Table 5 were selected for experimental verification in this experiment. The electrical frequencies were 25 Hz, 30 Hz, 35 Hz, 40 Hz, 60 Hz, and 70 Hz, with other operating conditions remaining the same. As shown in Table 6, B1-B6 are the operating condition matching codes used for cross-domain diagnostic tasks.

[0166] Table 5 shows the dataset information for different faults corresponding to different operating conditions in the HUST-bearing dataset.

[0167]

[0168] Table 5 shows that each working condition in the experimental scenario includes four fault types, with 145 samples for each fault. When using a certain working condition as the training sample for the target domain, a small number of fault data points are extracted as the target domain samples (K=4 is set in the following experiments).

[0169] Table 6 shows the operating conditions selected for the HUST-bearing data diagnostic task.

[0170]

[0171] Based on the sample set and data partitioning in Table 5, a transfer diagnostic algorithm was constructed. It was tested on different diagnostic tasks in Table 6 to verify the practical effect and feasibility of this second embodiment. The same data processing method, data selection strategy, and model architecture as in Example 1 were used. To eliminate the interference of random factors, the experiment was repeated 10 times, and the average value of the diagnostic results was calculated as the basis. As shown in Table 7, this second embodiment achieved accuracies of 99.69%, 99.65%, 97.73%, 98.74%, 99.83%, and 98.59% on the six cross-validation transfer diagnostic tasks, respectively. Similarly, using the same methods 1 and 2 as in Example 1, and comparing them with this method, Table 7 clearly shows the superior diagnostic performance of this method.

[0172] Table 7 Comparison of diagnostic accuracy in Example 2

[0173]

[0174] To further demonstrate the effectiveness of the improved supervised contrast loss proposed in this method, Example 2 investigates the impact of the balance parameter between global and local contrast loss on diagnostic performance. Figure 7 The accuracy trends of tasks B1 to B6 were revealed, and key conclusions can be drawn from the observations: (1) When α=0 (pure local contrast loss), the accuracy of all diagnostic tasks is the lowest, indicating that focusing only on intra-domain class alignment (local contrast loss) has limited effect on cross-domain transfer enhancement because there is a lack of sufficient global feature alignment; (2) As α increases, the diagnostic accuracy first rises to a certain level and then decreases, indicating that there may be a conflict between global contrast loss and local contrast loss; (3) When α=1 (pure global contrast loss), the diagnostic accuracy decreases slightly compared to the optimal setting, because overemphasizing domain-invariant features will mask discriminative local features in the data-scarce target domain, thus leading to the risk of overfitting; (4) When α=0.7, the diagnostic accuracy of most tasks is relatively high, indicating that there is a trade-off between global contrast loss and local contrast loss. There exists an optimal α value that can balance the conflict between global contrast loss and local contrast loss and, to a certain extent, jointly optimize the overall performance of the model.

[0175] Example 2 employs an optimized supervised contrastive loss function. This improved function combines a global contrastive loss (which guides clustering of samples of the same class under multiple operating conditions) and a local contrastive loss (which guides clustering of samples of the same class under a single operating condition). Experiments ultimately demonstrate that the improved supervised contrastive loss function is highly effective for diagnosing a small number of samples under unknown operating conditions.

[0176] The above description is only a preferred embodiment of the present disclosure. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present disclosure, and these improvements and modifications should also be considered within the protection scope of the present disclosure.

Claims

1. A method for few-sample bearing fault migration diagnosis based on multi-condition supervised contrastive learning, characterized in that, The method includes: Vibration signals of the bearing under at least two different operating conditions with a large amount of tag information are used as source domain data, and vibration signals under operating conditions with only a small amount of tag information that are different from the source domain data are used as target domain data. The tag information includes: fault information and operating condition information. Based on the pre-built initial contrastive learning training classification model, labeled source domain data and target domain data are input into the feature extractor to obtain feature representations; the feature representations are input into the classifier to obtain the predicted probability distribution of each fault category. Based on the global and local sample pair strategies pre-constructed for source and target domain data, positive and negative sample pairs are constructed based on feature representation, and the supervised contrast loss is calculated. The cross-entropy loss is calculated based on the predicted probability distribution of each fault category and the true label. The supervised contrast loss and the cross-entropy loss are then weighted and combined into a total loss function. Based on the combined total loss function, the model parameters are updated through an adaptive learning rate optimization algorithm and backpropagation to optimize the model, so that the loss value decreases to convergence, and a well-trained contrastive learning classification model is obtained. Input the unlabeled target domain data into the trained contrastive learning classification model to obtain the prediction results; The pre-constructed global and local sample pair strategies include: All fault samples of the same type under all operating conditions are treated as positive samples, and fault samples of different types under all operating conditions are treated as negative samples to construct global sample pairs; Treating similar fault samples within the same working condition as positive samples and all similar fault samples under other working conditions as negative samples, we construct local sample pairs. The total loss function includes: a supervised contrastive loss function and a cross-entropy loss function; wherein, the supervised contrastive loss function includes: a weighted combination of a global contrastive loss function and a local contrastive loss function; Global contrastive loss function: Based on global sample pairs, calculate the feature similarity of similar fault samples and the feature difference of dissimilar fault samples in all operating conditions; Local contrast loss function: Based on local sample pairs, calculate the feature similarity of similar fault samples within the same working condition and the feature difference of similar fault samples from other working conditions. The total loss function includes: supervised comparison loss function and cross-entropy loss function; L = λ · L con + σ · L cro ;in, L con This represents the supervised contrastive loss function. L cro Represents the cross-entropy loss function; The formula for the supervised contrastive loss function is: , in, L con The overall supervised contrastive loss function; w This indicates the number of operating conditions, which is the sum of the number of source domain operating conditions and the number of target domain operating conditions used. α This is a hyperparameter that determines the weights of the global contrast loss and the local contrast loss; L global For global contrastive loss function, L locak,k This is the local contrast loss function.

2. The method according to claim 1, characterized in that, From each operating condition data in the source domain data, 50% to 80% of the data is used as the training sample set, and the remainder is used as the test sample set. Each operating condition in the training sample includes all fault types. From each type of fault in the target domain data, K samples are randomly selected as training sample data, where K is any one of 0, 1, 2 or 4.

3. The method according to claim 2, characterized in that, After determining the training samples, the method further includes: The overlapping sliding window method is used to divide each continuous vibration signal in the training samples into multiple small segments to obtain a corresponding number of samples; A standardization formula was used to standardize each segment of the vibration signal data after segmentation, resulting in standardized sample data; the details are as follows: in, x This refers to the vibration signal data of each segment after division; μ This represents the average value of the current data segment. σ The standard deviation of the current data segment; z This is the standardized data.

4. The method according to claim 1, characterized in that, The global contrast loss function L global The formula is as follows: in, sim (z i ,z p ) indicates anchor point sample i eigenvector z i and samples p eigenvector z p Cosine similarity between them sim (z i ,z p )= z i z p / ||z i ||||z p || ; sim (z i ,z n ) indicates anchor point sample i eigenvector z i and samples n eigenvector z n Cosine similarity between them; Represents anchor point sample i eigenvector z i and samples eigenvectors The cosine similarity between them; τ represents the temperature parameter; Pos i It is a sample i The set of positive samples; Neg i It is a sample i The set of negative samples; N total This is the total number of samples; The local contrast loss function L local,k The formula is as follows: in, k Indicates any single working condition; N k Indicates working conditions k The total number of samples; P ( l ) represents a sample l The set of positive samples; all l Indicates sample l A set of samples of the same category across all operating conditions; sim (z l ,z p″ ) indicates anchor point sample l eigenvector z l and samples p″ eigenvector z p″ Cosine similarity between them; Represents anchor point sample l eigenvector z l and samples eigenvectors Cosine similarity between them; The cross-entropy loss function L cro The calculation formula is as follows: in, x i Indicates the sample being predicted. y i This represents the true label corresponding to the sample. p ( x i ) represents the probability distribution output by the classifier, which is the predicted probability distribution output by the contrastive learning training classification model.

5. The method according to any one of claims 1 to 4, characterized in that, The contrastive learning training classification model includes: a feature extractor consisting of a convolutional neural network (CNN) module and a bidirectional LSTM module that captures contextual information from time-series data, as well as a classifier based on a multilayer perceptron (MLP).

6. A few-sample bearing fault migration diagnosis system based on multi-condition supervised contrastive learning, characterized in that, The system includes: The data partitioning module is used to take the vibration signals of the bearing under at least two different operating conditions with a large amount of tag information as source domain data, and the vibration signals under operating conditions with only a small amount of tag information that are different from the source domain data as target domain data. The tag information includes: fault information and operating condition information. The probability prediction module is used to train a classification model based on a pre-built initial contrastive learning. Labeled source domain data and target domain data are input into the feature extractor to obtain feature representations. The feature representations are then input into the classifier to obtain the predicted probability distribution of each fault category. The loss function calculation module is used to construct positive and negative sample pairs based on feature representation according to the global sample pairs and local sample pairs pre-built for the source domain data and target data, calculate the supervised contrast loss, calculate the cross-entropy loss according to the predicted probability distribution of each fault category and the true label, and weight the supervised contrast loss and the cross-entropy loss to form the total loss function. The training module is used to optimize the model by updating the model parameters through an adaptive learning rate optimization algorithm and backpropagation based on the combined total loss function, so that the loss value decreases to convergence and a well-trained contrastive learning classification model is obtained. The diagnostic module is used to input unlabeled target domain data into a pre-trained contrastive learning classification model to obtain prediction results. The pre-constructed global and local sample pair strategies include: All fault samples of the same type under all operating conditions are treated as positive samples, and fault samples of different types under all operating conditions are treated as negative samples to construct global sample pairs; Treating similar fault samples within the same working condition as positive samples and all similar fault samples under other working conditions as negative samples, we construct local sample pairs. The total loss function includes: a supervised contrastive loss function and a cross-entropy loss function; wherein, the supervised contrastive loss function includes: a weighted combination of a global contrastive loss function and a local contrastive loss function; Global contrastive loss function: Based on global sample pairs, calculate the feature similarity of similar fault samples and the feature difference of dissimilar fault samples in all operating conditions; Local contrast loss function: Based on local sample pairs, calculate the feature similarity of similar fault samples within the same working condition and the feature difference of similar fault samples from other working conditions. The total loss function includes: supervised comparison loss function and cross-entropy loss function; L = λ · L con + σ · L cro ;in, L con This represents the supervised contrastive loss function. L cro Represents the cross-entropy loss function; The formula for the supervised contrastive loss function is: , in, L con The overall supervised contrastive loss function; w This indicates the number of operating conditions, which is the sum of the number of source domain operating conditions and the number of target domain operating conditions used. α This is a hyperparameter that determines the weights of the global contrast loss and the local contrast loss; L global For global contrastive loss function, L locak,k This is the local contrast loss function.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Bearing fault diagnosis method based on contrast representation learning and subdomain self-adaption

    CN118152920A

  • Small sample SAR target identification method based on supervised comparative learning

    CN119229257A