1. Introduction
Switch machines are core devices in railway signal systems, and their reliability is directly related to train operation safety. Faults in switch machines may cause train delays and can even lead to serious safety incidents [
1,
2]. Therefore, conducting fault diagnosis for switch machines is of great practical significance. However, in real operating environments, it is difficult to acquire sufficient labelled fault data from switch machines, and the available fault data are extremely limited. As a result, conventional fault diagnosis methods that rely on large-scale training data often struggle in data-scarce scenarios [
3,
4]. In contrast, few-shot learning can rapidly capture fault characteristics from limited samples, enabling efficient and accurate fault diagnosis. Consequently, how to achieve effective fault diagnosis of switch machines under few-shot conditions has become a current research focus.
In recent years, extensive research on switch machine fault diagnosis has been conducted, with a large body of work developed within machine learning (ML) frameworks. ML methods typically rely on manually extracting features from sound signals, current signals, and other monitoring data, and then feeding these features into conventional machine learning models to automatically identify different fault types. For example, Li et al. [
5] extracted features from the sound signals of switch machines using empirical mode decomposition (EMD), performed feature selection and dimensionality reduction via the ReliefF algorithm, and employed a support vector machine (SVM) for fault diagnosis. Lao et al. [
6] proposed a fault diagnosis method for three-phase currents during normal-to-reverse and reverse-to-normal switching processes of switch machines by integrating multi-scale permutation entropy (MPE) with an improved LightGBM classifier. Wang et al. [
7] developed a diagnosis approach for switch machine power signals that combines segmentalized minimum-redundancy–maximum-relevance (mRMR) feature selection with a cost-sensitive extreme learning machine (ELM) under fixed input conditions. Song et al. [
8] applied variational mode decomposition (VMD) to preprocess power signals and subsequently adopted a kernel fuzzy C-means clustering algorithm to distinguish different fault types. Although the above methods have achieved promising diagnostic performance, they still heavily depend on hand-crafted features [
9] and require extensive manual effort for feature extraction and a high level of domain expertise [
10]. Consequently, when operating conditions are complex or non-stationary, it becomes difficult for these approaches to fully capture the latent characteristics and time-frequency evolution patterns of input signals [
11].
To overcome the heavy dependence of conventional ML methods on hand-crafted features and domain expertise, deep learning (DL) methods have been increasingly applied to fault diagnosis of switch machines. By constructing multi-layer neural networks, DL enables end-to-end feature extraction and classification, allowing complex spatiotemporal patterns in input signals to be automatically learned. For instance, Chen et al. [
12] converted one-dimensional current signals into two-dimensional images and then fed them into a convolutional neural network (CNN), thereby transforming the traditional time-series problem into an image classification task. Xiao et al. [
13] specifically addressed the issue of data imbalance under dual-machine traction conditions for railway switch machines by proposing a fault diagnosis model based on a deep feature fusion network, which effectively improves fault recognition accuracy and robustness under complex operating conditions. Chen et al. [
14] focused on algorithmic design and proposed a switch machine fault diagnosis method that integrates multi-head channel self-attention and residual connections into a deep convolutional neural network, enabling adaptive extraction of salient features in complex signal environments. Cao et al. [
15] proposed a switch machine fault diagnosis approach based on deep random forest fusion, which combines deep feature extraction with a random forest classifier to achieve the fusion of tri-axial vibration signals. However, these methods typically require large quantities of high-quality labeled data to ensure diagnostic accuracy [
16]. In real industrial scenarios, especially for critical equipment such as switch machines, fault samples are often scarce [
17], and certain fault types are difficult to reproduce, leading to severe data insufficiency [
18]. The inherent scarcity of labeled fault data in field operation markedly limits the deployment and practical applicability of switch machine fault diagnosis methods based on DL.
Few-shot learning methods have emerged as an effective approach to address the above challenges. FSL aims to learn a model that can accurately classify query samples when only a limited number of labeled examples are available [
19]. Its core idea is to enhance the model’s generalization ability by fully exploiting prior knowledge [
20], sharing a common feature space [
21], or adopting meta-learning strategies [
22], so that satisfactory diagnostic accuracy can still be achieved under data-scarce conditions. As an emerging paradigm within few-shot learning, meta-learning plays an important role in alleviating data scarcity by enabling effective model adaptation from limited labeled data. Wu et al. [
23] proposed a few-shot transfer learning method that leverages meta-learning to handle variable working conditions and scarce fault samples in machine fault diagnosis. Yang et al. [
24] developed a cross-domain fault diagnosis method based on model-agnostic meta-learning (MAML) to enhance adaptation to changing operating conditions when only limited fault data are available. Lao et al. [
25] proposed a semi-supervised weighted prototypical network that leverages unlabeled data to refine prototypes and improve few-shot fault diagnosis of turnout switch machines. These studies indicate that meta-learning can be effective in data-scarce scenarios, and its performance still depends strongly on whether the input signals are transformed into a representation that exposes fault-sensitive structures shared across tasks. Therefore, effectively mapping one-dimensional time-series signals into a representation space that can adequately capture their time-frequency characteristics has become a key challenge in applying few-shot learning to switch machine fault diagnosis.
To address the above issues, this paper proposes a regularized supervised contrastive meta-learning (RSCML) fault diagnosis method for switch machines. First, tri-axial vibration signals (X, Y, and Z), which are collected from on-site railway switch machines, are transformed into time-frequency representations via short-time Fourier transform (STFT) and fused along the channel dimension to construct three-channel time-frequency images in order to integrate complementary information across axes and obtain a more informative and robust representation for fault diagnosis. Subsequently, an attention-enhanced feature extraction module is built by incorporating a squeeze-and-excitation (SE) channel attention mechanism and a spatial attention mechanism, which adaptively strengthen informative channel-wise features and highlight most distinctive fault feature areas, thus enhancing the separability of fault features under few-shot conditions. Finally, the feature extraction network is embedded into a regularized supervised contrastive ANIL meta-learning framework, in which only the task-specific classification layer is updated while the shared feature extraction layers are kept fixed. This design reduces computational overhead, improves the stability of feature transfer, and enables efficient fault recognition in multi-task few-shot training. And in practical railway maintenance scenarios, the proposed method can serve as a data-driven decision-support tool for switch machine condition monitoring under limited labeled data. For example, it can be applied to newly deployed or recently overhauled switch machines and to rare fault categories encountered in field operation, thereby assisting maintenance personnel in fault identification and inspection prioritization. The major contributions of this paper can be summarized as follows:
- (1)
The tri-axial vibration signals of the switch machine are transformed into time-frequency spectrograms via STFT and fused into three-channel images in order to enhance the representational capacity of state-related features so that the model can capture key fault-sensitive characteristics and improve fault recognition performance.
- (2)
An attention-enhanced module that integrates SE channel attention and spatial attention is designed, enabling the model to adaptively emphasize key channels and salient time-frequency regions, thus strengthening the discriminative power of the learned feature representations.
- (3)
A multi-loss regularization strategy is proposed within the ANIL meta-learning scheme to establish the RSCML, which effectively improves feature separability by enhancing intra-class compactness and inter-class separation, thereby significantly improving diagnostic accuracy under few-shot conditions.
The remainder of this paper is organized as follows:
Section 2 the selection of the input signals and the theoretical knowledge of the methods used in this paper.
Section 3 describes the proposed fault diagnosis model in detail.
Section 4 introduces the data acquisition process and experimental settings.
Section 5 reports and discusses the experimental results. Lastly,
Section 6 concludes this work and outlines directions for future research.
3. The Proposed Method
To address the challenges of limited fault samples and complex operating condition variations in switch machine fault diagnosis, this paper develops a regularized supervised contrastive meta-learning model. As shown in
Figure 5, the proposed method first performs multi-dimensional time-frequency feature fusion via STFT, then strengthens the representation of critical information through channel expansion and an attention fusion mechanism, and finally integrates the regularized supervised contrastive meta-learning framework based on ANIL to enable rapid learning and accurate fault diagnosis under few-shot conditions. The model is described in detail as follows.
3.1. Multi-Channel Time-Frequency Feature Fusion
During the operation of a switch machine, vibration signals generated by components such as the throwing rod and the reducer often exhibit pronounced non-stationary characteristics. Vibration responses along different directions often encode distinct dynamic behaviors and fault-related signatures; therefore, analyzing the vibration signal from only a single axis may ignore the coupling among multi-directional features. Moreover, for one-dimensional vibration signals, certain fault patterns can manifest much more distinctly when observed jointly in the time and frequency domains. Consequently, relying on features from only one domain may fail to provide sufficiently informative representations for reliable diagnosis under complex operating conditions.
To this end, we propose a multi-channel time-frequency fusion module (MCTF). As shown in
Figure 6, the time-domain vibration signals are first transformed into the time-frequency domain via short-time Fourier transform (STFT) to obtain joint time-frequency representations. For the vibration signal
, its STFT can be formulated as follows:
where
is the window function.
By applying the sliding-window transform segment by segment, the local spectral distribution of the signal at different time instants can be obtained. The resulting time-frequency spectrum is then converted into a two-dimensional time-frequency energy matrix through magnitude computation and normalization. Subsequently, the time-frequency spectra of the three axes are stacked along the channel dimension to form a three-channel time-frequency image:
where
denotes the constructed three-channel time-frequency image at time
and frequency
.
,
, and
are the corresponding normalized time-frequency spectra obtained from the STFT of the vibration signals.
In addition, to ensure consistency and comparability of the input images, all time-frequency spectrograms are subjected to normalization and size resampling, so that samples share the same spatial resolution. After this step, the original one-dimensional vibration signals of the switch machine are converted into three-channel images of size 128 × 128 by stacking the synchronized axis-wise spectrograms into a unified representation. The stacked three-channel representation preserves complementary information from different vibration axes, while subsequent feature extraction through the channel-expansion convolution and attention modules enables cross-channel feature learning from the stacked multi-axis representation.
3.2. Channel Expansion and Attention Enhancement
Under few-shot conditions, extracting highly discriminative representations from limited samples is crucial for accurate diagnosis. To this end, we propose an attention-enhanced feature module (AEFM) based on CNN components. AEFM first increases feature dimensionality through channel expansion, and then employs SE channel attention together with spatial attention to adaptively select and amplify informative patterns. The refined representations are subsequently fed into multi-layer convolutional blocks for hierarchical feature extraction.
As shown in
Figure 7 and 3 × 3 convolution is first applied to the input three-channel time-frequency image to perform channel expansion, and a sigmoid activation function is then used to produce an initial feature map, which is expressed as follows:
where
denotes the input image,
and
represent the convolution kernel and bias,
denotes the convolution operation, and
is the resulting feature map.
Next, an SE channel attention mechanism is introduced. Specifically, global average pooling is first applied to compress the feature map. Then two fully connected layers are used to implement a nonlinear transformation, and a sigmoid function generates the channel-wise attention weights. Finally, the feature map is reweighted channel-wise as follows:
where
and
denote the height and width of the feature map, respectively;
denotes the value at the spatial location
of the c-th channel.
where
denotes the ReLU activation function;
denotes the sigmoid activation function.
and
are the weight matrices of the first and second fully connected layers, respectively.
where
represents the modulated features after channel-wise recalibration; and
represents channel-wise multiplication with broadcasting.
To further enhance the model’s sensitivity to features at different spatial locations, a spatial attention mechanism is introduced. It computes an integrated weight for each pixel location, guiding the model to focus on regions with concentrated energy and salient variations, which can be denoted as
where
denotes the spatial attention function, and
and
represent average pooling and max pooling applied to the feature map
respectively;
denotes the concatenation operation;
denotes a 7 × 7 convolution.
where
is the weighted feature map obtained after applying both channel attention and spatial attention;
denotes element-wise multiplication with broadcasting.
Lastly, is fed into a multi-layer convolutional module composed of four identical convolutional blocks to extract deeper representations. With this architecture, the network further strengthens fault-relevant time-frequency patterns, yielding more discriminative feature representations
Through the hierarchical integration of channel expansion, channel attention, and spatial attention, we construct AEFM, which not only enlarges the feature dimensionality but also produces high-dimensional representations that are flattened and fed into a linear classifier. This design facilitates rapid discrimination among different fault categories within the meta-learning framework.
3.3. Regularized Supervised Contrastive Meta-Learning Framework with ANIL
Conventional deep learning models typically rely on large-scale data to perform end-to-end optimization; when training data are insufficient, overfitting and unstable training are likely to occur. To alleviate this issue, we construct a regularized supervised contrastive meta-learning framework based on ANIL [
38]. This framework performs optimization at the task level, enabling the model to rapidly adapt to similar fault diagnosis tasks with only a few samples. Compared with MAML, ANIL updates only the classification head for each task while keeping the feature extractor fixed. This strategy markedly reduces the computational cost of backpropagation and improves training stability and convergence under limited sample conditions.
In the field of meta-learning, the core objective is to learn a model
that can rapidly adapt to a variety of tasks. In few-shot classification, tasks are typically formulated as an
N-way and
K-shot problem, where
N denotes the number of classes in a task and
K denotes the number of samples per class. Assume that the fault task distribution is
, from which
B tasks are sampled. For each task
, a support set
containing
N ×
K samples and a query set
containing
N ×
M samples are constructed, and the samples in the support and query sets are strictly nonoverlapping. Then the meta parameters are initialized as
. Using the support set, the model performs
gradient updates in the inner loop. During this process, only the task specific classifier parameters are updated, while the shared feature extractor parameters
remain fixed. Let
denote the inner-loop iteration, where
range from 0 to
. The corresponding update rule is denoted as
where
is the inner-loop learning rate, and
denotes the feature representation extracted from the support set,
consistently represents count of elements when applied to a set.
After completing the inner-loop updates for all tasks and obtaining the updated parameters, the meta model parameters are optimized by minimizing the average query loss over the
tasks. To enhance the discriminability of learned representations, we introduce a joint multi-loss optimization strategy within the ANIL framework. Specifically, the cross-entropy loss and the supervised contrastive loss (SupCon) [
39] are jointly used to constrain model training. The cross-entropy loss maximizes the log likelihood of the correct class, ensuring that the classifier can quickly learn the decision boundary among different fault categories, which can be expressed as
where
denotes the feature representation of the query set.
However, relying solely on the cross-entropy loss often fails to yield well-clustered features under few-shot conditions. Therefore, we incorporate SupCon, which uses label information to treat samples from the same class as positive pairs, thereby promoting intra-class compactness and inter-class separability in the feature space [
40].
Assume that the number of samples in the current batch is
, with feature vector
and labels
. Then, the set of positive samples for sample
is defined as
Accordingly, the supervised contrastive loss can be written as
where
denotes cosine similarity and
is the temperature parameter. Compared with using cross-entropy loss alone, supervised contrastive learning loss makes fuller use of label information and encourages a more stable and more discriminative feature structure in few-shot fault recognition.
By combining the two losses above, the overall loss of RSCML is formulated as follows:
where
is the weighting coefficient for the contrastive term, which is used to balance the relative contributions of cross-entropy classification loss and supervised contrastive loss.
In addition, to mitigate overfitting that may arise from the enriched feature space, a stability regularization (SR) strategy is introduced. It combines Dropout and L2 regularization, so that the model can converge efficiently while maintaining stable classification performance when recognizing the same fault type under different operating conditions.
Specifically, Dropout regularization reduces the model’s dependence on local features by randomly discarding a subset of neuron connections [
41]:
where
denotes the retention probability. And L2 regularization improves stability by adding a weight penalty term to the loss function, which encourages smoother parameter distributions [
42].
By minimizing the average RSCML loss on the query sets after task adaptation, the model learned representation to support rapid classifier adjustment and robust generalization across tasks, which is defined as
The final parameter update of the model is as follows:
where
is the outer-loop learning rate.
3.4. The Process of Fault Diagnosis
To address scarce on-site fault samples for railway switch machines, we propose a regularized supervised contrastive meta-learning method with multi-channel time-frequency fusion and attention enhancement. This advanced meta-learning paradigm for vibration data analysis can efficiently extract fault features from limited vibration signals.
Algorithm 1 summarizes the proposed regularized supervised contrastive meta-learning framework.
| Algorithm 1 Regularized Supervised Contrastive ANIL with Multi-Channel Time-Frequency Fusion and Attention Enhancement |
Require: task distribution , vibration signal Require: learning rates , , , window function 1: For each vibration signal do 2: Compute the STFT for each axial signal with (8) 3: Perform multi-channel time-frequency fusion with (9) 4: end for 5: Randomly initialize parameter 6: while not done do 7: Sample a batch of tasks 8: for all do 9: Initialize task-specific classifier parameters 10: AEFM feature extraction (channel expansion + SE + spatial attention) 11: for inner loop step to do 12: Inner-loop classifier update on support set with (16) 13: end for 14: Computing query set cross-entropy loss with (17) 15: Computing SupCon loss of task with (19) 16: Computing RSCML loss of task with (20) 17: end for 18: Calculating average cross-entropy loss: 19: Calculating average RSCML loss:
20: Update meta model: 21: end while |
5. Results and Discussion
To validate the effectiveness and superiority of the proposed RSCML, experiments are conducted on vibration data which we introduced in
Section 4, and the results are compared with those of several representative methods. All experiments are implemented in Python 3.12.11 with the PyTorch 2.4.1 framework and executed on a workstation equipped with an Intel Core i7 14700HX CPU (Intel Corporation, Santa Clara, CA, USA) and an NVIDIA GeForce RTX 4070 GPU (NVIDIA Corporation, Santa Clara, CA, USA). And RSCML is compared with a deep learning method, CNN [
43], and meta-learning methods including MAML [
37], ProtoNet [
44], RelaNet [
45] and ADMTL [
46].
To ensure comparability, all methods were evaluated under the same dataset split and few-shot evaluation setting, while different feature extractors were used according to the experimental settings of each method. For each method, key hyperparameters are selected on the validation split via a limited search within standard ranges reported in prior work; the final settings are summarized in
Table 3. The 2D CNN consists of four convolutional blocks, where each block contains a standard CNN stack including a convolution layer, a normalization layer, a ReLU activation function, and a pooling layer.
In the inner loop of meta-learning, we use momentum-free SGD to rapidly update the task-specific parameters. In contrast, the outer loop adopts the Adam optimizer to update the shared initialization parameters. This design preserves the fast adaptation capability of SGD in the inner loop, while taking advantage of Adam in terms of global convergence speed and adaptive learning rate adjustment.
5.1. Training Process Analysis
5.1.1. Hyperparameter Sensitivity Analysis
Sensitivity analyses were conducted for two key hyperparameters of the proposed method, namely the weight of the supervised contrastive term
and the outer-loop learning rate
. Since these two parameters directly affect the balance between supervised contrastive regularization and meta-level optimization, their influence on the final diagnostic performance was further examined under the 3-way 1-shot setting. Specifically, one parameter was varied while the others were kept unchanged, and the corresponding results are shown in
Table 4.
As shown in
Table 4, the proposed RSCML maintains relatively stable performance within a reasonable range of both the weight of the supervised contrastive term
and the outer-loop learning rate
. The adopted default settings, namely
and
, achieve the best results in terms of both accuracy and F1-score. When either parameter deviates from these values, the performance decreases slightly but remains at a relatively high level overall. This indicates that the proposed method has good robustness to these hyperparameters and that the adopted settings are reasonable.
5.1.2. Computational Cost Analysis
In order to evaluate the computational cost of the proposed RSCML under different few-shot settings, training time and test time are further reported. The corresponding results are summarized in
Table 5.
As shown in
Table 5, the computational cost of the proposed RSCML remains moderate under both the 3-way 1-shot and 5-way 1-shot settings. When the task becomes more challenging, the training time increases from 15.05 min to 21.85 min, and the test time for 600 episodes increases from 19.11 s to 22.49 s. Overall, these results indicate that the proposed method can achieve strong diagnostic performance with an acceptable computational cost under the current experimental setting.
5.1.3. Random Seed Stability Analysis
The stability of the proposed method under different training initializations is further analyzed by repeating RSCML and the strongest competing baseline ADMTL under five independent random seeds in the 3-way 1-shot and 5-way 1-shot settings. The mean accuracy and F1-score, together with their corresponding standard deviations, are reported.
As shown in
Table 6 and
Table 7, the proposed RSCML demonstrates strong robustness across different random seeds and consistently achieves the best performance under all evaluated settings. In the 3-way 1-shot task, RSCML attains a mean accuracy of 98.92% with a standard deviation of 0.13%, which is clearly higher and more stable than ADMTL (96.16% ± 0.84%). A similar trend can be observed for the F1-score, where RSCML reaches 98.82% ± 0.12%, outperforming ADMTL (95.97% ± 0.90%). Under the more challenging 5-way 1-shot setting, RSCML still maintains the highest mean accuracy and F1-score, achieving 98.70% ± 0.39% and 98.53% ± 0.44%, respectively, whereas ADMTL obtains a 92.37% ± 1.24% accuracy and a 91.84% ± 1.55% F1-score. These results demonstrate that the proposed method not only yields superior average performance but also provides better stability and reliability under different training initializations.
5.2. Ablation Experiment
To evaluate the contribution of each component to the overall performance, ablation experiments are conducted on the ZD6 switch machine dataset, examining how the diagnostic accuracy changes as modules are introduced step by step. Four configurations are considered: the basic ANIL framework (ANIL), ANIL with the attention enhanced feature module AEFM (ANIL + AEFM), ANIL with AEFM and SR (ANIL + AEFM + SR), and the complete RSCML method. The classification accuracies of these configurations under the unified 3-way 1-shot and 3-way 5-shot settings are reported in
Table 8.
As shown in
Table 8, the basic ANIL framework already achieves an accuracy of 96.38% in the 3-way 1-shot setting and 97.53% in the 3-way 5-shot setting, indicating that this strategy can effectively improve the model’s adaptation capability for similar tasks under limited samples. After introducing AEFM, the accuracy further improves to 97.74% and 98.45% under the two settings, respectively, which verifies the effectiveness of the proposed feature extraction module. When stability regularization (SR) is further incorporated, the accuracy increases to 98.64% in the 3-way 1-shot setting and 99.32% in the 3-way 5-shot setting, showing that SR helps reduce overfitting and improves feature stability under episodic training. Finally, by introducing the supervised contrastive term, the complete RSCML achieves the best performance, reaching 99.02% and 99.73% under the 3-way 1-shot and 3-way 5-shot settings, respectively. These results show that the proposed components consistently contribute to performance improvement under both settings.
In both settings, the 95% confidence intervals become progressively narrower as AEFM, SR, and the supervised contrastive term are introduced, indicating improved stability and reliability under episodic evaluation. This trend is particularly clear in the 3-way 5-shot setting, where all methods benefit from more support samples, while the complete RSCML still achieves the highest accuracy together with the narrowest confidence interval. For visual clarity and conciseness, the t-SNE visualization is presented only for the more challenging 3-way 1-shot setting, so as to provide an intuitive illustration of the feature separability achieved by different ablation configurations.
As shown in
Figure 10, under the 3-way 1-shot setting, RSCML clearly separated clusters for each fault type, indicating strong discriminative capability in the learned feature space. In contrast, although the other methods achieve reasonably high diagnostic accuracy, the clusters of different fault categories remain relatively close, which increases the likelihood of misclassification. These observations further confirm the effectiveness of the proposed method.
5.3. Comparative Experiments
5.3.1. Comparison Under a Unified Backbone
A comparison is further conducted under a unified backbone setting. In the original comparison, the baseline methods used a standard 2D-CNN encoder, whereas RSCML employed the proposed attention-enhanced feature module (AEFM). Since the ablation results show that AEFM improves the basic ANIL framework from a 96.38% to 97.74% accuracy under a 3-way 1-shot setting, an additional unified-backbone analysis was conducted to further separate the contribution of the feature extractor from that of the learning framework. In this analysis, representative meta-learning baseline methods with compatible encoder interfaces were re-implemented using AEFM, while their original learning mechanisms and evaluation settings were kept unchanged. To provide a focused comparison, the experiments were carried out in the 1-shot setting, including both 3-way 1-shot and 5-way 1-shot tasks. Under this setting, the compared methods shared the same feature extractor, such that the remaining performance differences mainly reflected the contribution of the learning framework rather than encoder capacity.
As shown in
Table 9, when the backbone is unified as AEFM, the compared meta-learning methods also benefit from the improved feature extractor to different extents. Nevertheless, RSCML still remains the best-performing method in both the 3-way 1-shot and 5-way 1-shot settings. This result suggests that the superiority of RSCML is not solely caused by encoder strength, but is also related to the effectiveness of the proposed learning framework. Therefore, the unified-backbone analysis provides additional evidence supporting the fairness of the comparison.
5.3.2. Comparison with Other Algorithms
The proposed RSCML method is compared with the five baseline methods under the same data partitioning strategy and comparable network depth. Four representative few-shot diagnosis scenarios are constructed, including 3-way 1-shot, 3-way 5-shot, 5-way 1-shot, and 5-way 5-shot. We report both accuracy and F1-score as the evaluation metrics, where accuracy reflects overall correctness and F1-score characterizes the precision and recall balance under few-shot conditions. The accuracy results are summarized in
Table 10. And the F1-score results are summarized in
Table 11.
As shown in
Figure 11, RSCML achieves accuracies close to or above 99% under all four settings, outperforming the other methods by a clear margin. This result indicates that the proposed method maintains stronger stability and generalization across different task scales and sample regimes.
Table 10 further shows that, under the same settings, the conventional CNN shows the weakest results, especially in 1-shot cases where limited supervision prevents learning transferable features, yielding only 67.16% and 63.84% for 3-way 1-shot and 5-way 1-shot. ProtoNet and RelaNet perform better than CNN under scarce labels, suggesting that prototype-based matching improves robustness when samples are limited, but they still degrade notably as task difficulty increases. MAML benefits from meta-training and outperforms CNN, yet it remains behind other meta-learning methods in the most challenging 5-way 1-shot case. ADMTL performs better than the other baselines because it combines attention-guided feature extraction with a meta-transfer training strategy that leverages pre-trained representations and lightweight parameter modulation, enabling more discriminative embeddings and more stable adaptation under scarce samples.
In comparison, the proposed RSCML achieves the best diagnostic performance under all four few-shot settings. Specifically, it attains accuracies of 99.02%, 99.73%, 98.82%, and 99.04% in the 3-way 1-shot, 3-way 5-shot, 5-way 1-shot, and 5-way 5-shot scenarios, respectively, improving upon ADMTL by at least 0.76% to 7.74%. Notably, the associated 95% confidence intervals remain consistently narrow across settings, indicating that RSCML is not only more accurate but also more stable under episodic resampling. In the more challenging 5-way 1-shot setting, RSCML still maintains an accuracy close to 99% under extremely limited samples, further highlighting its effectiveness and robustness.
To further evaluate the classification performance for each fault category, a confusion matrix is used for analysis. In this study, we obtained the confusion matrix of real fault classes via a label-mapping strategy that converts episode-internal labels back to the original fault labels. As shown in
Figure 12, the diagonal entries for most categories are close to 100%, indicating that RSCML achieves high recognition accuracy for the majority of fault types. However, the diagonal value for class T7 is slightly lower than those of the other classes, and a small number of samples are misclassified as T0, T3, and T4. By examining the original vibration signals and their time and frequency characteristics, it can be observed that the T7 fault exhibits similar energy levels and dominant frequency band distributions to these operating conditions over most stages of the switching process. Differences appear only in a brief local action stage, which makes the global time and frequency features of T7 highly close to those of the other categories.
Then t-SNE is applied to visualize the representations from the final layer. As shown in
Figure 13, samples from different classes generally form well-separated clusters in the two-dimensional space, with clear inter-class margins and relatively compact intra-class distributions. This observation indicates that the learned features exhibit strong separability. Even in the more challenging 5-way scenario, most clusters remain clearly separated, while only a few classes appear slightly more dispersed. This observation is consistent with the relatively higher misclassification rates of those classes in the confusion matrix.
To comprehensively evaluate the diagnostic performance of the models, we introduce the F1-score as an assessment metric. The F1-score considers both precision and recall, providing a more complete reflection of the model’s diagnostic capability under few-shot conditions. In this study, for each episode, predictions and ground-truth labels are mapped from episode-local indices to the corresponding sampled class identities before computing F1, so that the metric is evaluated under the same episodic label space.
Table 11 compares the F1-score of different methods under four few-shot settings. The proposed RSCML consistently achieves the best F1-score and remains stable as task difficulty increases. ADMTL is the strongest baseline, benefiting from attention-guided meta-transfer learning that improves feature discriminability and supports fast adaptation, but it still lags behind RSCML, particularly in the 5-way 1-shot case. MAML performs markedly better than the conventional CNN due to meta-training for rapid adaptation, yet its F1-score drops in the most challenging low-shot setting, suggesting that gradient-based inner-loop updates can be sensitive to time-frequency information. ProtoNet and RelaNet exhibit moderate robustness by performing distance or relation matching in the feature space, which enables relatively stable performance under few-shot conditions. In contrast, the CNN baseline performs the worst because it relies heavily on sufficient labeled data to learn transferable feature representations.
In contrast, the proposed method achieves the highest F1-scores across all four task settings, reaching 99.72% and 99.03% in the 3-way 5-shot and 5-way 5-shot scenarios, respectively, and maintaining an outstanding 98.65% in the more challenging 5-way 1-shot scenario. Meanwhile, the proposed method also maintains the narrowest 95% confidence interval, which highlights its stability. As shown in
Figure 14, the three-dimensional bar chart further illustrates the performance differences of various methods across settings. The proposed method forms the most prominent bar contours in all dimensions, with minimal performance fluctuations across different settings, indicating that it effectively balances high classification accuracy and recall while demonstrating strong stability and robustness.
5.3.3. Statistical Significance Analysis
An additional statistical significance analysis is conducted in the 3-way 1-shot and 5-way 1-shot settings to examine whether the performance advantage of RSCML over the strongest competing baseline ADMTL is statistically significant. Although the two methods were evaluated under the same dataset split and the same few-shot task setting, their episode-level test results were obtained from independently sampled test episodes under their current testing pipelines. Therefore, the Mann–Whitney U test was adopted to compare the episode-level accuracy and F1-score distributions. The corresponding results are reported in
Table 12.
The test results show that the proposed RSCML significantly outperforms ADMTL in both settings. In the 3-way 1-shot task, the p-values are 2.70 × 10−36 for accuracy and 2.90 × 10−36 for F1-score. In the 5-way 1-shot task, the p-values are 1.09 × 10−139 for accuracy and 5.36 × 10−139 for F1-score. All these values are far below 0.001, indicating that the observed performance advantage of RSCML is highly statistically significant and is unlikely to be caused by random fluctuations in episode sampling.
5.4. Generalization and Robustness Analyses
5.4.1. Cross-Category Generalization Experiment
To evaluate generalization beyond the fault categories observed during meta-training, we conduct a cross-category evaluation where fault categories C4 and C5 are excluded from the source set and used only for testing. The detailed partition of fault labels used in the testing stage is summarized in
Table 13. This setting evaluates generalization to unseen fault categories under limited samples, rather than domain adaptation with shared class identities.
In the cross-category evaluation, each episode is constructed as a 3-way 5-shot task by randomly sampling three classes from the four unseen categories, and results are averaged over 600 episodes. The experiment results are shown in
Table 14 and
Figure 15.
This ranking is consistent with how different paradigms handle category shift under scarce labels. The conventional CNN baseline shows the weakest cross-category generalization ability, as it is strongly tied to the source label distribution and lacks robust feature generalization once category shift occurs. MAML can achieve reasonable performance through gradient-based optimization, but it does not fully capture fault-specific features, resulting in limited accuracy when encountering unseen faults. ProtoNet and RelaNet exhibit more stable behavior because distance or similarity matching reduces the need for extensive parameter updates. However, their effectiveness still depends on whether sufficiently discriminative features can be learned from the source categories and generalized to unseen ones. ADMTL further improves stability by combining attention mechanisms and meta-transfer learning, but its class separability and generalization depth remain constrained when inter-class similarity is high.
In contrast, the proposed RSCML consistently demonstrates the most balanced performance across both evaluation metrics, with a notably narrow confidence interval that reflects strong statistical reliability. The advantage of RSCML lies in its ability to enhance fault feature information through multi-channel time-frequency fusion and attention enhancement, and to further strengthen classification performance by means of a regularized supervised contrastive meta-learning structure. As a result, the learned representations remain discriminative even when fault categories differ from those seen during meta-training. This consistency confirms that the proposed method improves not only overall classification accuracy but also class-wise reliability, which is essential for safety-critical fault diagnosis with limited data.
As shown in
Figure 16, the confusion matrix indicates that the proposed RSCML method achieves the highest accuracy across all four fault categories. The misclassification between V1 and V3 is largely mitigated by RSCML, which is difficult for other methods to resolve. In comparison, CNN suffers from notable confusion between several classes, while MAML, ProtoNet, RelaNet, and ADMTL improve performance but still misclassify V1 or V3 because they did not learn transferable feature structures. These results demonstrate that RSCML effectively extracts discriminative representations that generalize well to unseen fault categories.
5.4.2. Robustness Under a More Conservative Split
An additional evaluation is conducted under the more conservative time-ordered split described in
Section 4.2. Compared with the original record-level split, this setting reduces the similarity between temporally adjacent samples and makes the evaluation more challenging. The corresponding results are presented in
Table 15.
As shown in
Table 15, introducing the more conservative time-ordered partition reduces the potential dependence among samples and makes the evaluation more challenging. Under this stricter protocol, ADMTL suffers from a relatively obvious performance degradation, especially in the 5-way 1-shot setting. By comparison, the proposed RSCML shows only marginal changes in both accuracy and F1-score under the same partition. Moreover, RSCML still remains the best-performing method in all evaluated settings. This demonstrates that the effectiveness of the proposed framework is not strongly influenced by the adopted split strategy and further supports its robustness under a less optimistic and more conservative data partition.