A small sample cross-domain fault diagnosis method based on multi-level feature alignment
By constructing a multi-level feature-aligned small-sample cross-domain fault diagnosis method, using a diffusion model to generate high-quality target domain feature samples and combining them with a multi-level loss function, the problem of insufficient fault diagnosis accuracy and generalization ability of rotating machinery under small sample conditions is solved, and efficient diagnosis under complex working conditions is achieved.
Patent Information
- Application Number
- CN202510627892.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-05-15
AI Technical Summary
Existing cross-domain fault diagnosis methods struggle to achieve effective feature alignment and discrimination under small sample conditions, resulting in insufficient diagnostic accuracy and generalization ability of the models in complex industrial environments. This is particularly true in rotating machinery, especially in the fault diagnosis of core components such as bearings and gears, where negative transfer and overfitting issues exist.
A small-sample cross-domain fault diagnosis method based on multi-level feature alignment is adopted. By constructing a diffusion model that combines multi-head self-attention mechanism and normalization strategy, enhanced samples of target domain feature distribution are generated. A joint loss function is designed, including source domain classification loss, double MMD distribution alignment loss, cross-domain triplet loss and consistency regularization term, to achieve fault feature transfer and accurate diagnosis.
It significantly improves the fault diagnosis accuracy and cross-domain adaptability of rotating machinery under small sample conditions, overcomes the transfer performance bottleneck caused by the scarcity of samples in the target domain, and improves the diagnostic performance under complex working conditions.
Smart Images

Figure CN120611234B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of small sample cross-domain fault diagnosis, in particular, especially relates to a small sample cross-domain fault diagnosis method based on multi-level feature alignment. BACKGROUND
[0002] Rotating machinery is widely used in important industrial scenarios such as energy, power and manufacturing. Once the core components (such as bearings and gears) of the rotating machinery fail, it is easy to cause unplanned shutdown of the equipment, resulting in significant economic losses and safety hazards. Therefore, intelligent fault diagnosis technology is given an important mission in the health management of industrial systems.
[0003] In recent years, deep learning-based fault recognition methods have made significant progress, especially under the condition of sufficient large-scale labeled data, and have shown good diagnostic accuracy. However, in actual industrial environments, due to factors such as varying operating conditions of equipment, limited sensor layout, and high labeling costs, there is often a situation where the number of samples in the target domain (i.e., the scene to be diagnosed) is extremely scarce. In addition, there are obvious distribution differences between signal features of different equipment, operating conditions or measuring points, which makes the direct diagnosis of the model less effective and seriously restricts the promotion and application of deep diagnosis models in cross-equipment, cross-condition and other actual scenarios.
[0004] To overcome the above challenges, in recent years, scholars have proposed a variety of cross-domain fault diagnosis methods based on transfer learning, but there are still the following technical bottlenecks:
[0005] First, existing methods mostly rely on adversarial training (such as domain discriminators) or statistical distribution alignment strategies (such as maximum mean difference MMD) to reduce the feature distribution difference between the source domain and the target domain. Although this achieves consistency of features between domains to some extent, it usually only focuses on alignment at the overall distribution level, ignores modeling and utilization of class structure information, and cannot guarantee close aggregation between samples of the same class and sufficient separation between samples of different classes after cross-domain. This kind of alignment with fuzzy inter-class boundaries is easy to cause negative transfer problems, especially in complex diagnosis tasks with many fault types and large differences between samples, which cannot effectively distinguish fine-grained fault states, seriously restricting the diagnostic accuracy and generalization ability of the model.
[0006] Secondly, under the condition of extreme scarcity of target domain data, existing methods often use direct transfer or pseudo-label guidance to assist model learning of target domain features. However, due to the limited number of target samples, the accuracy of pseudo-labels is limited, and the model is prone to fall into an error supervision cycle during training. At the same time, the feature extraction network is prone to overfitting, resulting in the extracted target domain features lacking discriminability, which ultimately leads to degradation of diagnostic performance. In addition, the lack of effective feature enhancement mechanism for small sample scenarios also makes it difficult for existing methods to fully exploit the potential structural information in limited data, resulting in insufficient stability and reliability in actual industrial deployment.
[0007] Therefore, it is urgent to propose a new cross-domain diagnosis method with multi-level feature alignment capability, which can realize precise transfer of diagnostic knowledge from the source domain to the target domain under the condition of small samples, thereby improving the adaptability and diagnostic performance of the model in complex open environments. SUMMARY
[0008] According to the above technical problems, a small sample cross-domain fault diagnosis method based on multi-level feature alignment is provided. The present application can effectively transfer the diagnostic knowledge of the source domain under the condition of scarcity of target domain data, enhance the discriminability of fault features and the cross-domain adaptability of the model, and is suitable for intelligent diagnosis tasks of rotating machinery under complex working conditions.
[0009] The technical means adopted by the present application are as follows:
[0010] A small sample cross-domain fault diagnosis method based on multi-level feature alignment, comprising:
[0011] S1, collecting rotating machinery monitoring data under the source domain and the target domain, and constructing a cross-domain small sample fault diagnosis task dataset with scarce target domain samples;
[0012] S2, constructing a diffusion model combining multi-head self-attention mechanism and normalization strategy to generate enhanced samples with target domain feature distribution;
[0013] S3, building a shared feature extraction network that integrates source domain, target domain and generated samples to realize unified modeling of diagnostic features;
[0014] S4, designing a joint loss function including source domain classification loss, double MMD distribution alignment loss, cross-domain triplet loss and enhanced consistency regularization term, constructing a multi-level feature alignment mechanism to realize fault feature transfer and accurate diagnosis under the condition of small samples in the target domain.
[0015] Further, step S1 specifically comprises:
[0016] S11, collecting monitoring signals of the source domain and the target domain on a rotating machinery platform as original signals, wherein the monitoring signals of the source domain are labeled data The monitoring signal of the target domain is unlabeled data The target domain unlabeled data obtained is extremely small
[0017] S12, normalize the collected original signal, scale the original signal to the interval [0, 1], and the formula for normalization processing is as follows:
[0018]
[0019] wherein, denotes the normalized signal, denotes the original signal point, denotes the minimum value of the original signal, denotes the maximum value of the original signal; in this embodiment, the collected original signal is normalized to eliminate the influence of signal amplitude difference under different working conditions on training and improve the convergence stability of the model.
[0020] S13, use a sliding window algorithm to segment the original long time series, each segment containing 2048 sampling points, and construct a standard input sample format.
[0021] Further, in step S2, an improved U-Net is used to build a diffusion model to enhance data samples and generate high-quality signal samples , including a forward process, a reverse process and noise prediction.
[0022] Further, in the forward process, a data sample is gradually added with noise until it approaches a Gaussian distribution, specifically including:
[0023] Set the data as , and generate a series of samples by a Markov chain with multiple time steps is Gaussian distributed noise, and the mathematical expression of this process is as follows:
[0024]
[0025]
[0026] wherein, denotes the joint probability distribution of generating a series of intermediate samples under the condition of a given initial sample , denotes a series of intermediate samples, denotes the probability distribution of generating under the given condition, denotes the time step t -1 sample, denotes an hyper-parameter representing the amplitude of added noise, denotes the total number of diffusion steps, this process gradually adds noise to the original data to a set of pure noise, and , denotes the added noise is getting bigger and bigger, denotes a matrix with the same shape as the input data.
[0027] Further, in the reverse process, the true distribution of the data is gradually recovered by denoising, and a neural network with parameters is used to estimate the conditional probability, and the calculation formula is as follows:
[0028]
[0029] wherein, denotes the learnable parameters of the neural network, and denote the mean and variance; denotes the amount estimated by the model for denoising according to the current noisy sample t at time step , , denotes the scaling factor, denotes the sample at the previous moment, , denotes the noise at the t time step obtained according to the prediction.
[0030] Further, in the noise prediction, an improved Unet network architecture is used to predict the noise distribution in the reverse process, which specifically includes:
[0031] A multi-head attention mechanism is introduced in the encoder and decoder, so that the model can capture long-distance dependencies in the signal. The multi-head attention mechanism module includes one-dimensional convolution, batch normalization and multi-head attention mechanism, and the mathematical formula is as follows:
[0032]
[0033]
[0034]
[0035] wherein, denotes the query matrix of the j th attention head, denotes the original signal point, denotes the key matrix of the j th attention head, denotes the value matrix of the j th attention head, and denotes a trainable projection matrix, denotes an attention mechanism, denotes the transpose of the key matrix of the j th attention head, denotes the dimension of the key vector, denotes a multi-head attention mechanism, denotes the output of the j th attention head, , H denotes the number of attention heads, denotes a trainable projection matrix.
[0036] Further, the diffusion model needs to constrain the noise prediction network based on U-Net during training, and calculate the loss value between the predicted noise and the actual noise, and the calculation formula is as follows:
[0037]
[0038] wherein, denotes an expectation operation, denotes the real noise added to the data at time step t , denotes the cumulative noise coefficient at time step t .
[0039] Further, step S3 specifically comprises:
[0040] S31, a shared parameter feature extraction network containing three types of inputs of source domain samples, target domain samples and target domain generated samples is constructed, and the network structure contains multiple convolution layers, pooling layers and normalization layers, and finally maps to the fault category space;
[0041] S32, after the feature extraction of all samples, the samples are sent into the classifier, and the output prediction result is used for subsequent calculation of the joint loss function.
[0042] Further, step S4 specifically comprises:
[0043] S41, in order to ensure that the model accurately identifies the class features in the source domain labeled samples and learns the fault difference features in the original data, a cross-entropy classification loss function is introduced, and the mathematical formula is as follows:
[0044]
[0045] wherein, denotes the number of samples of the source domain, denotes the i th source domain sample, denotes the label of , denotes The true label;
[0046] S42. To improve the model's sensitivity and adaptability to cross-domain distribution changes, this invention extends the traditional MMD alignment strategy to a dual alignment objective: on the one hand, aligning the overall feature distribution between source domain samples and true target domain samples; on the other hand, aligning the distribution between source domain samples and target samples generated by the diffusion model, ensuring that the generated data truly reflects the characteristics of the target domain. The specific mathematical expression is as follows:
[0047]
[0048] in, This means mapping the input features to the Reproducing Kernel Hilbert Space (RKHS). Represents source domain samples, Represents the target domain sample. This indicates that samples are generated from the target domain. Indicates the number of samples in the source domain. Indicates the number of samples in the target domain. Indicates the number of target domain samples generated;
[0049] S43. To enhance the intra-class compactness and inter-class separability of cross-domain samples in the feature space, a cross-domain triplet loss function is designed, with the following mathematical expression:
[0050]
[0051] Among them, anchor point samples Positive samples With negative samples Samples from the source domain or target domain sample Positive samples and anchor samples belong to the same category, while negative samples come from different categories. (Function) This represents the feature extraction representation of the sample. The feature representation of the anchor point, The feature representation of positive samples, The feature representation of negative samples, This represents the boundary margin hyperparameter, used to control the minimum discrimination between positive and negative samples;
[0052] S44. To further improve the robustness of the model, this invention introduces a consistency regularization loss mechanism to constrain the predictive consistency between the original samples and their enhanced samples in the target domain in the feature extraction results. The expression of the consistency regularization loss function is as follows:
[0053]
[0054] in, representing the target domain original sample representing the enhanced sample of the target domain original sample;
[0055] S45、In the present application, the cross-domain triple loss and the consistency regularization loss both involve pseudo-label prediction on the target domain samples. Although such pseudo-labels have a positive effect on improving the model's discriminative ability and generalization performance in the later training period, in the early training period, since the model has not yet converged, the generated pseudo-labels often have large errors, and if directly involved in loss optimization, it may lead to unstable training or even negative transfer phenomenon, thereby weakening the effect of triple loss and consistency loss. Therefore, the present application introduces a dynamic weight adjustment parameter in the optimization process, which is used to gradually control the influence of pseudo-label samples on the corresponding loss term, and the adjustment function of the parameter is defined as follows:
[0056]
[0057] wherein, represents the current training epoch, represents the total training epoch, represents a growth rate control factor, which is 10;
[0058] S46、The cross-domain diagnostic network realizes efficient feature alignment and discriminative performance improvement under the condition of limited target domain data through the combination optimization of multiple loss functions, and the overall loss function expression is as follows:
[0059]
[0060] wherein, and respectively represent the weight adjustment parameters of the MMD loss term and the combination term of triple loss and consistency regularization loss, represents a cross-entropy classification loss function, represents a double alignment target loss function, represents a cross-domain triple loss function, represents a consistency regularization loss function.
[0061] Compared with the prior art, the present application has the following advantages:
[0062] The small sample cross-domain fault diagnosis method based on multi-level feature alignment provided by the present application has a significant performance advantage in the bearing working condition cross-domain task, and is significantly better than the traditional non-enhanced or GAN enhanced method, effectively overcoming the transfer performance bottleneck caused by the scarcity of target domain samples, and has good industrial application potential.
[0063] Based on the above reasons, the present application can be widely popularized in the field of small sample cross-domain fault diagnosis. Attached Figure Description
[0064] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0065] Figure 1 This is a flowchart of the method of the present invention.
[0066] Figure 2 This is a schematic diagram illustrating the division of the source and target domain measurement point datasets in this invention.
[0067] Figure 3 This is a schematic diagram of the diffusion model process of the present invention.
[0068] Figure 4 This is a network diagram of the multi-head attention mechanism of the present invention.
[0069] Figure 5 This is a diagram showing the overall structure of the fault diagnosis network of the present invention.
[0070] Figure 6 This is a physical image of the data acquisition device of the present invention.
[0071] Figure 7 This is a time-frequency diagram of the generated signal and experimental signal of the bearing inner ring fault of the present invention.
[0072] Figure 8 This is a fault diagnosis confusion matrix diagram for the present invention. Detailed Implementation
[0073] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0074] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products or devices.
[0075] As Figure 1 shown, the application provides a small sample cross-domain fault diagnosis method based on multi-level feature alignment, comprising:
[0076] S1, collecting rotating machinery monitoring data under the source domain and the target domain, and constructing a cross-domain small sample fault diagnosis task dataset with scarce target domain samples;
[0077] S2, constructing a diffusion model combining multi-head self-attention mechanism and normalization strategy to generate enhanced samples with target domain feature distribution;
[0078] S3, building a shared feature extraction network that integrates source domain, target domain and generated samples, and realizing unified modeling of diagnostic features;
[0079] S4, designing a joint loss function including source domain classification loss, double MMD distribution alignment loss, cross-domain triple loss and enhanced consistency regularization term, constructing a multi-level feature alignment mechanism, and realizing fault feature transfer and accurate diagnosis under the condition of target domain small samples.
[0080] In specific implementation, as a preferred embodiment of the application, step S1 specifically comprises:
[0081] S11, collecting monitoring signals of the source domain (such as working condition A) and the target domain (such as working condition B) on the rotating machinery platform as original signals, wherein the monitoring signals of the source domain are labeled data , the monitoring signals of the target domain are unlabeled data , and the obtained target domain unlabeled data is a very small amount;
[0082] S12, normalizing the collected original signals to scale the original signals to the interval [0, 1], and the formula for normalization processing is as follows:
[0083]
[0084] Wherein, denotes the normalized signal, denotes the original signal point, denotes the minimum value of the original signal, denotes the maximum value of the original signal; in this embodiment, the collected original signals are normalized to eliminate the influence of signal amplitude difference under different working conditions on training and improve the convergence stability of the model.
[0085] S13, as Figure 2 shown, the original long time series is segmented using a sliding window algorithm, each segment contains 2048 sampling points, and a standard input sample format is constructed.
[0086] In specific implementation, as a preferred embodiment of the present application, in step S2, the diffusion model is constructed based on the improved U-Net to enhance the data samples and generate high-quality signal samples As shown in Figure 3 , it includes a forward process, a reverse process and noise prediction.
[0087] In specific implementation, as a preferred embodiment of the present application, in the forward process, noise is gradually added to one data sample until it approaches a Gaussian distribution, which specifically includes:
[0088] The data is set as , and the noise process generates a series of samples , by a Markov chain of multiple time steps.
[0089]
[0090]
[0091] wherein, denotes the joint probability distribution of generating a series of intermediate samples under the condition of a given initial sample , denotes the series of intermediate samples, denotes the probability distribution of generating under the given condition, denotes the sample at time step t -1, denotes a hyperparameter representing the amplitude of added noise, denotes the total number of diffusion steps, and this process gradually adds noise to a set of pure noise from the original data, and , indicates that the added noise is getting larger and larger, denotes a matrix with the same shape as the input data.
[0092] In specific implementation, as a preferred embodiment of the present application, in the reverse process, the true distribution of the data is gradually restored by denoising, and a neural network with parameters is used to estimate the conditional probability, and the calculation formula is as follows:
[0093]
[0094] wherein, denotes the learnable parameters of the neural network, and the Unet model is currently commonly used to estimate the original noise distribution. and denote the mean and variance; denotes the time step .t At that time, the model is based on the current noisy samples. The estimated amount used for noise reduction, , Indicates the scaling factor. This represents the sample from the previous time step. , Indicates the result obtained from the prediction t Noise in the time step.
[0095] In a specific implementation, as a preferred embodiment of the present invention, the noise prediction uses an improved Unet network architecture to predict the noise distribution during the reverse process, specifically including:
[0096] Introducing multi-head attention mechanisms into the encoder and decoder enables the model to capture long-range dependencies in the signal, such as... Figure 4 As shown, the multi-head attention mechanism module includes one-dimensional convolution, batch normalization, and multi-head attention mechanism, and the mathematical formula is as follows:
[0097]
[0098]
[0099]
[0100] in, Indicates the first j A query matrix with attention heads Represents the original signal point. Indicates the first j The key matrix of each attention head. Indicates the first j The value matrix of each attention head, and This represents a trainable projection matrix. This represents the attention mechanism. Indicates the first j Transpose of the key matrix of each attention head The dimension of the key vector. This indicates a multi-head attention mechanism. Indicates the first j The output of each attention head, , H Indicates the number of attention heads. This represents a trainable projection matrix.
[0101] In a specific implementation, as a preferred embodiment of the present invention, the diffusion model training process requires constraining a noise prediction network based on U-Net, calculating the loss value between the predicted noise and the actual noise, using the following formula:
[0102]
[0103] wherein, denotes the desired operation, denotes the real noise added to the data at time step t denotes the cumulative noise coefficient at time step t
[0104] In particular implementation, as a preferred embodiment of the present application, step S3 specifically comprises:
[0105] S31, a shared parameter feature extraction network containing three types of inputs of source domain samples, target domain samples and target domain generated samples is constructed, the network structure contains multiple convolution layers, pooling layers and normalization layers, and finally maps to the fault category space;
[0106] S32, after feature extraction, all samples are sent into the classifier, and the output prediction result is used for subsequent joint loss function calculation. As shown in Figure 5 , the overall structure of the fault diagnosis network is trained by the three types of data together, and the generalization learning of the fault model to the small sample target domain fault mode is realized.
[0107] In particular implementation, as a preferred embodiment of the present application, step S4 specifically comprises:
[0108] S41, in order to ensure that the model accurately identifies the class features in the source domain labeled samples and learns the fault difference features in the original data, a cross-entropy classification loss function is introduced, and the mathematical formula is as follows:
[0109]
[0110] wherein, denotes the number of samples of the source domain, denotes the i-th source domain sample, i denotes the label of denotes the true label of
[0111] S42, in order to improve the sensitivity and adaptability of the model to the cross-domain distribution change, the present application extends the traditional MMD alignment strategy to a double alignment target: on the one hand, the overall feature distribution between the source domain samples and the real target domain samples is aligned; on the other hand, the distribution between the source domain samples and the target samples generated by the diffusion model is aligned, so as to ensure that the generated data can truly reflect the characteristics of the target domain, and the specific mathematical expression is:
[0112]
[0113] wherein, denotes mapping input features into a reproducing kernel Hilbert space (RKHS), denotes source domain samples, denotes target domain samples, denotes generated target domain samples, denotes the number of source domain samples, denotes the number of target domain samples, denotes the number of generated target domain samples.
[0114] In the embodiment, the MMD is a non-parametric non-adversarial alignment method, has the advantages of stable training and easy implementation, and is especially suitable for feature migration in a small sample target domain scene. Jointly minimizing the two MMD loss terms helps to achieve global alignment between the source domain and the real target domain samples and the generated target domain samples, thereby promoting more effective domain adaptation.
[0115] S43, in order to enhance the intra-class compactness and inter-class separability of the cross-domain samples in the feature space, a cross-domain triplet loss function is designed, and the mathematical expression is as follows:
[0116]
[0117] wherein, the anchor sample , the positive sample and the negative sample come from the source domain sample or the target domain sample , the positive sample and the anchor sample belong to the same class, the negative sample comes from different classes, and the function denotes the feature extraction representation of the sample, denotes the feature representation of the anchor, denotes the feature representation of the positive sample, denotes the feature representation of the negative sample, denotes the boundary interval hyperparameter, which is used to control the minimum separation degree between the positive sample and the negative sample; in the embodiment, the loss function optimizes the discriminative ability of the feature embedding space by minimizing the distance between the samples of the same class (the anchor sample and the positive sample) and simultaneously expanding the interval between the samples of different classes (the anchor sample and the negative sample).
[0118] S44, in order to further improve the robustness of the model, the present application introduces a consistency regularization loss mechanism, which is used to constrain the prediction consistency of the feature extraction results of the target domain original sample and its enhanced sample, and the expression of the consistency regularization loss function is as follows:
[0119]
[0120] wherein, represents an enhanced sample of the target domain original sample; In this embodiment, the core idea of this loss term is that the model should maintain the consistency of the feature output when facing the same target sample in different forms via different data enhancement or disturbance, thereby enhancing the stability of the input disturbance and significantly improving the generalization ability under the condition of small sample of the target domain. Specifically, by performing the enhancement operation of the diffusion model on the target domain sample, the transformed form is constructed, and the original sample is compared in the feature space, and the output distance is constrained to be minimum. This strategy not only effectively suppresses the overfitting problem caused by the scarcity of target domain data, but also enhances the robustness of the model when facing the input fluctuation in the actual complex working condition.
[0121] S45, in the present application, the cross-domain triple loss and the consistency regularization loss both involve pseudo-label prediction of the target domain sample. Although such pseudo-labels have a positive effect on improving the discriminative ability and generalization performance of the model in the later training period, in the early training period, since the model has not yet converged, the generated pseudo-labels often have large errors, and if directly involved in loss optimization, it may lead to unstable training or even negative transfer phenomenon, thereby weakening the effect of the triple loss and the consistency loss. Therefore, the present application introduces a dynamic weight adjustment parameter in the optimization process, which is used to gradually control the influence of the pseudo-label sample on the corresponding loss term, and the adjustment function of the parameter is defined as follows:
[0122]
[0123] wherein, represents the current training epoch, represents the total training epoch, represents a growth rate control factor, which is 10; in this embodiment, the parameter is set to 0 in the early training period, and as the model performance improves, the value gradually increases to 1, thereby gradually guiding the model to use the pseudo-label information for training, enhancing the robustness and training effect.
[0124] S46, the cross-domain diagnosis network realizes efficient feature alignment and discriminative performance improvement under the condition of limited target domain data through the combination optimization of multiple loss functions, and the overall loss function expression is as follows:
[0125]
[0126] wherein, and respectively represent the weight adjustment parameters of the MMD loss term and the combination term of the triple loss and the consistency regularization loss, represents a cross-entropy classification loss function, represents a dual alignment target loss function, represents a cross-domain triple loss function, represents a consistency regularization loss function. In the embodiment, by dynamically jointly optimizing the above loss functions, the application realizes efficient alignment of multi-level features among the source domain, the real target domain and the generated target domain samples, and provides strong support for small sample intelligent fault diagnosis under complex working conditions.
[0127] Embodiment
[0128] The data set used by the application is derived from a rolling bearing fault test platform, the structure of which is shown in Figure 6 . The test platform contains two rolling bearings, of which the right bearing is the measured bearing. Vibration signal acquisition is carried out through an acceleration sensor installed on the bearing seat shell, and the sampling frequency is 20 kHz. In order to construct various typical fault working conditions, various types of faults are introduced into the bearing in an artificial manner, including rolling element fault (BF), inner ring fault (IF), outer ring fault (OF), composite fault (OF-BF) and healthy state (H). The above faults are applied to the test bearing by precision machining to ensure the consistency and repeatability of the experiment. In addition, in order to simulate the difference between domains, the test platform is set to two different speed conditions: 1200 and 1800 , respectively, representing two independent working condition domains. The vibration signals collected based on these conditions constitute the data samples of the source domain and the target domain, which are used for subsequent verification and performance evaluation of the small sample cross-domain fault diagnosis method.
[0129] In order to fully verify the effectiveness and generalization ability of the small sample cross-domain fault diagnosis method proposed by the application, the embodiment designs two cross-domain fault diagnosis tasks based on the rolling bearing data set and . In task , the bearing data with a speed of 1800 is selected as the source domain, and the bearing data with a speed of 1200 is selected as the target domain; in task , the source domain and the target domain are set in reverse, i.e. the source domain is 1200 , and the target domain is 1800 . In each of the above tasks, 300 labeled samples are selected for each health state in the source domain, and only 20 unlabeled samples are initially included for each state in the target domain, simulating the cross-domain fault diagnosis scene in reality where data is scarce. In order to alleviate the problem of scarcity of target domain samples, a diffusion model is used to enhance the data of the target domain samples, so that 280 enhanced samples are generated for each fault state, further supporting the feature alignment and model optimization process.
[0130] The cross-domain fault diagnosis method proposed in the application adopts a time domain vibration signal with an input dimension of 1*2048. The feature extraction network is composed of 5 convolutional layers and 1 fully connected layer, and the output channel numbers of each convolutional layer are 4, 8, 16, 32 and 64 in turn, all of which contain convolution, batch normalization, LeakyReLU activation and max pooling operation. The output dimension of the fully connected layer is consistent with the number of fault categories, and the dropout ratio is set to 0.1. The optimizer adopts SGD, the initial learning rate is 0.01, it is attenuated to half of the original value every 50 rounds, the total training rounds are 200, and the batch size is set to 32. In order to reduce the influence of randomness, all experiments are repeated 6 times and the average results are taken. The hyperparameters are set to 0.5. In order to verify the effectiveness of the method, three kinds of comparison methods are designed:
[0131] (1) Non-DA, that is, without introducing any domain adaptation mechanism, only relying on source domain classification training;
[0132] (2) Non-AU, that is, without using generated samples, only using a small amount of target domain samples and MMD loss for alignment;
[0133] (3) DA-GAN, that is, using a generative adversarial network (GAN) to generate target domain samples, compared with the diffusion model used in the application.
[0134] The above comparison methods all adopt the same network structure and parameter settings to ensure the fairness of the experiment. Figure 7 The generated signal and the experimental signal time-frequency graph of the bearing inner ring fault are compared. It can be seen that in the time-frequency graph after Fourier transform, the frequency spectrum of the generated signal is consistent with the real signal, especially in the amplitude and phase matching of the key frequency components. Especially in the case of ball fault, the frequency components of the generated signal are almost the same as the real signal. The low frequency characteristics of the fault signals generated by the inner ring and the outer ring can be well matched. The signals generated by the diffusion model not only reconstruct the dynamic characteristics of the real signals, but also accurately retain their frequency information. This verifies the effectiveness of the DDPM proposed in this paper and proves its ability to provide high-quality data for fault diagnosis in small sample scenarios.
[0135] To quantitatively compare the differences between the signals generated by different models and the real signals, the root mean square error (RMSE) and the frequency spectrum cosine similarity (FSCS) are introduced as evaluation indicators. Table 1 shows the evaluation results of the generated signals by different models. It can be observed that the proposed model achieves the best performance in all types of faults. Among the five fault types, the proposed model achieves an average RMSE of 0.054, which is 0.01 lower than the original DDPM. The average PSNR is 25.67, which is 1.127 higher than the original DDPM. The signal quality generated by the DA-GAN model is significantly lower than that of DDPM, with an average RMSE and PSNR value of only 0.121 and 13.562, respectively. This is mainly because DA-GAN lacks the iterative denoising process and probability modeling capability provided by the diffusion-based framework, which limits its ability to capture complex signal distributions and effectively suppress noise. In summary, the proposed improved DDPM model demonstrates excellent feature modeling and denoising capabilities, thereby improving the reconstruction quality and robustness of various fault types.
[0136] Table 1 Comparison of signals generated by different models
[0137]
[0138] Small sample cross-domain fault diagnosis analysis:
[0139] Different comparison methods are used to test the fault diagnosis performance in these two tasks, and the statistical results are shown in Table 2. In task , the average diagnosis accuracy of the Non-DA method without introducing any domain adaptation mechanism is 72.12%, while the accuracy of the Non-AU method without using data augmentation but using MMD alignment strategy is improved to 82.86%. Further, the DA-GAN method using generative adversarial network (GAN) for data augmentation has an accuracy of 89.25%. In contrast, the diffusion model assisted method proposed in the present application performs best in task, with an accuracy of 93.83%. In task In the results, the various methods showed similar trends. The accuracy of the Non-DA method was 64.89%, the Non-AU method was 75.24%, the DA-GAN method was 83.56%, while the method of this invention achieved the highest accuracy of 90.07%. These results indicate that models trained solely on the source domain exhibit significantly reduced diagnostic performance when diagnosing the target domain under different rotational speeds. While appropriately introducing target domain data (such as Non-AU and DA-GAN) can improve performance, it is still limited by the number of samples and the quality of the generated data. In contrast, this invention generates enhanced target domain samples with realism and diversity by constructing a diffusion model, and combines multi-level feature alignment strategies such as source domain classification loss, dual MMD alignment loss, cross-domain triplet loss, and consistency regularization loss to significantly improve cross-domain generalization ability and achieve higher-precision fault identification.
[0140] Table 2. Statistics of Fault Diagnosis Results
[0141]
[0142] Furthermore, to further illustrate the diagnostic effectiveness of the method of the present invention under various fault conditions, [the following was selected] Visualize and analyze the confusion matrix of all methods under the task, such as... Figure 8 As shown in the figure. The results show that the Non-DA and Non-AU methods have low identification accuracy under rolling element failure (BF) and normal conditions (N), while the method of the present invention achieves relatively balanced and accurate diagnostic results under all failure types, further verifying the stability and generalization ability of the proposed method under small sample conditions.
[0143] In summary, the small-sample cross-domain fault diagnosis method based on diffusion model and multi-level feature alignment proposed in this invention shows significant performance advantages in cross-domain tasks of bearing operating conditions, significantly outperforming traditional methods without enhancement or GAN enhancement. It effectively overcomes the transfer performance bottleneck caused by the scarcity of target domain samples and has good potential for industrial applications.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A small sample cross-domain fault diagnosis method based on multi-level feature alignment, characterized in that, The application comprises the following steps: S1, collecting rotating machinery monitoring data under the source domain and the target domain, and constructing a cross-domain small sample fault diagnosis task dataset with a scarce target domain sample; S2, constructing a diffusion model combining a multi-head self-attention mechanism and a normalization strategy to generate enhanced samples with target domain feature distribution; wherein the diffusion model is constructed based on an improved U-Net, and the diffusion model comprises a forward process, a reverse process and noise prediction; in the noise prediction, an improved U-Net network architecture is used to predict the noise distribution in the reverse process, comprising: In the encoder and decoder, a multi-head attention mechanism is introduced to enable the model to capture long-distance dependencies in the signal, and the multi-head attention mechanism module comprises one-dimensional convolution, batch normalization and multi-head attention mechanism; S3, building a shared feature extraction network that integrates the source domain, the target domain and the generated target domain samples to realize unified modeling of diagnostic features; S4, designing a joint loss function, including a source domain classification loss, a double MMD distribution alignment loss, a cross-domain triplet loss and an enhanced consistency regularization term, constructing a multi-level feature alignment mechanism to realize fault feature transfer and accurate diagnosis under the condition of a small sample of the target domain, specifically comprising: S41, in order to ensure that the model accurately identifies the class features in the source domain labeled samples and learns the fault difference features in the original data, a cross-entropy classification loss function is introduced; S42, on the basis of the MMD alignment strategy, it is extended to a double alignment target: on the one hand, aligning the overall feature distribution between the source domain samples and the real target domain samples; on the other hand, aligning the distribution between the source domain samples and the target samples generated by the diffusion model, to ensure that the generated data can truly reflect the characteristics of the target domain, and the specific mathematical expression is: wherein, represents mapping input features into a reproducing kernel Hilbert space, represents source domain samples, represents target domain samples, represents generated target domain samples, represents the number of source domain samples, represents the number of target domain samples, represents the number of generated target domain samples; S43, in order to enhance the intra-class compactness and inter-class separability of the cross-domain samples in the feature space, a cross-domain triplet loss function is designed, and the mathematical expression is as follows: wherein the anchor sample , the positive sample and the negative sample are from the source domain sample or the target domain sample , the positive sample belongs to the same class as the anchor sample, and the negative sample is from a different class, the function represents the feature extraction representation of the sample, represents the feature representation of the anchor, represents the feature representation of the positive sample, represents the feature representation of the negative sample, represents the margin hyperparameter, used to control the minimum degree of differentiation between the positive and negative samples; S44, a consistency regularization loss mechanism is introduced to constrain the prediction consistency of the original target domain samples and their enhanced samples in the feature extraction results, and the expression of the consistency regularization loss function is as follows: wherein, represents an enhanced sample of a target domain raw sample ; S45, introducing a dynamic weight adjustment parameter in the optimization process , for gradually controlling the influence of the pseudo-label sample corresponding loss term, the adjustment function of the parameter is defined as follows: wherein, denotes the current training round, denotes the total training rounds, denotes the growth rate control factor, which takes the value 10; S46, the cross-domain diagnosis network realizes efficient feature alignment and discriminant performance improvement under the condition of limited target domain data through the combination optimization of multiple loss functions, and the overall loss function expression is as follows: wherein, denotes a weight adjustment parameter for the MMD loss term, denotes a weight adjustment parameter for the combined term of the triplet loss and the consistency regularization loss, denotes a cross-entropy classification loss function, denotes a dual alignment target loss function, denotes a cross-domain triplet loss function, denotes a consistency regularization loss function.
2. The small sample cross-domain fault diagnosis method based on multi-level feature alignment according to claim 1, characterized in that, Step S1, specifically comprising: S11, collecting the monitoring signals of the source domain and the target domain on the rotating machinery platform as the original signals, wherein the monitoring signals of the source domain are labeled data, and the monitoring signals of the target domain are unlabeled data; S12, normalizing the collected original signals to scale the original signals to the [0, 1] interval, and the formula of the normalization processing is as follows: wherein denotes the normalized signal, denotes the original signal point, denotes the minimum value of the original signal, denotes the maximum value of the original signal; S13, using a sliding window algorithm to segment the original long time series, each segment containing 2048 sampling points, and constructing a standard input sample format.
3. The small sample cross-domain fault diagnosis method based on multi-level feature alignment according to claim 1, characterized in that, In the forward process, a data sample is gradually added with noise until it approaches a Gaussian distribution, specifically comprising: The initial samples are set as A series of samples are generated by a Markov chain over multiple time steps , is a Gaussian distributed noise, the mathematical expression of this process is as follows: in, Indicates a given initial sample Under these conditions, a series of intermediate samples are generated. The joint probability distribution, This represents a series of intermediate samples. Indicates in the given Under the conditions, generate The probability distribution, Indicates the time step as t -1 samples, This represents a hyperparameter, indicating the magnitude of the added noise. This represents the total number of diffusion steps, a process that progressively adds noise to the original data until it becomes a set of pure noise. This indicates that the added noise is getting bigger and bigger. This represents a matrix with the same shape as the input data.
4. The small sample cross-domain fault diagnosis method based on multi-level feature alignment according to claim 3, characterized in that, In the reverse process, the true distribution of the data is gradually restored by denoising, and a neural network with parameters is used to estimate the conditional probability, and the calculation formula is as follows: wherein, denote learnable parameters of the neural network, and denote mean and variance; denotes the estimate of the quantity t for denoising by the model at time step t according to the current noisy sample , denotes a scaling factor, denotes the sample at the previous time instant, , denotes the noise at time step t according to the prediction.
5. The small sample cross-domain fault diagnosis method based on multi-level feature alignment according to claim 4, characterized in that, The constraint in the diffusion model training process is a noise prediction network based on U-Net, and the loss value between the predicted noise and the actual noise is calculated, and the calculation formula is as follows: in, This represents the expectation operation. Indicates at time step t Real noise added to the data at that time Indicates time step t The cumulative noise figure.
6. The small sample cross-domain fault diagnosis method based on multi-level feature alignment according to claim 1, characterized in that, Step S3 specifically comprises: S31, a shared parameter feature extraction network containing three types of inputs of source domain samples, target domain samples and target domain generated samples is constructed, the network structure contains multiple convolution layers, pooling layers and normalization layers, and finally maps to a fault category space; S32, all samples are sent into the classifier after feature extraction, and the output prediction result is used for subsequent joint loss function calculation.
7. The small sample cross-domain fault diagnosis method based on multi-level feature alignment according to claim 3, characterized in that, The mathematical formula of the cross-entropy classification loss function is as follows: wherein, denotes the number of samples of the source domain, denotes the predicted label of denotes the true label of