원시데이터 수집 시스템
선정목록으로

P2IFormer: A Multi-Granularity Patch-to-Image Embedding Model for Fault Diagnosis of High-Speed Train Axle-Box Bearings

관련 모빌리티 소재 · (4) 카시트 모듈

기본 정보

저자
  1. Weigang Ma — School of Computer Science and Engineering, Xi'an University of Technology, Xi'an 710048, China
  2. Chaohui Zhang — School of Computer Science and Engineering, Xi'an University of Technology, Xi'an 710048, China
  3. Ling Chen — School of Computer Science and Engineering, Xi'an University of Technology, Xi'an 710048, China
  4. Zhoukai Wang — School of Computer Science and Engineering, Xi'an University of Technology, Xi'an 710048, China
  5. Xing Fan — School of Computer Science and Engineering, Xi'an University of Technology, Xi'an 710048, China
  6. Yingan Cui — School of Computer Science and Engineering, Xi'an University of Technology, Xi'an 710048, China
DOI
10.3390/s25165138
저널
Sensors
발행년도
2025
발행기관
Multidisciplinary Digital Publishing Institute
피인용수
0
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.3390/s25165138
토픽
Gear and Bearing Dynamics Analysis
OpenAlex ID
W4413308813

평가 내용

관련도
관련
사업분야
모빌리티 소재 · (4) 카시트 모듈
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '모빌리티 소재 > 카시트 모듈' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

The axle-box bearing is a critical load-bearing component in high-speed trains and is prone to failure under long-term heavy-duty operation, affecting both operational efficiency and safety. Current deep-learning-based fault diagnosis methods face two key challenges: difficulty in capturing temporal features across multiple scales simultaneously, and limited capability in modeling local sequential patterns. To address these issues, we propose P2IFormer, a fault diagnosis model based on multi-granularity patch-to-image embedding. The raw vibration sequence is divided into equal-length patch sequences under multiple granularities, each defined by a fixed window size. Each patch is then transformed into a Gramian Angular Field (GAF) image to extract spatial features and generate granularity-specific embedding. A multi-granularity self-attention mechanism is used to model both intra- and inter-granularity dependencies. The resulting multi-granularity features are fused and fed into a softmax classifier for final fault prediction. Experiments conducted under four constant-speed conditions and one variable-speed condition demonstrate that P2IFormer achieves over 99.5% accuracy across all scenarios, significantly outperforming existing CNN- and Transformer-based methods.

본문 72,073자

본문 펼치기
_Article_ # P2IFormer: A Multi-Granularity Patch-to-Image Embedding Model for Fault Diagnosis of High-Speed Train Axle-Box Bearings Weigang Ma *, Chaohui Zhang *, Ling Chen, Zhoukai Wang, Xing Fan and Yingan Cui School of Computer Science and Engineering, Xi’an University of Technology, Xi’an 710048, China; 2241221110@stu.xaut.edu.cn (L.C.); zkwang@xaut.edu.cn (Z.W.); xing.fan@xaut.edu.cn (X.F.); cuiyan@xaut.edu.cn (Y.C.) * Correspondence: mwg_markey@xaut.edu.cn (W.M.); 2231221144@stu.xaut.edu.cn (C.Z.) Abstract The axle-box bearing is a critical load-bearing component in high-speed trains and is prone to failure under long-term heavy-duty operation, affecting both operational efficiency and safety. Current deep-learning-based fault diagnosis methods face two key challenges: difficulty in capturing temporal features across multiple scales simultaneously, and limited capability in modeling local sequential patterns. To address these issues, we propose P2IFormer, a fault diagnosis model based on multi-granularity patch-to-image embedding. The raw vibration sequence is divided into equal-length patch sequences under multiple granularities, each defined by a fixed window size. Each patch is then transformed into a Gramian Angular Field (GAF) image to extract spatial features and generate granularityspecific embedding. A multi-granularity self-attention mechanism is used to model both intra- and inter-granularity dependencies. The resulting multi-granularity features are fused and fed into a softmax classifier for final fault prediction. Experiments conducted under four constant-speed conditions and one variable-speed condition demonstrate that P2IFormer achieves over 99.5% accuracy across all scenarios, significantly outperforming existing CNN- and Transformer-based methods. Academic Editor: Jiawei Xiang Received: 7 July 2025 Revised: 9 August 2025 Accepted: 14 August 2025 Published: 19 August 2025 Citation: Ma, W.; Zhang, C.; Chen, L.; Wang, Z.; Fan, X.; Cui, Y. P2IFormer: A Multi-Granularity Patch-to-Image Embedding Model for Fault Diagnosis of High-Speed Train Axle-Box Bearings. _Sensors_ 2025, _25_, 5138. [https://doi.org/10.3390/s25165138](https://doi.org/10.3390/s25165138) Copyright: © 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license [(https://creativecommons.org/](https://creativecommons.org/licenses/by/4.0/) [licenses/by/4.0/).](https://creativecommons.org/licenses/by/4.0/) Keywords: high-speed train; axle-box bearing; fault diagnosis; time series to image; gramian angular field 1. Introduction High-speed trains, as a vital component of modern transportation systems, are widely used for intercity passenger and freight transport due to their high speed and large carrying capacity. The axle-box bearing, shown in Figure 1, a key load-bearing component connecting the wheelset and the bogie, plays a crucial role in ensuring the train’s operational performance and safety. However, due to frequent dynamic loads and complex wheel–rail interactions, axle-box bearings are prone to wear and degradation. If their condition cannot be accurately diagnosed in a timely manner and corresponding maintenance is not carried out, such failures may lead to severe malfunctions or even major accidents. Therefore, developing effective fault diagnosis methods for axle-box bearings is of great practical importance for ensuring the safe operation of high-speed trains, reducing maintenance costs, and improving overall operational efficiency [1,2]. The health condition of high-speed train axle-box bearings is directly related to the safety and reliability of train operations. However, fault diagnosis in practical scenarios _Sensors_ 2025, _25_, 5138 2 of 22 faces multiple challenges. On the one hand, it is extremely difficult to obtain sufficient fault samples under real operating conditions and the available data are often highly imbalanced. On the other hand, the complex and variable operating conditions of trains—such as changes in rotational speed and noise interference—significantly increase the difficulty of diagnosis [3,4]. Traditional diagnostic methods typically rely on signal processing in the time domain, frequency domain, or time-frequency domain, combined with machine learning models such as support vector machines for fault identification [5–7]. These approaches are heavily dependent on manual feature extraction, which is not only time-consuming and expertise-intensive but also poorly adaptable to variable operating conditions, thereby limiting the accuracy and robustness of diagnostic models [8]. Axle box Axle box bearing Figure 1. The structural location of the axle-box bearing in a high-speed train bogie. In recent years, the rapid development of deep learning has driven its widespread application in fault diagnosis. Compared with traditional methods, deep learning models can directly extract high-level features from raw vibration signals, reducing reliance on manual feature engineering and significantly improving diagnostic accuracy [9]. Chen et al. [10] proposed a feature-aligned multi-scale convolutional neural network (MSCNN-FA) that converts vibration signals into time-frequency images using short-time Fourier transform (STFT) and incorporates a feature alignment module with a multi-scale convolution strategy, achieving a diagnostic accuracy of 99.2%. Sun et al. [11] developed a fault diagnosis method that combines multi-scale CNN and long short-term memory (LSTM) networks, where the multi-scale CNN extracts local features from time-frequency images and the LSTM captures long-term temporal dependencies, resulting in an accuracy of approximately 98%. Zhao et al. [12] introduced a multi-scale convolutional neural network–bidirectional LSTM– attention mechanism (MSCNN-BiLSTM-AM) approach, in which the multi-scale CNN extracts spatiotemporal features, the BiLSTM captures bidirectional temporal dependencies, and the attention mechanism enhances the representation of key features, achieving a diagnostic accuracy of 99.5%. To address the issue of data imbalance, Hou et al. [13] and Luo et al. [14] designed improved generative adversarial networks (GANs), which achieved diagnostic accuracies of 97.8% and 98.2%, respectively, on the CWRU dataset, demonstrating strong robustness under imbalanced data conditions. In fault diagnosis research, a widely used approach is to transform time-series signals into two-dimensional representations to enhance the expressive capacity of temporal features and to apply two-dimensional convolutional neural networks (2D-CNNs) for fault identification [15]. Among such methods, the transformation of time-series data into images using the Gramian Angular Field (GAF) has been extensively adopted [16,17]. For example, Bai et al. [18] proposed a GAF-based SEDenseNet method that converts vibration signals into two-dimensional images via GAF and incorporates a squeeze-and-excitation (SE) module to optimize feature extraction, achieving a diagnostic accuracy of 97.5%. Yu et al. [19] presented a GAF-based bearing fault diagnosis approach that similarly maps vibration signals to im _Sensors_ 2025, _25_, 5138 3 of 22 ages and employs a generative adversarial network (GAN) to synthesize training samples, reaching 96.8% accuracy and demonstrating robustness under class-imbalanced conditions. Tong et al. [20] developed a method using the Gramian Angular Difference Field (GADF) combined with channel attention and SimAM attention mechanisms, obtaining 98.7% accuracy. However, the inherently local receptive field of convolutional neural networks limits their capacity to model global contextual information, which can reduce diagnostic performance when handling long sequences or complex fault patterns. Transformer architectures, through their intrinsic self-attention mechanisms, enable the direct modeling of long-range dependencies across all positions in sequential data, thereby demonstrating substantial efficacy in fault diagnosis [21,22]. For instance, Hou et al. [23] proposed the Diagnosisformer model, which extracts frequency-domain features using Fast Fourier Transform (FFT) and integrates a multi-feature parallel fusion encoder and a cross-flip decoder, achieving a diagnostic accuracy of 99.85% on the CWRU dataset. However, Transformers have certain limitations in modeling local patterns and extracting multi-granularity temporal features. To address these issues, hybrid CNN–Transformer architectures have been proposed. Chen et al. [24] introduced an efficient cross-space multiscale CNN–Transformer parallel architecture (ECMCTP) that generates time-frequency images using the continuous wavelet transform (CWT) and employs parallel CNN and Transformer branches to capture local and global features, delivering excellent diagnostic accuracy and noise robustness. Han et al. [25] developed a multi-task MT-ConvFormer model that generates time-frequency representations via short-time Fourier transform (STFT) and integrates CNNs’ local feature extraction with Transformers’ long-range dependency modeling, achieving a diagnostic accuracy close to 98%. To address the limitations of existing fault diagnosis methods in local feature modeling and multi-scale feature extraction, this paper proposes P2IFormer, a fault diagnosis model for high-speed train axle-box bearings based on multi-granularity patch-to-image embedding. The proposed approach first segments raw vibration signals into equal-length patch sequences at multiple granularities using a set of predefined window sizes, enabling structured multi-granularity modeling of the time series. For each granularity level, the individual patches are then transformed into corresponding Gramian Angular Field (GAF) images, enhancing the visual expression of local temporal features. These images are subsequently processed to extract deep features and mapped into granularityspecific embedding representations. Building on these embeddings, P2IFormer employs a multi-granularity self-attention mechanism to model both intra-granularity and intergranularity contextual dependencies, achieving deep fusion of features across different granularities. Finally, a linear projection layer followed by a softmax function is used to perform fault classification. The experimental results under various constant-speed and variable-speed conditions demonstrate that the proposed method achieves excellent diagnostic performance, significantly outperforming existing CNN- and Transformer-based models. The main contributions of this paper are summarized as follows: (1) A fault diagnosis model for high-speed train axle-box bearings, named P2IFormer, is developed based on a patch-to-image embedding framework. By combining multigranularity segmentation of time series with image transformation, patch sequences at different granularities are converted into multi-channel Gramian Angular Field (GAF) images, significantly enhancing the modeling of local temporal features. (2) A granularity-specific image embedding module is designed to generate feature representations for each granularity. Patch images at each granularity are processed through feature extraction, pooling, and linear projection, and then uniformly encoded as granularity-specific tokens. This provides high-quality representations to support effective multi-granularity interaction modeling. _Sensors_ 2025, _25_, 5138 4 of 22 (3) The proposed method is evaluated under various constant-speed and variablespeed operating conditions. The results demonstrate that P2IFormer achieves over 99.5% accuracy across all scenarios, significantly outperforming existing CNN- and Transformer-based methods. 2. Related Work _2.1._ _Transformer-Based Approaches for Bearing Fault Diagnosis_ In recent years, the Transformer architecture has gained significant attention in the field of fault diagnosis due to its superior global modeling capability [26]. Compared with traditional convolutional neural networks (CNNs), Transformers leverage self-attention mechanisms to capture dependencies between arbitrary time steps, effectively addressing the limitations of CNNs, which are restricted to local feature extraction and struggle to model long-range temporal dependencies. In addition, Transformers support parallel computation and offer stronger representational capacity. In bearing fault diagnosis, some studies have applied or modified standard Transformer models to improve global feature extraction [27,28], while others have explored hybrid models that combine Transformers with CNNs to exploit their complementary strengths in local and global feature modeling [29,30]. However, most existing Transformer-based methods rely on fixed-length patch segmentation strategies, which hinder the ability to simultaneously capture multigranularity temporal features and thus limit the modeling of complex fault patterns. _2.2._ _Image-Based Fault Diagnosis Through Time-Series Transformation_ Transforming time-series data into images for fault diagnosis has emerged as an effective and rapidly evolving approach in recent years, with particularly notable success in bearing fault diagnosis. The core idea of this method is to map one-dimensional vibration signals into two-dimensional image representations using specific transformation algorithms, enabling powerful image-based models such as convolutional neural networks (CNNs) and vision Transformers to perform feature extraction and fault classification tasks [31]. Common transformation techniques include time-frequency representation methods such as short-time Fourier transform (STFT), wavelet transform (WT), and continuous wavelet transform (CWT), as well as structural mapping methods like Gramian Angular Field (GAF) and Markov Transition Field (MTF) [32–36]. These image-based techniques not only reveal the local dynamics and global trends within time-series data, but also enhance the ability of visual models to identify complex fault patterns. _2.3._ _Multi-Scale Feature Extraction for Fault Diagnosis_ In recent years, multi-scale feature extraction has received increasing attention in bearing fault diagnosis, aiming to capture critical signal patterns distributed across different temporal and frequency ranges. The core idea behind such methods is to process vibration signals using varying receptive fields or segmentation granularities, thereby enabling joint modeling of both local details and global structures. In convolutional neural networks (CNNs), multi-scale architectures are typically constructed using parallel branches with different convolutional kernel sizes to extract and fuse features at multiple scales [37–39]. More recently, attention mechanisms have been incorporated into multi-scale CNN frameworks to enhance the model’s focus on salient features and improve the robustness of feature representations [40,41]. However, most existing multi-scale methods lack explicit modeling of the relationships between different scales, making it difficult to fully capture the semantic dependencies among features of varying scales. _Sensors_ 2025, _25_, 5138 5 of 22 3. Methodology _3.1._ _Problem Definition_ The fault diagnosis of high-speed train axle-box bearings can be formulated as a multivariate time-series classification task. Let _x_ _∈_ R <sup>_T×C_</sup> denote a segment of vibration signal, where _T_ represents the sequence length (i.e., number of time steps) and _C_ denotes the number of sensor channels (e.g., vibration, temperature). Each sample _xi_ is associated with a label _yi_ _∈{_ 1, 2, . . ., _M}_, indicating one of _M_ predefined bearing conditions or fault types (e.g., normal, inner race fault, outer race fault). Given a training set _{_ ( _xi_, _yi_ ) _}i_ <sup>_N_</sup> =1 composed of _N_ labeled instances, the objective is to learn a classification function _f_ : R <sup>_T×C_</sup> _→{_ 1, 2, . . ., _M}_ that can accurately predict the fault category _y_ ˆ = _f_ ( _x_ ) for any unseen sample _x_ . _3.2._ _Overview of the P2IFormer Architecture_ The overall architecture of the proposed P2IFormer is illustrated in Figure 2. The input to the model is a multivariate vibration signal segment collected from axle-box bearings. First, the signal is processed by the Multi-Granularity Patch-to-Image (P2I) Embedding module, which partitions the sequence into multiple granularities using different window sizes and converts each patch into a Gramian Angular Field (GAF) image. Each image is then encoded into a latent token representation via a feature extraction module. Subsequently, the resulting multi-granularity embeddings are fed into a stack of encoder layers, each consisting of layer normalization, the Multi-Granularity Self-Attention (MGSA) module, and a feed-forward network. The MGSA mechanism models both intra-granularity and intergranularity dependencies by leveraging learnable router tokens. To integrate the semantic information across different granularities, the updated router tokens from all granularities are concatenated in the Multi-Granularity Feature Aggregation module and projected into a unified feature space. Finally, the aggregated representation is passed through a fully connected layer followed by a softmax classifier to determine the bearing fault category. _3.3._ _Multi-Granularity Patch-to-Image Embedding_ To effectively capture temporal features across different scales, this study introduces a Multi-Granularity Patch-to-Image (P2I) Embedding module, as illustrated in Figure 3. The input multivariate time series is first divided into patch sequences under multiple granularity levels by applying sliding windows of different lengths. Each patch is then passed into the P2I module, which internally performs Gramian Angular Field (GAF) transformation and feature extraction through convolutional and attention-based operations. This process yields a token embedding for each patch. By applying the P2I module to all patches within each granularity level, a complete granularity-specific embedding sequence _x_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> is constructed. The resulting embeddings across all granularities, denoted as _x_ <sup>(1)</sup>, _x_ <sup>(2)</sup>, . . ., _x_ <sup>(</sup> <sup>_n_</sup> <sup>)</sup>, serve as the foundation for subsequent multi-granularity attention modeling. 3.3.1. Multi-Granularity Patch Splitting To effectively capture fault-related patterns in axle-box bearing vibration signals across multiple temporal scales, this study introduces a multi-granularity sequence partitioning strategy. Let the original multivariate time series be _x_ _∈_ R <sup>_T×C_</sup>, where _T_ denotes the sequence length and _C_ is the number of sensor channels. A set of _n_ patch lengths _{l_ 1, _l_ 2, . . ., _ln}_ is selected. At granularity level _i_, the sequence _x_ is divided into _Ni_ = _T_ / _li_ non-overlapping patches of length _li_, denoted as _Pi_, _j_ _∈_ R <sup>_li×C_</sup>, _j_ = 1, 2, . . ., _Ni_ . This multigranularity partitioning strategy enables the model to simultaneously capture fine-grained local dynamics (e.g., short-term transients) and coarse-grained global trends. It provides a _Sensors_ 2025, _25_, 5138 6 of 22 rich and structured representation foundation for subsequent image transformation and deep feature extraction, thereby significantly enhancing the model’s temporal perception across multiple granularities in fault diagnosis. Output Classifier L× FFN Layer Norm MGSA Layer Norm C Multi-Granularity Feature Aggregation Encoder Multi-Granularity P2I Embedding Multichannel time-series vibration signals T Figure 2. The overall architecture of the proposed P2IFormer model. The input consists of multichannel vibration signal sequences collected from axle-box bearings. These signals are first processed by the Multi-Granularity P2I Embedding module, which splits the time series into patch sequences at multiple granularities and transforms them into image representations. The resulting embeddings are passed through a stack of encoder layers, each consisting of layer normalization, Multi-Granularity Self-Attention (MGSA), and a feed-forward network (FFN) with residual connections. The outputs from different granularities are integrated via the Multi-Granularity Information Aggregation module. Finally, the fused features are classified into fault categories using a softmax classifier. Multi-Granularity Patch Splitting T C N1=3 N2=5 Granularity1 Granularity2 Granularity3 x <sup>(n)</sup> x <sup>(1)</sup> x <sup>(2)</sup> Nn=7 Figure 3. Illustration of the multi-granularity patch-to-image (P2I) embedding process. 3.3.2. Patch-to-Image Embedding To enhance the ability to learn local fault-sensitive features under multiple temporal scales, each patch at granularity level _i_ is processed through the Patch-to-Image Embedding (P2I) module, as illustrated in Figure 4a. This module consists of three main stages: image transformation, deep feature extraction, and token generation. Ultimately, it produces a _d_ -dimensional embedding vector for each patch. _Sensors_ 2025, _25_, 5138 7 of 22 Figure 4. The architecture of the Patch-to-Image (P2I) Embedding module. Subfigure ( a ) illustrates the P2I embedding process at a granularity level where the time series is split into 3 non-overlapping patches, where each time-series patch is first transformed into a Gramian Angular Field (GAF) image. These images are then processed through a convolutional backbone combined with the Local Feature Embedded Global Feature Extraction Module (LEGM) module to extract deep semantic features. A projection layer finally outputs the embedding token for each patch. Subfigure ( b ) shows the GAF transformation procedure, encoding temporal dependencies via polar coordinate mapping. Subfigure ( c ) depicts the structure of the LEGM module, which jointly captures local spatial patterns and long-range dependencies through the integration of convolution and self-attention mechanisms. First, each patch _Pi_, _j_ _∈_ R <sup>_li×C_</sup>, where _li_ denotes the patch length and _C_ is the number of sensor channels, is converted into a 2D image using the Gramian Angular Field (GAF) technique [42], shown in Figure 4b. This method transforms the 1D time-domain subsequence into a 2D structured representation that captures temporal dependencies and dynamics. The GAF generation process includes the following steps: - Step 1: Normalization. Each channel-wise sequence _{xk}_ <sup>_l_</sup> _k_ <sup>_i_</sup> =1 <sup>is</sup> <sup>normalized</sup> <sup>to</sup> <sup>the</sup> range [ _−_ 1, 1] using min–max scaling: 2 _xk −_ min <sup>_l_</sup> _k_ <sup>_i_</sup> _x_ - _k_ = max <sup>_li_</sup> <sup>_l_</sup> _k_ <sup>_i_</sup> =1 <sup>_xk_</sup> <sup>_l_</sup> _k_ <sup>_i_</sup> =1 <sup>_xk_</sup> max <sup>_l_</sup> _k_ <sup>_i_</sup> <sup>_l_</sup> _k_ <sup>_i_</sup> =1 <sup>_xk −_</sup> <sup>min</sup> <sup>_l_</sup> _k_ <sup>_i_</sup> _−_ 1 (1) - Step 2: Polar coordinate mapping. Each normalized data point _x_ - _k_ is mapped to a point in the polar coordinate system. _ϕk_ = arccos( _x_ - _k_ ), _rk_ = <sup>_<u>k</u>_</sup> _li_ (2) where _ϕk_ and _rk_ represent the angular coordinate and radial coordinate in the polar space, respectively. _Sensors_ 2025, _25_, 5138 8 of 22 - Step 3: GAF image generation. The Gram Angular Summation Field (GASF) and Gram Angular Difference Field (GADF) are defined as GASF _i_, _j_ = cos( _ϕi_ + _ϕj_ ), GADF _i_, _j_ = sin( _ϕi −_ _ϕj_ ) (3) where _i_, _j_ _∈{_ 1, 2, . . ., _li}_ denote the row and column indices in the resulting GAF image and _ϕi_ and _ϕj_ are the polar angles corresponding to the time-series values at time steps _i_ and _j_, respectively. Each channel undergoes the above process independently, and the resulting _li × li_ GAF images are stacked along the channel dimension, forming a multi-channel image of shape _li × li × C_ . To extract high-level semantic features, the image is first processed by a 3 _×_ 3 convolution followed by a ReLU activation: _F_ = ReLU(Conv3 _×_ 3(GAF( _Pi_, _j_ ))) (4) where _F_ denotes the intermediate feature map. Next, the Local Feature-Embedded Global Feature Extraction Module (LEGM), shown in Figure 4c, is applied to capture both fine-grained local details and long-range dependencies through a hybrid structure combining convolution and self-attention [43]. Given the feature map _F_, three learnable linear transformations are applied to produce the query _Q_, key _K_, and value _V_ : _Q_ = _WqF_, _K_ = _Wk_ _F_, _V_ = _WvF_ (5) where _Wq_, _Wk_, _Wv_ are learnable projection matrices. The attention map _A_ and attentionenhanced feature _Fattn_ are then computed using scaled dot-product attention: _D_ _A_ = softmax - _<u>QK</u>_ <sup>_⊤_</sup> _~~√~~_ , _F_ att = _AV_ (6) where _D_ is the feature dimension. In addition, _V_ is passed through a convolutional layer to emphasize spatial locality, producing _Fconv_, which is fused with the attention output: _F_ fuse = _F_ att + _F_ conv (7) The fused feature map is then passed through a linear layer and added residually to the original convolution-enhanced map, followed by an MLP layer: _F_ ˆ = Linear( _F_ fuse) + _F_, _F_ out = MLP( _F_ <sup>ˆ</sup> ) + _F_ <sup>ˆ</sup> (8) To obtain the final token representation for the patch, _Fout_ is processed by convolution, ReLU activation, global average pooling, and a linear projection: e _i_, _j_ = _Wp ·_ AvgPool(ReLU(Conv3 _×_ 3( _F_ out))) + _bp_, e _i_, _j_ _∈_ R <sup>_d_</sup> (9) where _Wp_ and _bp_ are learnable parameters and e _i_, _j_ is the patch-level token. To enhance the model’s sensitivity to patch ordering and temporal structure, a learnable positional encoding is added. Specifically, each patch position _j_ at granularity level _i_ is associated with a trainable positional vector pos _i_, _j_ _∈_ R <sup>_d_</sup>, which is added to the patch embedding: z _i_, _j_ = e _i_, _j_ + pos _i_, _j_, z _i_, _j_ _∈_ R <sup>_d_</sup> (10) _Sensors_ 2025, _25_, 5138 9 of 22 where z _i_, _j_ denotes the final token embedding for the _j_ -th patch at granularity level _i_ . Finally, the embedding vectors of all patches at granularity level _i_ form a sequence-level embedding: _x_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> = _{_ z _i_,1, z _i_,2, . . ., z _i_, _Ni_ _} ∈_ R <sup>_Ni×d_</sup> (11) where _Ni_ is the number of patches at granularity level _i_ and _d_ is the embedding dimension. After converting all patches into embeddings at their respective granularities, the original multivariate time series is represented as a set of granularity-specific embeddings. _3.4._ _Multi-Granularity Self Attention_ To effectively model both intra- and inter-granularity contextual dependencies, a multigranularity self-attention module is introduced. This module consists of two sequential stages: intra-granularity self-attention and inter-granularity self-attention [44]. First, for each of the _n_ granularity levels, a learnable router vector u <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _∈_ R <sup>_d_</sup> is initialized to summarize the global semantic representation at that granularity. These router vectors serve not only as semantic anchors within each granularity but also as bridges for communication across different granularities. For the _i_ -th granularity level with _Ni_ patches, the router vector is initialized as the sum of a trainable global token embedding e <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _∈_ R <sup>_d_</sup> and a learnable positional encoding pos <sup>(</sup> _N_ <sup>_i_</sup> <sup>)</sup> _i_ +1 <sup>_∈_</sup> <sup>R</sup> <sup>_d_</sup> <sup>at the position</sup> <sup>_Ni_</sup> <sup>+ 1, formulated as</sup> u <sup>(</sup> <sup>_i_</sup> <sup>)</sup> = e <sup>(</sup> <sup>_i_</sup> <sup>)</sup> + pos <sup>(</sup> _N_ <sup>_i_</sup> <sup>)</sup> _i_ +1 <sup>,</sup> u <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _∈_ R <sup>_d_</sup> (12) 3.4.1. Intra-Granularity Self-Attention At each granularity level _i_, the patch embedding sequence x <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _∈_ R <sup>_Ni×d_</sup> is concatenated vertically with its corresponding router vector u <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _∈_ R <sup>1</sup> <sup>_×d_</sup> to form the extended sequence (13) �x <sup>(</sup> <sup>_i_</sup> <sup>)</sup> = [x <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _|_ u <sup>(</sup> <sup>_i_</sup> <sup>)</sup> ] _∈_ R <sup>(</sup> <sup>_Ni_</sup> <sup>+1)</sup> <sup>_×d_</sup> where the symbol [ _·_ _|_ _·_ ] denotes concatenation along the row dimension and the router vector is added as an additional token after the patch embeddings. Next, standard multihead self-attention is applied: _Q_ = �x <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _WQ_, _K_ = �x <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _WK_, _V_ = �x <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _WV_ (14) _V_ _∈_ R <sup>(</sup> <sup>_Ni_</sup> <sup>+1)</sup> <sup>_×d_</sup> (15) Attnintra(�x <sup>(</sup> <sup>_i_</sup> <sup>)</sup> ) = softmax - _<u>QK</u>_ <sup>_⊤_</sup> _~~√~~_ _d_ Here, _Q_, _K_, _V_ _∈_ R <sup>(</sup> <sup>_Ni_</sup> <sup>+1)</sup> <sup>_×d_</sup> are the query, key, and value matrices and _WQ_, _WK_, _WV_ are trainable linear projection weights. This intra-granularity attention focuses on learning temporal dependencies within each individual granularity level. 3.4.2. Inter-Granularity Self-Attention After intra-granularity self-attention is completed for all levels, the updated router vectors ˆu <sup>(1)</sup>, ˆu <sup>(2)</sup>, . . ., ˆu <sup>(</sup> <sup>_n_</sup> <sup>)</sup> each contain global semantic information representative of their respective granularity levels. These router vectors encode the contextual dependencies aggregated from the patch embeddings within their own granularities, effectively summarizing granularity-specific features. To enable cross-granularity interaction, all updated router vectors are concatenated to form the cross-granularity router matrix _∈_ R <sup>_n×d_</sup> (16) ���ˆu( _n_ )� _U_ = �ˆu <sup>(1)��</sup> �ˆu <sup>(2) ��</sup> - _· · ·_ _Sensors_ 2025, _25_, 5138 10 of 22 Next, standard multi-head self-attention is applied over the router sequence to model inter-granularity semantic dependencies: _Q_ <sup>_′_</sup> <sup>,</sup> _K_ <sup>_′_</sup> = _UWK_ <sup>_′_</sup> _Q_ <sup>_′_</sup> = _UW_ <sup>_′_</sup> _K_ <sup>_′_</sup> <sup>,</sup> _V_ <sup>_′_</sup> = _UWV_ <sup>_′_</sup> _V_ <sup>_′_</sup> (17) _V_ <sup>_′_</sup> _∈_ R <sup>_n×d_</sup> (18) _d_ Attninter( _U_ ) = softmax - _<u>Q</u>_ <sup>_′_</sup> _<u>K</u>_ <sup>_′⊤_</sup> _~~√~~_ _Q_ <sup>_′_</sup> <sup>,</sup> <sup>_W_</sup> _K_ <sup>_′_</sup> _V_ <sup>_′_</sup> <sup>are learnable projection matrices.</sup> where _W_ <sup>_′_</sup> _K_ <sup>_′_</sup> <sup>, and</sup> <sup>_W_</sup> _V_ <sup>_′_</sup> _3.5._ _Multi-Granularity Feature Aggregation_ After processing through the encoder with multi-granularity self-attention, each updated router vector ˆu <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _∈_ R <sup>_d_</sup> encodes both intra- and inter-granularity semantic information specific to granularity level _i_ . To integrate global representations from all _n_ granularities, we concatenate these router vectors along the feature dimension to form a single high-dimensional fused vector: _∈_ R <sup>_n·d_</sup> (19) ucat = concat �ˆu <sup>(1)</sup>, ˆu <sup>(2)</sup>, . . ., ˆu <sup>(</sup> <sup>_n_</sup> <sup>)�</sup> Here, concat( _·_ ) denotes the concatenation operation along the feature axis. Subsequently, the fused vector is projected to a target dimension _d_ <sup>_′_</sup> via a fully connected layer followed by a GeLU activation function: h = GeLU(W _f_ ucat + b _f_ ), W _f_ _∈_ R <sup>_d′×_</sup> <sup>(</sup> <sup>_n·d_</sup> <sup>)</sup>, b _f_ _∈_ R <sup>_d′_</sup> (20) where W _f_ and b _f_ are the learnable parameters of the projection layer. The output h _∈_ R <sup>_d′_</sup> serves as the final fused representation, integrating semantic features from all granularities. This information-rich vector is then used as the input to the classifier for fault type prediction. _3.6._ _Classifier_ After multi-granularity feature aggregation, a unified representation vector h _∈_ R <sup>_d′_</sup> is obtained, encapsulating both global and cross-granularity semantic information. In the classification stage, this vector is fed into a simple yet effective discriminator to predict the fault category. Specifically, for a classification task with _M_ fault types, the vector _h_ is passed through a classifier composed of a fully connected layer followed by a softmax activation to produce the class probability distribution ˆy = Softmax(Wh + b) _∈_ R <sup>_M_</sup> (21) where W _∈_ R <sup>_M×d′_</sup> and b _∈_ R <sup>_M_</sup> are learnable parameters. The output ˆy = [ ˆ _y_ 1, _y_ ˆ2, . . ., _y_ ˆ _M_ ] represents the predicted probability for each fault class. During training, the model is optimized using the cross-entropy loss to measure the discrepancy between the predicted probability distribution ˆy and and the ground truth label _y_ . 4. Experiments and Results _4.1._ _Dataset Description_ The dataset used in this study was collected from an experimental platform simulating the axle-box bearings of high-speed trains, specifically using the HRB352213 bearing model. It includes one healthy state and four typical fault types: inner race fault, outer race fault, rolling element fault, and combination fault. Vibration signals were acquired using a _Sensors_ 2025, _25_, 5138 11 of 22 triaxial accelerometer mounted on one side of the bearing, capturing three-channel data that comprehensively reflect the dynamic characteristics of the bearing. A photograph of the experimental platform is shown in Figure 5. During the experiments, the bearings were operated under four constant-speed conditions (20 Hz, 40 Hz, 60 Hz, and 80 Hz) and one variable-speed condition. In the variable-speed scenario, the rotation speed follows a triangular waveform: it increases linearly from 0 Hz to 40 Hz and then decreases linearly back to 0 Hz, with the entire cycle lasting approximately 2 s and peaking at 1 s. This speed variation simulates the actual acceleration and deceleration processes of high-speed trains, enabling the evaluation of the model’s robustness under dynamic operating conditions. The vibration signals were sampled at a frequency of 25.6 kHz, and each sample has a duration of 10 s, ensuring sufficient resolution for capturing fault-related features. Rolling Element Fault Inner Race Fault Accelerometer Figure 5. Axle-box bearing experimental platform. _4.2._ _Experimental Setup_ Outer Race Fault In this study, the collected vibration signals were segmented into training samples using a sliding window technique with a window size of 256 and a step size of 64. As a result, 4093 samples were generated for each fault category, yielding a total of 20,465 samples for model training, validation, and testing. Each vibration signal sample was segmented into three granularity levels using predefined patch lengths of 85, 51, and 36, respectively. At each level, the sample was divided into non-overlapping patches of the corresponding length. These patches were subsequently transformed into Gramian Angular Field (GAF) images, with the resulting image size equal to the respective patch length (i.e., 85 _×_ 85, 51 _×_ 51, and 36 _×_ 36 for each granularity level). Figure 6 illustrates example vibration signal samples for each fault category at the 80 Hz rotational speed, along with their corresponding GADF images at the patch length of 85. The entire dataset was divided into training, validation, and test sets in a 60%:20%:20% ratio. The overall performance and stability of the proposed model are influenced by various architectural and hyperparameter settings, such as the embedding dimension and the number of attention heads. The detailed network configuration and hyperparameter values adopted in this study are summarized in Table 1. To comprehensively evaluate the robustness and generalization capability of the proposed P2IFormer model under varying operating conditions, extensive experiments were conducted across four constant-speed scenarios (20 Hz, 40 Hz, 60 Hz, and 80 Hz), as well as one variable-speed condition. Several representative baseline models were selected for comparison, including CNN-LSTM [45], WDCNN [46], DenseNet [36], ResNet [47], Vision Transformer (ViT) [48], and ECMCTP [24]. All experiments were implemented using the PyTorch 2.0 deep learning framework in a Python 3.8 environment and executed on a workstation equipped with an NVIDIA RTX 3090 GPU (24 GB memory). _Sensors_ 2025, _25_, 5138 12 of 22 Table 1. Hyperparameter settings of the proposed P2IFormer model. Hyperparameter Value Input sequence shape 256 _×_ 3 Number of granularities _n_ 3 Patch lengths _{l_ 1, _l_ 2, _l_ 3 _}_ _{_ 85, 51, 36 _}_ Embedding dimension _d_ 128 Encoder layers _L_ 2 Attention heads _H_ 4 Dropout rate 0.2 Learning rate 1 _×_ 10 <sup>_−_</sup> <sup>4</sup> Batch size 64 Fusion vector dimension _d_ <sup>_′_</sup> 768 Loss function Cross-Entropy Optimizer AdamW Weight decay 1 _×_ 10 <sup>_−_</sup> <sup>4</sup> Figure 6. Visualization of vibration signal segments for each fault category under the 80 Hz rotational speed condition and their corresponding GADF images (patch length = 85). _Sensors_ 2025, _25_, 5138 13 of 22 To quantitatively assess the performance of the models, average accuracy and F1-score were employed as evaluation metrics. Their definitions are as follows: Accuracy = <sup><u>1</u></sup> _M_ _M_ ## ∑ _i_ =1 <u>TP</u> _<u>i</u>_ <u>+ TN</u> _<u>i</u>_ TP _i_ + TN _i_ + FP _i_ + FN _i_ F1 _i_ = 2 _×_ <sup><u>Precision</u></sup> <sup>_<u>i ×</u>_</sup> <sup><u>Recall</u></sup> <sup>_<u>i</u>_</sup> Precision _i_ + Recall _i_ (22) (23) (24) <u>TP</u> _<u>i</u>_ Precision _i_ = TP _i_ + FP _i_ <u>TP</u> _<u>i</u>_ , Recall _i_ = TP _i_ + FN _i_ Here, TP _i_, TN _i_, FP _i_, and FN _i_ denote the true positives, true negatives, false positives, and false negatives for class _i_, respectively. These metrics effectively reflect classification performance and model generalization, particularly under class-imbalanced multi-class conditions. _4.3._ _Performance Evaluation Under Constant-Speed Conditions_ To evaluate the fault recognition capability of the proposed P2IFormer model under varying operating conditions, the model was independently trained and validated under four constant-speed scenarios: 20 Hz, 40 Hz, 60 Hz, and 80 Hz. During the patch-to-GAF image transformation stage, two Gramian Angular Field encoding methods—Gramian Angular Summation Field (GASF) and Gramian Angular Difference Field (GADF)—were employed to examine their effects on model performance. The corresponding loss and accuracy curves on the validation set are illustrated in Figure 7. As shown in the Figure 7, P2IFormer with GADF encoding consistently exhibits faster convergence and higher final accuracy across all speed conditions. For instance, at 20 Hz (Figure 7a) and 40 Hz (Figure 7b), the GADF-based model achieves rapid convergence within the first 20 epochs and reaches final accuracies of 99.76% and 99.61%, respectively, while the GASF-based model lags slightly behind, with accuracies of 98.65% and 98.97%. Similarly, under the 60 Hz (Figure 7c) and 80 Hz (Figure 7d) conditions, the GADF-based model maintains superior performance, achieving over 99.8% accuracy and demonstrating excellent robustness and stability. These results confirm that GADF encoding more effectively preserves local temporal variations and enhances the discriminative representation of fault patterns, enabling P2IFormer to achieve consistently high diagnostic accuracy across varying rotational speeds. The superiority of GADF over GASF lies in its distinct mathematical formulation and its capacity to capture critical temporal dynamics. Specifically, the GADF matrix is constructed based on angular differences ( _ϕi −_ _ϕj_ ), resulting in an anti-symmetric structure ( _GADFi_, _j_ = _−GADFj_, _i_ ) that encodes directional information and intuitively reflects upward or downward trends within the sequence. Moreover, its diagonal elements are always zero, eliminating redundant self-correlations and yielding a more compact and efficient representation. In contrast, GASF relies on angular summation ( _ϕi_ + _ϕj_ ), producing a symmetric matrix ( _GASFi_, _j_ = _GASFj_, _i_ ) that lacks directional sensitivity. Additionally, its non-zero diagonal elements retain self-correlations, which may introduce irrelevant redundancy in classification tasks. Consequently, GADF facilitates faster model convergence and improves classification performance during training. Therefore, GADF was selected as the default encoding method for subsequent comparative experiments against baseline models such as DenseNet, ResNet, ViT, and the proposed P2IFormer. The final evaluation results are summarized in Table 2. _Sensors_ 2025, _25_, 5138 14 of 22 - 0.9976 0.9865 ( a ) <u>0.9989</u> - 0.9943 ( c ) 0.9961 - 0.9897 ( b ) 0.9990 - 0.9921 ( d ) Model Figure 7. Validation loss and accuracy curves of the P2IFormer model under four constant-speed conditions using GASF and GADF encodings: ( a ) 20 Hz, ( b ) 40 Hz, ( c ) 60 Hz, and ( d ) 80 Hz. Table 2. Comparison of fault diagnosis performance across different models under four constantspeed conditions. Accuracy and F1-score are expressed as percentages (%). 20 Hz 40 Hz 60 Hz 80 Hz Params Time/Epoch Acc F1 Acc F1 Acc F1 Acc F1 (M) (s) WDCNN 91.29 90.94 98.78 98.77 99.45 99.45 99.56 99.56 0.029 3 CNN-LSTM 90.99 90.95 97.51 97.50 99.27 99.27 99.67 99.67 0.093 5 DenseNet 97.84 97.82 99.29 99.28 99.80 99.80 99.98 99.98 6.959 81 ResNet 92.93 92.90 99.39 99.38 99.28 99.28 99.40 99.40 42.510 66 ViT 95.12 95.10 99.12 99.11 99.42 99.42 99.38 99.38 85.801 140 ECMCTP 96.38 96.36 99.41 99.40 99.52 99.52 99.96 99.96 0.781 25 P2IFormer 99.76 99.76 99.61 99.61 99.89 99.89 99.90 99.90 17.143 43 As shown in Table 2, the proposed P2IFormer achieves the highest accuracy and F1-score under the 20 Hz, 40 Hz, and 60 Hz speed conditions, demonstrating superior fault classification performance. At the 80 Hz high-speed condition, the DenseNet model slightly outperforms P2IFormer, yielding the best results. Overall, the performance advantage of P2IFormer becomes more evident as the rotational speed decreases, indicating stronger robustness and generalization capability under low-speed scenarios. In terms of model complexity, P2IFormer contains 17.14 million parameters, which is significantly higher than lightweight models such as WDCNN (0.029 M), CNN-LSTM _Sensors_ 2025, _25_, 5138 15 of 22 (0.093 M), and ECMCTP (0.781 M), but remains much smaller than large-scale models like ResNet (42.51 M) and ViT (85.80 M). Although the training time per epoch (43 s) is moderately higher compared to lightweight models, P2IFormer maintains a reasonable computational cost, making it feasible for deployment in environments with sufficient computational resources. The confusion matrices under different speed conditions, as shown in Figure 8, further validate the stability and effectiveness of P2IFormer in multi-class fault diagnosis tasks. Rolling Element Combination Health Inner Race Outer Race Rolling Element Combination Health Inner Race Outer Race 0.993 0.000 0.001 0.002 0.005 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.999 0.001 0.000 0.001 0.002 0.000 0.998 0.000 0.002 0.000 0.000 0.000 0.998 Rolling Element Combination Health Inner Race Outer Race Predicted Label ( a ) 0.994 0.002 0.002 0.000 0.002 0.000 1.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 1.000 Rolling Element Combination Health Inner Race Outer Race Predicted Label ( c ) Rolling Element Combination Health Inner Race Outer Race Rolling Element Combination Health Inner Race Outer Race 0.987 0.000 0.008 0.004 0.001 0.000 0.999 0.000 0.001 0.000 0.001 0.000 0.999 0.000 0.000 0.002 0.001 0.000 0.998 0.000 0.002 0.000 0.000 0.000 0.998 Rolling Element Combination Health Inner Race Outer Race Predicted Label ( b ) 0.999 0.000 0.000 0.000 0.001 0.000 0.999 0.000 0.000 0.001 0.003 0.000 0.997 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 1.000 Rolling Element Combination Health Inner Race Outer Race Predicted Label ( d ) Figure 8. Confusion matrices of the P2IFormer model under constant-speed conditions: ( a ) 20 Hz, ( b ) 40 Hz, ( c ) 60 Hz, and ( d ) 80 Hz. _4.4._ _Performance Evaluation Under the Variable-Speed Condition_ Similar to the experiments conducted under constant-speed conditions, the performance of the proposed model was further evaluated under a variable-speed scenario. As shown in Figure 9, the validation loss and accuracy curves demonstrate the model’s effectiveness in handling non-stationary signals caused by speed variations. Compared to constant-speed settings, variable-speed conditions better reflect real-world operating environments, posing greater challenges to the model’s robustness and generalization capability. The results show that the model maintains strong convergence and diagnostic performance _Sensors_ 2025, _25_, 5138 16 of 22 under these complex conditions. Notably, when using the GADF encoding, the model achieves faster convergence and higher accuracy, reaching 99.64% on the validation set, compared to 98.58% with GASF encoding. 0.9964 - 0.9964 0.9858 Figure 9. Validation loss and accuracy curves of P2IFormer using GASF and GADF encodings under the variable-speed condition. The fault diagnosis performance of different models under the variable-speed condition is compared in Figure 10. As shown, the CNN-LSTM model performs the worst, achieving only 86.17% accuracy and an F1-score of 86.06%. This indicates its limited robustness in handling the the non-stationary characteristics of vibration signals caused by varying speed. In contrast, the proposed P2IFormer achieves the best performance, with both accuracy and F1-score reaching 99.64%. This demonstrates its superior capability in modeling temporal dependencies and integrating multi-granularity features, making it more adaptive to complex operating conditions. ResNet, ViT, and DenseNet also achieve relatively high accuracy and F1-scores. Among them, DenseNet reaches 98.40% accuracy, slightly outperforming the other two models, though still exhibiting a performance gap compared to P2IFormer. WDCNN performs moderately well but falls short of ResNet and ViT, particularly in handling non-stationary input sequences. The confusion matrix results on the test set are illustrated in Figure 11. 99.64 100 90 80 70 97.84 98.41 97.84 99.64 97.43 97.42 98.40 94.31 94.31 94.6294.60 86.17 86.06 60 WDCNN CNN-LSTM DenseNet ResNet ViT ECMCTP P2IFormer Accuracy F1-Score Figure 10. Comparison of accuracy and F1-score for different models under variable-speed conditions. _Sensors_ 2025, _25_, 5138 17 of 22 Rolling Element Combination Health Inner Race Outer Race 0.991 0.000 0.002 0.000 0.007 0.000 0.999 0.001 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.001 0.007 0.992 0.000 0.000 0.000 0.000 0.000 1.000 Rolling Element Combination Health Inner Race Outer Race Predicted Label Figure 11. Confusion matrix of the proposed P2IFormer under the variable-speed condition. _4.5._ _Ablation Study_ To evaluate the contribution of each core component in the proposed P2IFormer model, a series of ablation experiments were conducted. The corresponding results are illustrated in Figure 12 and Table 3. As shown in Figure 12, to validate the effectiveness of the Patch-to-Image Embedding module, we replaced it with a traditional patch embedding method, where each patch is directly projected into a high-dimensional vector using a multilayer perceptron (MLP). The results show that this substitution leads to a significant drop in accuracy under all speed conditions, with reductions of 5.88% and 12.37% observed in the 20 Hz and variable-speed scenarios, respectively. This demonstrates the advantage of image-based embedding in capturing spatiotemporal structures from raw sequences. Additionally, we investigated the impact of the Local Feature-Embedded Global Feature Extraction Module (LEGM) by removing it while preserving the patch-to-image embedding framework. In this setting, standard convolutional layers were used for feature extraction. Performance declined in all cases, indicating that LEGM contributes meaningfully by integrating local and global information. 99.32 99.26 100 95 90 85 99.76 99.61 99.89 99.41 99.26 99.90 99.62 99.32 99.64 20 Hz 40 Hz 60 Hz 80 Hz Variable-Speed Speed Full Model (w/o) Patch to Image Embedding (w/o) LEGM 99.62 99.41 99.05 0.58 97.22 2.42 87.27 12.37 0.63 0.28 0.48 98.46 1.15 0.56 93.88 5.88 96.56 3.20 Figure 12. Ablation study results on the effectiveness of the patch-to-image embedding and LEGM. _Sensors_ 2025, _25_, 5138 18 of 22 To evaluate the effectiveness of the multi-granularity strategy, we designed three single-granularity variants with the number of patches per sample set to 3, 5, and 7, respectively. These models retain the core architecture but use standard self-attention for feature learning. As shown in Table 3, all single-granularity models underperform the full model, especially under the variable-speed and low-speed (20 Hz) settings. This demonstrates that the multi-granularity approach enhances the model’s ability to capture diverse temporal patterns and improves robustness under non-stationary conditions. Table 3. Performance of single-granularity variants and accuracy drop compared to the full multigranularity model. Model 20 Hz 40 Hz 60 Hz 80 Hz Variable Speed P2I-MG (multi) 99.76 99.61 99.89 99.90 99.64 96.93 98.70 98.88 98.90 97.41 P2I-3 (single) _↓_ _2.83_ _↓_ _0.91_ _↓_ _1.01_ _↓_ _1.00_ _↓_ _2.23_ 96.87 98.39 99.02 99.09 97.87 P2I-5 (single) _↓_ _2.89_ _↓_ _1.22_ _↓_ _0.87_ _↓_ _0.81_ _↓_ _1.77_ 97.48 98.25 99.04 99.18 97.23 P2I-7 (single) _↓_ _2.28_ _↓_ _1.36_ _↓_ _0.85_ _↓_ _0.72_ _↓_ _2.41_ _4.6._ _Robustness Evaluation Under Noisy Conditions_ To further validate the robustness and practical applicability of the proposed model in real-world industrial environments, we conducted a comparative analysis of fault diagnosis performance across multiple baseline models under different noise levels. Specifically, Gaussian white noise with varying intensities was added to the original vibration signals to simulate five distinct signal-to-noise ratio (SNR) conditions: _−_ 6 dB, _−_ 3 dB, 0 dB, 3 dB, and 6 dB. This setup aims to replicate the typical background interference encountered in real applications. The SNR is defined as SNRdB = 10 log10 - _P_ <u>signal</u> _P_ noise (25) where _P_ signal and _P_ noise represent the power of the signal and noise, respectively. Under each SNR condition, the classification accuracy of all models was evaluated across five speed scenarios: 20 Hz, 40 Hz, 60 Hz, 80 Hz, and variable speed. As shown in Table 4, the proposed P2IFormer consistently achieved superior performance across most speed and noise settings, demonstrating excellent robustness against noise. Notably, under the low-speed (20 Hz) and variable-speed conditions, P2IFormer outperformed all other models by a significant margin, achieving 90.26% and 90.23% accuracy at _−_ 6 dB, respectively. Under the 80 Hz condition, ECMCTP achieves the highest accuracy across all noise levels. The DenseNet-based model also shows relatively stable performance across different conditions, ranking second only to P2IFormer in overall average accuracy. Table 4. Classification accuracy (%) under different SNR levels grouped by noise level. SNR (dB) Model 20 Hz 40 Hz 60 Hz 80 Hz Variable-Speed _−_ 6 WDCNN 57.46 63.75 77.19 76.44 50.35 CNN-LSTM 60.12 65.20 80.19 79.88 51.62 DenseNet 88.24 94.15 98.53 99.43 87.41 ResNet 86.51 94.59 94.40 98.45 86.98 ViT 77.18 90.14 91.69 92.05 76.93 ECMCTP 78.97 92.39 98.47 99.61 79.52 P2IFormer 90.26 97.46 98.58 97.76 90.23 _Sensors_ 2025, _25_, 5138 19 of 22 Table 4. _Cont._ SNR (dB) Model 20 Hz 40 Hz 60 Hz 80 Hz Variable-Speed _−_ 3 0 3 6 WDCNN 58.75 65.82 78.09 79.10 52.50 CNN-LSTM 62.38 71.19 83.27 85.97 55.23 DenseNet 90.28 97.70 98.70 98.57 88.70 ResNet 89.02 96.35 90.29 98.39 88.79 ViT 79.35 92.93 93.47 94.02 82.60 ECMCTP 81.98 92.85 97.87 99.69 81.10 P2IFormer 91.51 97.26 98.80 97.73 91.91 WDCNN 61.80 75.27 87.21 87.50 59.86 CNN-LSTM 65.71 78.74 88.28 91.04 61.47 DenseNet 90.89 98.57 99.10 99.21 91.77 ResNet 90.29 96.19 98.03 98.75 90.45 ViT 82.26 94.61 94.28 96.29 84.28 ECMCTP 84.18 94.20 99.06 99.90 84.57 P2IFormer 92.64 98.78 99.10 98.60 93.71 WDCNN 69.14 84.91 92.36 94.80 65.82 CNN-LSTM 70.54 86.62 91.62 95.79 65.12 DenseNet 91.81 98.78 99.32 99.36 93.27 ResNet 90.79 98.06 99.02 99.09 92.90 ViT 83.48 95.65 97.00 97.07 85.94 ECMCTP 85.08 96.07 98.99 99.93 85.60 P2IFormer 93.91 99.06 99.10 99.15 95.32 WDCNN 75.22 87.05 96.56 97.93 72.34 CNN-LSTM 76.91 91.17 96.77 98.72 73.70 DenseNet 94.07 99.10 99.84 99.65 94.20 ResNet 91.73 99.30 99.24 99.25 93.16 ViT 84.70 96.87 97.88 97.95 87.88 ECMCTP 89.41 97.18 99.27 99.95 88.81 P2IFormer 95.51 99.28 99.32 99.23 95.48 _4.7._ _Discussion_ The experimental results indicate that, except for the 80 Hz condition where the DenseNet-based model with GADF encoding achieved comparable performance, P2IFormer consistently outperforms all baseline models in terms of accuracy and F1score under the remaining constant-speed conditions, demonstrating remarkable stability and strong discriminative capability. Notably, its performance advantage is more pronounced under the low-speed (20 Hz) and variable-speed scenarios. This superiority is primarily attributed to the proposed innovative model architecture. On the one hand, the multi-granularity patching strategy, combined with time-series-to-image conversion using GAF encoding, enables the model to capture both local dynamics and global trends across multiple temporal granularities, thereby enriching the diversity and expressiveness of feature representations. On the other hand, the incorporation of a multi-granularity self-attention mechanism effectively models both intra- and inter-granularity contextual dependencies, further enhancing the integration of semantic information. The ablation study confirms that the Patch-to-Image Embedding module, Local Feature-Embedded Global Feature Extraction Module (LEGM), and the multi-granularity strategy all contribute positively to the final performance, validating the rationality of the proposed architectural design. Furthermore, in the robustness evaluation under varying noise levels (SNR = _−_ 6 dB to 6 dB), P2IFormer consistently maintained high diagnostic accuracy across all rotational speeds. Its performance remained stable even under low-SNR and variable-speed conditions, highlighting its strong noise resistance and adaptability to complex environments. _Sensors_ 2025, _25_, 5138 20 of 22 In terms of model complexity and computational cost, P2IFormer comprises 17.14 million parameters, which is substantially lower than ViT (85.80 M) and ResNet (42.51 M), but significantly higher than lightweight models such as WDCNN (0.029 M), CNN-LSTM (0.093 M), and ECMCTP (0.781 M). Moreover, P2IFormer also incurs a higher per-epoch training time compared to these lightweight baselines, indicating a greater demand for computational resources. 5. Conclusions This paper proposes a deep learning model named P2IFormer, which is designed to address the limitations of existing fault diagnosis methods for high-speed train axle-box bearings in multi-scale modeling and temporal feature extraction. The proposed model first segments the raw vibration signals using multiple window lengths, generating patch sequences at various granularities to enable structured modeling across different temporal scales. Each patch is then transformed into a corresponding Gramian Angular Field (GAF) image, enhancing the representation of local temporal features. A Local Feature-Embedded Global Feature Extraction module is subsequently applied to extract deep semantic features and generate token embedding at each granularity. Furthermore, a multi-granularity self-attention mechanism is employed to capture both intra- and inter-granularity semantic dependencies, effectively integrating fault information across granularities and improving the model’s capability to distinguish complex fault patterns. Experimental results demonstrate that P2IFormer achieves fault diagnosis accuracy exceeding 99.5% under four constant-speed conditions and one variable-speed condition, significantly outperforming mainstream Transformer- and CNN-based models. These results validate the model’s strong robustness and generalization capability across diverse operating scenarios. Furthermore, ablation and noise robustness experiments confirm the effectiveness of the model’s key components and its resilience to noise interference. Nevertheless, P2IFormer exhibits a larger parameter size and longer training time compared to lightweight models such as WDCNN and ECMCTP, indicating higher computational requirements. Future research will focus on lightweight model design to reduce computational resource requirements and improve deployment efficiency. Additionally, efforts will be directed toward developing improved strategies for handling scenarios with limited fault samples and imbalanced datasets, aiming to enhance the model’s adaptability and robustness in real-world industrial applications. Author Contributions: Conceptualization, W.M.; methodology, W.M.; validation, Z.W.; formal analysis, X.F.; investigation, L.C.; writing—original draft preparation, C.Z.; writing—review and editing, C.Z.; visualization, L.C.; supervision, Y.C. All authors have read and agreed to the published version of the manuscript. Funding: This research received no external funding. Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: The raw data supporting the conclusions of this article will be made available by the authors upon request. Acknowledgments: During the preparation of this manuscript, the authors used ChatGPT (OpenAI, GPT-4) to improve the clarity and fluency of English expressions. All outputs were carefully reviewed and edited by the authors, who take full responsibility for the final content of the paper. Conflicts of Interest: The authors declare no conflicts of interest. _Sensors_ 2025, _25_, 5138 21 of 22 References 1. Xie, S.; Tan, H.; Yang, C.; Yan, H. A review of fault diagnosis methods for key systems of the high-speed train. _Appl._ _Sci._ 2023, _13_, 4790. [[CrossRef]](http://doi.org/10.3390/app13084790) 2. Ma, W.; Wang, J.; Zhang, C.; Jia, Q.; Zhu, L.; Ji, W.; Wang, Z. Application of Variational Graph Autoencoder in Traction Control of Energy-Saving Driving for High-Speed Train. _Appl._ _Sci._ 2024, _14_, 2037. [[CrossRef]](http://dx.doi.org/10.3390/app14052037) 3. Wu, J.; Li, Y.; Jia, L.; An, G.; Li, Y.F.; Antoni, J.; Xin, G. Semi-supervised fault diagnosis of wheelset bearings in high-speed trains using autocorrelation and improved flow Gaussian mixture model. _Eng._ _Appl._ _Artif._ _Intell._ 2024, _132_, 107861. [[CrossRef]](http://dx.doi.org/10.1016/j.engappai.2024.107861) 4. Zhao, L.; Yang, S.; Liu, Y. Weak fault feature extraction of axle box bearing based on pre-identification and singular value decomposition. _Machines_ 2022, _10_, 1213. [[CrossRef]](http://dx.doi.org/10.3390/machines10121213) 5. Jin, Z.; He, D.; Wei, Z. Intelligent fault diagnosis of train axle box bearing based on parameter optimization VMD and improved DBN. _Eng._ _Appl._ _Artif._ _Intell._ 2022, _110_, 104713. [[CrossRef]](http://dx.doi.org/10.1016/j.engappai.2022.104713) 6. Hu, W.; Xin, G.; Wu, J.; An, G.; Li, Y.; Feng, K.; Antoni, J. Vibration-based bearing fault diagnosis of high-speed trains: A literature review. _High-Speed Railw._ 2023, _1_, 219–223. [[CrossRef]](http://dx.doi.org/10.1016/j.hspr.2023.11.001) 7. Yu, M.; Zhang, Y.; Yang, C. Rolling bearing faults identification based on multiscale singular value. _Adv._ _Eng._ _Inform._ 2023, _57_, 102040. [[CrossRef]](http://dx.doi.org/10.1016/j.aei.2023.102040) 8. Yang, Z.; Wu, B.; Shao, J.; Lu, X.; Zhang, L.; Xu, Y.; Chen, G. Fault detection of high-speed train axle bearings based on a hybridized physical and data-driven temperature model. _Mech._ _Syst._ _Signal Process._ 2024, _208_, 111037. [[CrossRef]](http://dx.doi.org/10.1016/j.ymssp.2023.111037) 9. Shaalan, A.A.; Mefteh, W.; Frihida, A.M. Review on deep learning classifiers for faults diagnosis of rotating industrial machinery. _Serv._ _Oriented Comput._ _Appl._ 2024, _18_, 361–379. [[CrossRef]](http://dx.doi.org/10.1007/s11761-024-00418-7) 10. Chen, J.; Huang, R.; Zhao, K.; Wang, W.; Liu, L.; Li, W. Multiscale convolutional neural network with feature alignment for bearing fault diagnosis. _IEEE Trans._ _Instrum._ _Meas._ 2021, _70_, 1–10. [[CrossRef]](http://dx.doi.org/10.1109/TIM.2021.3077673) 11. Sun, H.; Fan, Y. A new bearing fault diagnosis method based on multi-scale CNN and LSTM. In Proceedings of the International Conference on Mechatronics and Intelligent Control (ICMIC 2023), Wuhan, China, 21–23 July 2023; SPIE: Bellingham WA, USA, 2023; Volume 12793, pp. 440–461. 12. Dengfeng, Z.; Chaoyang, T.; Zhijun, F.; Yudong, Z.; Junjian, H.; Wenbin, H. Multi scale convolutional neural network combining BiLSTM and attention mechanism for bearing fault diagnosis under multiple working conditions. _Sci._ _Rep._ 2025, _15_, 13035. [[CrossRef]](http://dx.doi.org/10.1038/s41598-025-96137-w) 13. Hou, Y.; Ma, J.; Wang, J.; Li, T.; Chen, Z. Enhanced generative adversarial networks for bearing imbalanced fault diagnosis of rotating machinery. _Appl._ _Intell._ 2023, _53_, 25201–25215. [[CrossRef]](http://dx.doi.org/10.1007/s10489-023-04870-4) 14. Luo, J.; Zhang, Y.; Yang, F.; Jing, X. Imbalanced data fault diagnosis of rolling bearings using enhanced relative generative adversarial network. _J. Mech._ _Sci._ _Technol._ 2024, _38_, 541–555. [[CrossRef]](http://dx.doi.org/10.1007/s12206-024-0104-2) 15. Zhao, J.; Wang, W.; Huang, J.; Ma, X. A comprehensive review of deep learning-based fault diagnosis approaches for rolling bearings: Advancements and challenges. _AIP Adv._ 2025, _15_, 020702. [[CrossRef]](http://dx.doi.org/10.1063/5.0255451) 16. Hakim, M.; Omran, A.A.B.; Ahmed, A.N.; Al-Waily, M.; Abdellatif, A. A systematic review of rolling bearing fault diagnoses based on deep learning and transfer learning: Taxonomy, overview, application, open challenges, weaknesses and recommendations. _Ain Shams Eng._ _J._ 2023, _14_, 101945. [[CrossRef]](http://dx.doi.org/10.1016/j.asej.2022.101945) 17. Shen, J.; Wu, Z.; Cao, Y.; Zhang, Q.; Cui, Y. Research on Fault Diagnosis of Rolling Bearing Based on Gramian Angular Field and Lightweight Model. _Sensors_ 2024, _24_, 5952. [[CrossRef]](http://dx.doi.org/10.3390/s24185952) 18. Bai, R.; Wang, H.; Sun, W.; Shi, Y. Fault diagnosis method for rotating machinery based on SEDenseNet and Gramian Angular Field. _Maint._ _Reliab._ _I Niezawodn._ 2024, _26_, 191445. [[CrossRef]](http://dx.doi.org/10.17531/ein/191445) 19. Yu, P.; Li, R.b.; Cao, J.; Qin, J.h. Bearing fault diagnosis method for unbalance data based on Gramian angular field. _J. Intell._ _Fuzzy_ _Syst._ 2024, _47_, 45–54. [[CrossRef]](http://dx.doi.org/10.3233/JIFS-233797) 20. Tong, A.; Zhang, J.; Xie, L. Intelligent fault diagnosis of rolling bearing based on Gramian angular difference field and improved dual attention residual network. _Sensors_ 2024, _24_, 2156. [[CrossRef]](http://dx.doi.org/10.3390/s24072156) 21. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. _Adv._ _Neural Inf._ _Process._ _Syst._ 2017, _30,_ . [[CrossRef]](http://dx.doi.org/10.48550/arXiv.1706.03762) 22. Wang, R.; Dong, E.; Cheng, Z.; Liu, Z.; Jia, X. Transformer-based intelligent fault diagnosis methods of mechanical equipment: A survey. _Open Phys._ 2024, _22_, 20240015. [[CrossRef]](http://dx.doi.org/10.1515/phys-2024-0015) 23. Hou, Y.; Wang, J.; Chen, Z.; Ma, J.; Li, T. Diagnosisformer: An efficient rolling bearing fault diagnosis method based on improved Transformer. _Eng._ _Appl._ _Artif._ _Intell._ 2023, _124_, 106507. [[CrossRef]](http://dx.doi.org/10.1016/j.engappai.2023.106507) 24. Chen, Q.; Zhang, F.; Wang, Y.; Yu, Q.; Lang, G.; Zeng, L. Bearing fault diagnosis based on efficient cross space multiscale CNN transformer parallelism. _Sci._ _Rep._ 2025, _15_, 12344. [[CrossRef]](http://dx.doi.org/10.1038/s41598-025-95895-x) 25. Han, Y.; Zhang, F.; Li, Z.; Wang, Q.; Li, C.; Lai, P.; Li, T.; Teng, F.; Jin, Z. Mt-ConvFormer: A multi-task bearing fault diagnosis method using a combination of CNN and transformer. _IEEE Trans._ _Instrum._ _Meas._ 2024, _74_, 3501816. [[CrossRef]](http://dx.doi.org/10.1109/TIM.2024.3502821) _Sensors_ 2025, _25_, 5138 22 of 22 26. Lv, J.; Xiao, Q.; Zhai, X.; Shi, W. A high-performance rolling bearing fault diagnosis method based on adaptive feature mode decomposition and Transformer. _Appl._ _Acoust._ 2024, _224_, 110156. [[CrossRef]](http://dx.doi.org/10.1016/j.apacoust.2024.110156) 27. Chen, F.; Wang, X.; Zhu, Y.; Yuan, W.; Hu, Y. Time–frequency Transformer with shifted windows for journal bearing-rotor systems fault diagnosis under multiple working conditions. _Meas._ _Sci._ _Technol._ 2023, _34_, 085121. [[CrossRef]](http://dx.doi.org/10.1088/1361-6501/acd2f3) 28. Cen, J.; Yang, Z.; Wu, Y.; Hu, X.; Jiang, L.; Chen, H.; Si, W. A mask self-supervised learning-based transformer for bearing fault diagnosis with limited labeled samples. _IEEE Sens._ _J._ 2023, _23_, 10359–10369. [[CrossRef]](http://dx.doi.org/10.1109/JSEN.2023.3264853) 29. Fang, X.; Deng, X.; Chen, J.; Liu, M.; Fu, Y.; Huang, G.; Zhou, C. Convolution Transformer Based Fault Diagnosis Method For Aircraft Engine Bearings. In Proceedings of the 2024 43rd Chinese Control Conference (CCC), Kunming, China, 28–31 July 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 5038–5042. 30. Liu, W.; Zhang, Z.; Zhang, J.; Huang, H.; Zhang, G.; Peng, M. A novel fault diagnosis method of rolling bearings combining convolutional neural network and transformer. _Electronics_ 2023, _12_, 1838. [[CrossRef]](http://dx.doi.org/10.3390/electronics12081838) 31. Zhang, S.; Zhang, S.; Wang, B.; Habetler, T.G. Deep learning algorithms for bearing fault diagnostics—A comprehensive review. _IEEE Access_ 2020, _8_, 29857–29881. [[CrossRef]](http://dx.doi.org/10.1109/ACCESS.2020.2972859) 32. Zhang, M. Multi-resolution short-time Fourier transform providing deep features for 3D CNN to classify rolling bearing fault vibration signals. _Eng._ _Res._ _Express_ 2024, _6_, 035201. [[CrossRef]](http://dx.doi.org/10.1088/2631-8695/ad5d52) 33. Toma, R.N.; Toma, F.H.; Kim, J.M. Comparative analysis of continuous wavelet transforms on vibration signal in bearing fault diagnosis of induction motor. In Proceedings of the 2021 International Conference on Electronics, Communications and Information Technology (ICECIT), Khulna, Bangladesh, 14–16 September 2021; IEEE: Piscataway, NJ, USA, 2021; pp. 1–4. 34. Yu, S.; Liu, Z.; Wang, S.; Zhang, G. A novel adaptive gramian angle field based intelligent fault diagnosis for motor rolling bearings. _J. Phys._ _Conf._ _Ser._ 2024, _2785_, 012042. [[CrossRef]](http://dx.doi.org/10.1088/1742-6596/2785/1/012042) 35. Dou, S.; Cheng, X.; Du, Y.; Wang, Z.; Liu, Y. Gearbox fault diagnosis based on Gramian angular field and TLCA-MobileNetV3 with limited samples. _Int._ _J. Metrol._ _Qual._ _Eng._ 2024, _15_, 15. [[CrossRef]](http://dx.doi.org/10.1051/ijmqe/2024004) 36. Zhou, Y.; Long, X.; Sun, M.; Chen, Z. Bearing fault diagnosis based on Gramian angular field and DenseNet. _Math._ _Biosci._ _Eng._ 2022, _19_, 14086–14101. [[CrossRef] [PubMed]](http://dx.doi.org/10.3934/mbe.2022656) 37. Yin, Z.; Zhang, F.; Xu, G.; Han, G.; Bi, Y. Multi-scale rolling bearing fault diagnosis method based on transfer learning. _Appl._ _Sci._ 2024, _14_, 1198. [[CrossRef]](http://dx.doi.org/10.3390/app14031198) 38. Ding, S.; Rui, Z.; Lei, C.; Zhuo, J.; Shi, J.; Lv, X. A rolling bearing fault diagnosis method based on Markov transition field and multi-scale Runge-Kutta residual network. _Meas._ _Sci._ _Technol._ 2023, _34_, 125150. [[CrossRef]](http://dx.doi.org/10.1088/1361-6501/acf8e7) 39. Deng, J.; Liu, H.; Fang, H.; Shao, S.; Wang, D.; Hou, Y.; Chen, D.; Tang, M. MgNet: A fault diagnosis approach for multi-bearing system based on auxiliary bearing and multi-granularity information fusion. _Mech._ _Syst._ _Signal_ _Process._ 2023, _193_, 110253. [[CrossRef]](http://dx.doi.org/10.1016/j.ymssp.2023.110253) 40. Xue, L.; Ningyun, L.; Chuang, C.; Tianzhen, H.; Bin, J. Attention mechanism based multi-scale feature extraction of bearing fault diagnosis. _J. Syst._ _Eng._ _Electron._ 2023, _34_, 1359–1367. [[CrossRef]](http://dx.doi.org/10.23919/JSEE.2023.000129) 41. Hu, B.; Liu, J.; Xu, Y. A novel multi-scale convolutional neural network incorporating multiple attention mechanisms for bearing fault diagnosis. _Measurement_ 2025, _242_, 115927. [[CrossRef]](http://dx.doi.org/10.1016/j.measurement.2024.115927) 42. Wang, Z.; Oates, T. Encoding time series as images for visual inspection and classification using tiled convolutional neural networks. In Proceedings of the Workshops at the Twenty-Ninth AAAI Conference on Artificial Intelligence, Austin, TX, USA, 25–30 January 2015; Volume 1, pp. 1–7. 43. Zhang, Y.; Zhou, S.; Li, H. Depth information assisted collaborative mutual promotion network for single image dehazing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 16–22 June 2024; pp. 2846–2855. 44. Wang, Y.; Huang, N.; Li, T.; Yan, Y.; Zhang, X. Medformer: A multi-granularity patching transformer for medical time-series classification. _arXiv_ 2024, arXiv:2405.19363. 45. Chen, X.; Zhang, B.; Gao, D. Bearing fault diagnosis base on multi-scale CNN and LSTM model. _J. Intell._ _Manuf._ 2021, _32_, 971–987. [[CrossRef]](http://dx.doi.org/10.1007/s10845-020-01600-2) 46. Zhang, W.; Peng, G.; Li, C.; Chen, Y.; Zhang, Z. A new deep learning model for fault diagnosis with good anti-noise and domain adaptation ability on raw vibration signals. _Sensors_ 2017, _17_, 425. [[CrossRef] [PubMed]](http://dx.doi.org/10.3390/s17020425) 47. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. 48. Dosovitskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Dehghani, M.; Minderer, M.; Heigold, G.; Gelly, S.; et al. An image is worth 16x16 words: Transformers for image recognition at scale. _arXiv_ 2020, arXiv:2010.11929. Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

섹션 본문 83문단 · 44,803자

(제목 없음)

1The axle-box bearing is a critical load-bearing component in high-speed trains and is prone to failure under long-term heavy-duty operation, affecting both operational efficiency and safety.Current deep-learning-based fault diagnosis methods face two key challenges: difficulty in capturing temporal features across multiple scales simultaneously, and limited capability in modeling local sequential patterns.To address these issues, we propose P2IFormer, a fault diagnosis model based on multi-granularity patch-to-image embedding.The raw vibration sequence is divided into equal-length patch sequences under multiple granularities, each defined by a fixed window size.Each patch is then transformed into a Gramian Angular Field (GAF) image to extract spatial features and generate granularityspecific embedding.A multi-granularity self-attention mechanism is used to model both intra-and inter-granularity dependencies.The resulting multi-granularity features are fused and fed into a softmax classifier for final fault prediction.Experiments conducted under four constant-speed conditions and one variable-speed condition demonstrate that P2IFormer achieves over 99.5% accuracy across all scenarios, significantly outperforming existing CNN-and Transformer-based methods.

Introduction

2High-speed trains, as a vital component of modern transportation systems, are widely used for intercity passenger and freight transport due to their high speed and large carrying capacity.The axle-box bearing, shown in Figure 1, a key load-bearing component connecting the wheelset and the bogie, plays a crucial role in ensuring the train's operational performance and safety.However, due to frequent dynamic loads and complex wheel-rail interactions, axle-box bearings are prone to wear and degradation.If their condition cannot be accurately diagnosed in a timely manner and corresponding maintenance is not carried out, such failures may lead to severe malfunctions or even major accidents.Therefore, developing effective fault diagnosis methods for axle-box bearings is of great practical importance for ensuring the safe operation of high-speed trains, reducing maintenance costs, and improving overall operational efficiency [1,2].

3The health condition of high-speed train axle-box bearings is directly related to the safety and reliability of train operations.However, fault diagnosis in practical scenarios faces multiple challenges.On the one hand, it is extremely difficult to obtain sufficient fault samples under real operating conditions and the available data are often highly imbalanced.On the other hand, the complex and variable operating conditions of trains-such as changes in rotational speed and noise interference-significantly increase the difficulty of diagnosis [3,4].Traditional diagnostic methods typically rely on signal processing in the time domain, frequency domain, or time-frequency domain, combined with machine learning models such as support vector machines for fault identification [5][6][7].These approaches are heavily dependent on manual feature extraction, which is not only time-consuming and expertise-intensive but also poorly adaptable to variable operating conditions, thereby limiting the accuracy and robustness of diagnostic models [8].In recent years, the rapid development of deep learning has driven its widespread application in fault diagnosis.Compared with traditional methods, deep learning models can directly extract high-level features from raw vibration signals, reducing reliance on manual feature engineering and significantly improving diagnostic accuracy [9].Chen et al. [10] proposed a feature-aligned multi-scale convolutional neural network (MSCNN-FA) that converts vibration signals into time-frequency images using short-time Fourier transform (STFT) and incorporates a feature alignment module with a multi-scale convolution strategy, achieving a diagnostic accuracy of 99.2%.Sun et al. [11] developed a fault diagnosis method that combines multi-scale CNN and long short-term memory (LSTM) networks, where the multi-scale CNN extracts local features from time-frequency images and the LSTM captures long-term temporal dependencies, resulting in an accuracy of approximately 98%.Zhao et al. [12] introduced a multi-scale convolutional neural network-bidirectional LSTMattention mechanism (MSCNN-BiLSTM-AM) approach, in which the multi-scale CNN extracts spatiotemporal features, the BiLSTM captures bidirectional temporal dependencies, and the attention mechanism enhances the representation of key features, achieving a diagnostic accuracy of 99.5%.To address the issue of data imbalance, Hou et al. [13] and Luo et al. [14] designed improved generative adversarial networks (GANs), which achieved diagnostic accuracies of 97.8% and 98.2%, respectively, on the CWRU dataset, demonstrating strong robustness under imbalanced data conditions.

Axle box bearing

4In fault diagnosis research, a widely used approach is to transform time-series signals into two-dimensional representations to enhance the expressive capacity of temporal features and to apply two-dimensional convolutional neural networks (2D-CNNs) for fault identification [15].Among such methods, the transformation of time-series data into images using the Gramian Angular Field (GAF) has been extensively adopted [16,17].For example, Bai et al. [18] proposed a GAF-based SEDenseNet method that converts vibration signals into two-dimensional images via GAF and incorporates a squeeze-and-excitation (SE) module to optimize feature extraction, achieving a diagnostic accuracy of 97.5%.Yu et al. [19] presented a GAF-based bearing fault diagnosis approach that similarly maps vibration signals to im-ages and employs a generative adversarial network (GAN) to synthesize training samples, reaching 96.8% accuracy and demonstrating robustness under class-imbalanced conditions.Tong et al. [20] developed a method using the Gramian Angular Difference Field (GADF) combined with channel attention and SimAM attention mechanisms, obtaining 98.7% accuracy.However, the inherently local receptive field of convolutional neural networks limits their capacity to model global contextual information, which can reduce diagnostic performance when handling long sequences or complex fault patterns.

5Transformer architectures, through their intrinsic self-attention mechanisms, enable the direct modeling of long-range dependencies across all positions in sequential data, thereby demonstrating substantial efficacy in fault diagnosis [21,22].For instance, Hou et al. [23] proposed the Diagnosisformer model, which extracts frequency-domain features using Fast Fourier Transform (FFT) and integrates a multi-feature parallel fusion encoder and a cross-flip decoder, achieving a diagnostic accuracy of 99.85% on the CWRU dataset.However, Transformers have certain limitations in modeling local patterns and extracting multi-granularity temporal features.To address these issues, hybrid CNN-Transformer architectures have been proposed.Chen et al. [24] introduced an efficient cross-space multiscale CNN-Transformer parallel architecture (ECMCTP) that generates time-frequency images using the continuous wavelet transform (CWT) and employs parallel CNN and Transformer branches to capture local and global features, delivering excellent diagnostic accuracy and noise robustness.Han et al. [25] developed a multi-task MT-ConvFormer model that generates time-frequency representations via short-time Fourier transform (STFT) and integrates CNNs' local feature extraction with Transformers' long-range dependency modeling, achieving a diagnostic accuracy close to 98%.

6To address the limitations of existing fault diagnosis methods in local feature modeling and multi-scale feature extraction, this paper proposes P2IFormer, a fault diagnosis model for high-speed train axle-box bearings based on multi-granularity patch-to-image embedding.The proposed approach first segments raw vibration signals into equal-length patch sequences at multiple granularities using a set of predefined window sizes, enabling structured multi-granularity modeling of the time series.For each granularity level, the individual patches are then transformed into corresponding Gramian Angular Field (GAF) images, enhancing the visual expression of local temporal features.These images are subsequently processed to extract deep features and mapped into granularityspecific embedding representations.Building on these embeddings, P2IFormer employs a multi-granularity self-attention mechanism to model both intra-granularity and intergranularity contextual dependencies, achieving deep fusion of features across different granularities.Finally, a linear projection layer followed by a softmax function is used to perform fault classification.The experimental results under various constant-speed and variable-speed conditions demonstrate that the proposed method achieves excellent diagnostic performance, significantly outperforming existing CNN-and Transformer-based models.The main contributions of this paper are summarized as follows:

7(1)

8A fault diagnosis model for high-speed train axle-box bearings, named P2IFormer, is developed based on a patch-to-image embedding framework.By combining multigranularity segmentation of time series with image transformation, patch sequences at different granularities are converted into multi-channel Gramian Angular Field (GAF) images, significantly enhancing the modeling of local temporal features.(2)

9A granularity-specific image embedding module is designed to generate feature representations for each granularity.Patch images at each granularity are processed through feature extraction, pooling, and linear projection, and then uniformly encoded as granularity-specific tokens.This provides high-quality representations to support effective multi-granularity interaction modeling.

10(3) The proposed method is evaluated under various constant-speed and variablespeed operating conditions.The results demonstrate that P2IFormer achieves over 99.5% accuracy across all scenarios, significantly outperforming existing CNN-and Transformer-based methods.

Transformer-Based Approaches for Bearing Fault Diagnosis

11In recent years, the Transformer architecture has gained significant attention in the field of fault diagnosis due to its superior global modeling capability [26].Compared with traditional convolutional neural networks (CNNs), Transformers leverage self-attention mechanisms to capture dependencies between arbitrary time steps, effectively addressing the limitations of CNNs, which are restricted to local feature extraction and struggle to model long-range temporal dependencies.In addition, Transformers support parallel computation and offer stronger representational capacity.In bearing fault diagnosis, some studies have applied or modified standard Transformer models to improve global feature extraction [27,28], while others have explored hybrid models that combine Transformers with CNNs to exploit their complementary strengths in local and global feature modeling [29,30].However, most existing Transformer-based methods rely on fixed-length patch segmentation strategies, which hinder the ability to simultaneously capture multigranularity temporal features and thus limit the modeling of complex fault patterns.

Image-Based Fault Diagnosis Through Time-Series Transformation

12Transforming time-series data into images for fault diagnosis has emerged as an effective and rapidly evolving approach in recent years, with particularly notable success in bearing fault diagnosis.The core idea of this method is to map one-dimensional vibration signals into two-dimensional image representations using specific transformation algorithms, enabling powerful image-based models such as convolutional neural networks (CNNs) and vision Transformers to perform feature extraction and fault classification tasks [31].Common transformation techniques include time-frequency representation methods such as short-time Fourier transform (STFT), wavelet transform (WT), and continuous wavelet transform (CWT), as well as structural mapping methods like Gramian Angular Field (GAF) and Markov Transition Field (MTF) [32][33][34][35][36].These image-based techniques not only reveal the local dynamics and global trends within time-series data, but also enhance the ability of visual models to identify complex fault patterns.

Multi-Scale Feature Extraction for Fault Diagnosis

13In recent years, multi-scale feature extraction has received increasing attention in bearing fault diagnosis, aiming to capture critical signal patterns distributed across different temporal and frequency ranges.The core idea behind such methods is to process vibration signals using varying receptive fields or segmentation granularities, thereby enabling joint modeling of both local details and global structures.In convolutional neural networks (CNNs), multi-scale architectures are typically constructed using parallel branches with different convolutional kernel sizes to extract and fuse features at multiple scales [37][38][39].More recently, attention mechanisms have been incorporated into multi-scale CNN frameworks to enhance the model's focus on salient features and improve the robustness of feature representations [40,41].However, most existing multi-scale methods lack explicit modeling of the relationships between different scales, making it difficult to fully capture the semantic dependencies among features of varying scales.

Problem Definition

14The fault diagnosis of high-speed train axle-box bearings can be formulated as a multivariate time-series classification task.Let x ∈ R T×C denote a segment of vibration signal, where T represents the sequence length (i.e., number of time steps) and C denotes the number of sensor channels (e.g., vibration, temperature).Each sample x i is associated with a label y i ∈ {1, 2, . . ., M}, indicating one of M predefined bearing conditions or fault types (e.g., normal, inner race fault, outer race fault).Given a training set {(x i , y i )} N i=1 composed of N labeled instances, the objective is to learn a classification function f : R T×C → {1, 2, . . ., M} that can accurately predict the fault category ŷ = f (x) for any unseen sample x.

Overview of the P2IFormer Architecture

15The overall architecture of the proposed P2IFormer is illustrated in Figure 2. The input to the model is a multivariate vibration signal segment collected from axle-box bearings.First, the signal is processed by the Multi-Granularity Patch-to-Image (P2I) Embedding module, which partitions the sequence into multiple granularities using different window sizes and converts each patch into a Gramian Angular Field (GAF) image.Each image is then encoded into a latent token representation via a feature extraction module.Subsequently, the resulting multi-granularity embeddings are fed into a stack of encoder layers, each consisting of layer normalization, the Multi-Granularity Self-Attention (MGSA) module, and a feed-forward network.The MGSA mechanism models both intra-granularity and intergranularity dependencies by leveraging learnable router tokens.To integrate the semantic information across different granularities, the updated router tokens from all granularities are concatenated in the Multi-Granularity Feature Aggregation module and projected into a unified feature space.Finally, the aggregated representation is passed through a fully connected layer followed by a softmax classifier to determine the bearing fault category.

Multi-Granularity Patch-to-Image Embedding

16To effectively capture temporal features across different scales, this study introduces a Multi-Granularity Patch-to-Image (P2I) Embedding module, as illustrated in Figure 3.The input multivariate time series is first divided into patch sequences under multiple granularity levels by applying sliding windows of different lengths.Each patch is then passed into the P2I module, which internally performs Gramian Angular Field (GAF) transformation and feature extraction through convolutional and attention-based operations.This process yields a token embedding for each patch.By applying the P2I module to all patches within each granularity level, a complete granularity-specific embedding sequence x (i) is constructed.The resulting embeddings across all granularities, denoted as x (1) , x (2) , . . ., x (n) , serve as the foundation for subsequent multi-granularity attention modeling.

Multi-Granularity Patch Splitting

17To effectively capture fault-related patterns in axle-box bearing vibration signals across multiple temporal scales, this study introduces a multi-granularity sequence partitioning strategy.Let the original multivariate time series be x ∈ R T×C , where T denotes the sequence length and C is the number of sensor channels.A set of n patch lengths {l 1 , l 2 , . . ., l n } is selected.At granularity level i, the sequence x is divided into N i = T/l i non-overlapping patches of length l i , denoted as P i,j ∈ R l i ×C , j = 1, 2, . . ., N i .This multigranularity partitioning strategy enables the model to simultaneously capture fine-grained local dynamics (e.g., short-term transients) and coarse-grained global trends.It provides a rich and structured representation foundation for subsequent image transformation and deep feature extraction, thereby significantly enhancing the model's temporal perception across multiple granularities in fault diagnosis.x (2) x (n) ...

Patch-to-Image Embedding

18To enhance the ability to learn local fault-sensitive features under multiple temporal scales, each patch at granularity level i is processed through the Patch-to-Image Embedding (P2I) module, as illustrated in Figure 4a.This module consists of three main stages: image transformation, deep feature extraction, and token generation.Ultimately, it produces a d-dimensional embedding vector for each patch.First, each patch P i,j ∈ R l i ×C , where l i denotes the patch length and C is the number of sensor channels, is converted into a 2D image using the Gramian Angular Field (GAF) technique [42], shown in Figure 4b.This method transforms the 1D time-domain subsequence into a 2D structured representation that captures temporal dependencies and dynamics.The GAF generation process includes the following steps:

•

19Step 1: Normalization.Each channel-wise sequence {x k } l i k=1 is normalized to the range [−1, 1] using min-max scaling:

20•

21Step 2: Polar coordinate mapping.Each normalized data point x k is mapped to a point in the polar coordinate system.

22where ϕ k and r k represent the angular coordinate and radial coordinate in the polar space, respectively.

23Step 3: GAF image generation.The Gram Angular Summation Field (GASF) and Gram Angular Difference Field (GADF) are defined as

24where i, j ∈ {1, 2, . . ., l i } denote the row and column indices in the resulting GAF image and ϕ i and ϕ j are the polar angles corresponding to the time-series values at time steps i and j, respectively.

25Each channel undergoes the above process independently, and the resulting l i × l i GAF images are stacked along the channel dimension, forming a multi-channel image of shape l i × l i × C. To extract high-level semantic features, the image is first processed by a 3 × 3 convolution followed by a ReLU activation:

26where F denotes the intermediate feature map.

27Next, the Local Feature-Embedded Global Feature Extraction Module (LEGM), shown in Figure 4c, is applied to capture both fine-grained local details and long-range dependencies through a hybrid structure combining convolution and self-attention [43].Given the feature map F, three learnable linear transformations are applied to produce the query Q, key K, and value V:

28where W q , W k , W v are learnable projection matrices.The attention map A and attentionenhanced feature F a ttn are then computed using scaled dot-product attention:

29where D is the feature dimension.In addition, V is passed through a convolutional layer to emphasize spatial locality, producing F c onv, which is fused with the attention output:

30The fused feature map is then passed through a linear layer and added residually to the original convolution-enhanced map, followed by an MLP layer:

31To obtain the final token representation for the patch, F o ut is processed by convolution, ReLU activation, global average pooling, and a linear projection:

32where W p and b p are learnable parameters and e i,j is the patch-level token.To enhance the model's sensitivity to patch ordering and temporal structure, a learnable positional encoding is added.Specifically, each patch position j at granularity level i is associated with a trainable positional vector pos i,j ∈ R d , which is added to the patch embedding:

33where z i,j denotes the final token embedding for the j-th patch at granularity level i.Finally, the embedding vectors of all patches at granularity level i form a sequence-level embedding:

34where N i is the number of patches at granularity level i and d is the embedding dimension.

35After converting all patches into embeddings at their respective granularities, the original multivariate time series is represented as a set of granularity-specific embeddings.

Multi-Granularity Self Attention

36To effectively model both intra-and inter-granularity contextual dependencies, a multigranularity self-attention module is introduced.This module consists of two sequential stages: intra-granularity self-attention and inter-granularity self-attention [44].First, for each of the n granularity levels, a learnable router vector u (i) ∈ R d is initialized to summarize the global semantic representation at that granularity.These router vectors serve not only as semantic anchors within each granularity but also as bridges for communication across different granularities.For the i-th granularity level with N i patches, the router vector is initialized as the sum of a trainable global token embedding e (i) ∈ R d and a learnable positional encoding pos

373.4.1.Intra-Granularity Self-Attention

38At each granularity level i, the patch embedding sequence x (i) ∈ R N i ×d is concatenated vertically with its corresponding router vector u (i) ∈ R 1×d to form the extended sequence

39where the symbol [• | •] denotes concatenation along the row dimension and the router vector is added as an additional token after the patch embeddings.Next, standard multihead self-attention is applied:

40Attn intra (

41Here, Q, K, V ∈ R (N i +1)×d are the query, key, and value matrices and W Q , W K , W V are trainable linear projection weights.This intra-granularity attention focuses on learning temporal dependencies within each individual granularity level.

Inter-Granularity Self-Attention

42After intra-granularity self-attention is completed for all levels, the updated router vectors û(1) , û(2) , . . ., û(n) each contain global semantic information representative of their respective granularity levels.These router vectors encode the contextual dependencies aggregated from the patch embeddings within their own granularities, effectively summarizing granularity-specific features.To enable cross-granularity interaction, all updated router vectors are concatenated to form the cross-granularity router matrix

43Next, standard multi-head self-attention is applied over the router sequence to model inter-granularity semantic dependencies:

44where W ′ Q , W ′ K , and W ′ V are learnable projection matrices.

Multi-Granularity Feature Aggregation

45After processing through the encoder with multi-granularity self-attention, each updated router vector û(i) ∈ R d encodes both intra-and inter-granularity semantic informa- tion specific to granularity level i.To integrate global representations from all n granularities, we concatenate these router vectors along the feature dimension to form a single high-dimensional fused vector:

46Here, concat(•) denotes the concatenation operation along the feature axis.Subsequently, the fused vector is projected to a target dimension d ′ via a fully connected layer followed by a GeLU activation function:

47where W f and b f are the learnable parameters of the projection layer.The output h ∈ R d ′ serves as the final fused representation, integrating semantic features from all granularities.This information-rich vector is then used as the input to the classifier for fault type prediction.

Classifier

48After multi-granularity feature aggregation, a unified representation vector h ∈ R d ′ is obtained, encapsulating both global and cross-granularity semantic information.In the classification stage, this vector is fed into a simple yet effective discriminator to predict the fault category.Specifically, for a classification task with M fault types, the vector h is passed through a classifier composed of a fully connected layer followed by a softmax activation to produce the class probability distribution

49where W ∈ R M×d ′ and b ∈ R M are learnable parameters.The output ŷ = [ ŷ1 , ŷ2 , . . ., ŷM ] represents the predicted probability for each fault class.During training, the model is optimized using the cross-entropy loss to measure the discrepancy between the predicted probability distribution ŷ and and the ground truth label y.

Dataset Description

50The dataset used in this study was collected from an experimental platform simulating the axle-box bearings of high-speed trains, specifically using the HRB352213 bearing model.It includes one healthy state and four typical fault types: inner race fault, outer race fault, rolling element fault, and combination fault.Vibration signals were acquired using a triaxial accelerometer mounted on one side of the bearing, capturing three-channel data that comprehensively reflect the dynamic characteristics of the bearing.A photograph of the experimental platform is shown in Figure 5.During the experiments, the bearings were operated under four constant-speed conditions (20 Hz, 40 Hz, 60 Hz, and 80 Hz) and one variable-speed condition.In the variable-speed scenario, the rotation speed follows a triangular waveform: it increases linearly from 0 Hz to 40 Hz and then decreases linearly back to 0 Hz, with the entire cycle lasting approximately 2 s and peaking at 1 s.This speed variation simulates the actual acceleration and deceleration processes of high-speed trains, enabling the evaluation of the model's robustness under dynamic operating conditions.The vibration signals were sampled at a frequency of 25.6 kHz, and each sample has a duration of 10 s, ensuring sufficient resolution for capturing fault-related features.

Experimental Setup

51In this study, the collected vibration signals were segmented into training samples using a sliding window technique with a window size of 256 and a step size of 64.As a result, 4093 samples were generated for each fault category, yielding a total of 20,465 samples for model training, validation, and testing.Each vibration signal sample was segmented into three granularity levels using predefined patch lengths of 85, 51, and 36, respectively.At each level, the sample was divided into non-overlapping patches of the corresponding length.These patches were subsequently transformed into Gramian Angular Field (GAF) images, with the resulting image size equal to the respective patch length (i.e., 85 × 85, 51 × 51, and 36 × 36 for each granularity level).Figure 6 illustrates example vibration signal samples for each fault category at the 80 Hz rotational speed, along with their corresponding GADF images at the patch length of 85.The entire dataset was divided into training, validation, and test sets in a 60%:20%:20% ratio.

52The overall performance and stability of the proposed model are influenced by various architectural and hyperparameter settings, such as the embedding dimension and the number of attention heads.The detailed network configuration and hyperparameter values adopted in this study are summarized in Table 1.

53To comprehensively evaluate the robustness and generalization capability of the proposed P2IFormer model under varying operating conditions, extensive experiments were conducted across four constant-speed scenarios (20 Hz, 40 Hz, 60 Hz, and 80 Hz), as well as one variable-speed condition.Several representative baseline models were selected for comparison, including CNN-LSTM [45], WDCNN [46], DenseNet [36], ResNet [47], Vision Transformer (ViT) [48], and ECMCTP [24].All experiments were implemented using the PyTorch 2.0 deep learning framework in a Python 3.8 environment and executed on a workstation equipped with an NVIDIA RTX 3090 GPU (24 GB memory).To quantitatively assess the of the models, average accuracy and F1-score were employed as evaluation metrics.Their definitions are as follows:

54Here, TP i , TN i , FP i , and FN i denote the true positives, true negatives, false positives, and false negatives for class i, respectively.These metrics effectively reflect classification performance and model generalization, particularly under class-imbalanced multi-class conditions.

Performance Evaluation Under Constant-Speed Conditions

55To evaluate the fault recognition capability of the proposed P2IFormer model under varying operating conditions, the model was independently trained and validated under four constant-speed scenarios: 20 Hz, 40 Hz, 60 Hz, and 80 Hz.During the patch-to-GAF image transformation stage, two Gramian Angular Field encoding methods-Gramian Angular Summation Field (GASF) and Gramian Angular Difference Field (GADF)-were employed to examine their effects on model performance.The corresponding loss and accuracy curves on the validation set are illustrated in Figure 7.

56As shown in the Figure 7, P2IFormer with GADF encoding consistently exhibits faster convergence and higher final accuracy across all speed conditions.For instance, at 20 Hz (Figure 7a) and 40 Hz (Figure 7b), the GADF-based model achieves rapid convergence within the first 20 epochs and reaches final accuracies of 99.76% and 99.61%, respectively, while the GASF-based model lags slightly behind, with accuracies of 98.65% and 98.97%.Similarly, under the 60 Hz (Figure 7c) and 80 Hz (Figure 7d) conditions, the GADF-based model maintains superior performance, achieving over 99.8% accuracy and demonstrating excellent robustness and stability.

57These results confirm that GADF encoding more effectively preserves local temporal variations and enhances the discriminative representation of fault patterns, enabling P2IFormer to achieve consistently high diagnostic accuracy across varying rotational speeds.The superiority of GADF over GASF lies in its distinct mathematical formulation and its capacity to capture critical temporal dynamics.Specifically, the GADF matrix is constructed based on angular differences (ϕ i − ϕ j ), resulting in an anti-symmetric structure (GADF i,j = −GADF j,i ) that encodes directional information and intuitively reflects upward or downward trends within the sequence.Moreover, its diagonal elements are always zero, eliminating redundant self-correlations and yielding a more compact and efficient representation.In contrast, GASF relies on angular summation (ϕ i + ϕ j ), producing a symmetric matrix (GASF i,j = GASF j,i ) that lacks directional sensitivity.Additionally, its non-zero diagonal elements retain self-correlations, which may introduce irrelevant redundancy in classification tasks.Consequently, GADF facilitates faster model convergence and improves classification performance during training.Therefore, GADF was selected as the default encoding method for subsequent comparative experiments against baseline models such as DenseNet, ResNet, ViT, and the proposed P2IFormer.The final evaluation results are summarized in Table 2.As shown in Table 2, the proposed P2IFormer achieves the highest accuracy and F1-score under the 20 Hz, 40 Hz, and 60 Hz speed conditions, demonstrating superior fault classification performance.At the 80 Hz high-speed condition, the DenseNet model slightly outperforms P2IFormer, yielding the best results.Overall, the performance advantage of P2IFormer becomes more evident as the rotational speed decreases, indicating stronger robustness and generalization capability under low-speed scenarios.

58In terms of model complexity, P2IFormer contains 17.14 million parameters, which is significantly higher than lightweight models such as WDCNN (0.029 M), CNN-LSTM (0.093 M), and ECMCTP (0.781 M), but remains much smaller than large-scale models like ResNet (42.51 M) and ViT (85.80 M).Although the training time per epoch (43 s) is moderately higher compared to lightweight models, P2IFormer maintains a reasonable computational cost, making it feasible for deployment in environments with sufficient computational resources.The confusion matrices under different speed conditions, as shown in Figure 8, further validate the stability and effectiveness of P2IFormer in multi-class fault diagnosis tasks.

Performance Evaluation Under the Variable-Speed Condition

59Similar to the experiments conducted under constant-speed conditions, the performance of the proposed model was further evaluated under a variable-speed scenario.As shown in Figure 9, the validation loss and accuracy curves demonstrate the model's effectiveness in handling non-stationary signals caused by speed variations.Compared to constant-speed settings, variable-speed conditions better reflect real-world operating environments, posing greater challenges to the model's robustness and generalization capability.The results show that the model maintains strong convergence and diagnostic performance under these complex conditions.Notably, when using the GADF encoding, the model achieves faster convergence and higher accuracy, reaching 99.64% on the validation set, compared to 98.58% with GASF encoding.The fault diagnosis performance of different models under the variable-speed condition is compared in Figure 10.As shown, the CNN-LSTM model performs the worst, achieving only 86.17% accuracy and an F1-score of 86.06%.This indicates its limited robustness in handling the the non-stationary characteristics of vibration signals caused by varying speed.In contrast, the proposed P2IFormer achieves the best performance, with both accuracy and F1-score reaching 99.64%.This demonstrates its superior capability in modeling temporal dependencies and integrating multi-granularity features, making it more adaptive to complex operating conditions.ResNet, ViT, and DenseNet also achieve relatively high accuracy and F1-scores.Among them, DenseNet reaches 98.40% accuracy, slightly outperforming the other two models, though still exhibiting a performance gap compared to P2IFormer.WDCNN performs moderately well but falls short of ResNet and ViT, particularly in handling non-stationary input sequences.The confusion matrix results on the test set are illustrated in Figure 11.

Ablation Study

60To evaluate the contribution of each core component in the proposed P2IFormer model, a series of ablation experiments were conducted.The corresponding results are illustrated in Figure 12 and Table 3.

61As shown in Figure 12, to validate the effectiveness of the Patch-to-Image Embedding module, we replaced it with a traditional patch embedding method, where each patch is directly projected into a high-dimensional vector using a multilayer perceptron (MLP).The results show that this substitution leads to a significant drop in accuracy under all speed conditions, with reductions of 5.88% and 12.37% observed in the 20 Hz and variable-speed scenarios, respectively.This demonstrates the advantage of image-based embedding in capturing spatiotemporal structures from raw sequences.Additionally, we investigated the impact of the Local Feature-Embedded Global Feature Extraction Module (LEGM) by removing it while preserving the patch-to-image embedding framework.In this setting, standard convolutional layers were used for feature extraction.Performance declined in all cases, indicating that LEGM contributes meaningfully by integrating local and global information.To evaluate the effectiveness of the multi-granularity strategy, we designed three single-granularity variants with the number of patches per sample set to 3, 5, and 7, respectively.These models retain the core architecture but use standard self-attention for feature learning.As shown in Table 3, all single-granularity models underperform the full model, especially under the variable-speed and low-speed (20 Hz) settings.This demonstrates that the multi-granularity approach enhances the model's ability to capture diverse temporal patterns and improves robustness under non-stationary conditions.

Robustness Evaluation Under Noisy Conditions

62To further validate the robustness and practical applicability of the proposed model in real-world industrial environments, we conducted a comparative analysis of fault diagnosis performance across multiple baseline models under different noise levels.Specifically, Gaussian white noise with varying intensities was added to the original vibration signals to simulate five distinct signal-to-noise ratio (SNR) conditions: −6 dB, −3 dB, 0 dB, 3 dB, and 6 dB.This setup aims to replicate the typical background interference encountered in real applications.The SNR is defined as SNR dB = 10 log 10 P signal P noise (25) where P signal and P noise represent the power of the signal and noise, respectively.Under each SNR condition, the classification accuracy of all models was evaluated across five speed scenarios: 20 Hz, 40 Hz, 60 Hz, 80 Hz, and variable speed.As shown in Table 4, the proposed P2IFormer consistently achieved superior performance across most speed and noise settings, demonstrating excellent robustness against noise.Notably, under the low-speed (20 Hz) and variable-speed conditions, P2IFormer outperformed all other models by a significant margin, achieving 90.26% and 90.23% accuracy at −6 dB, respectively.Under the 80 Hz condition, ECMCTP achieves the highest accuracy across all noise levels.The DenseNet-based model also shows relatively stable performance across different conditions, ranking second only to P2IFormer in overall average accuracy.

Discussion

63The experimental results indicate that, except for the 80 Hz condition where the DenseNet-based model with GADF encoding achieved comparable performance, P2IFormer consistently outperforms all baseline models in terms of accuracy and F1score under the remaining constant-speed conditions, demonstrating remarkable stability and strong discriminative capability.Notably, its performance advantage is more pronounced under the low-speed (20 Hz) and variable-speed scenarios.This superiority is primarily attributed to the proposed innovative model architecture.On the one hand, the multi-granularity patching strategy, combined with time-series-to-image conversion using GAF encoding, enables the model to capture both local dynamics and global trends across multiple temporal granularities, thereby enriching the diversity and expressiveness of feature representations.On the other hand, the incorporation of a multi-granularity self-attention mechanism effectively models both intra-and inter-granularity contextual dependencies, further enhancing the integration of semantic information.

64The ablation study confirms that the Patch-to-Image Embedding module, Local Feature-Embedded Global Feature Extraction Module (LEGM), and the multi-granularity strategy all contribute positively to the final performance, validating the rationality of the proposed architectural design.Furthermore, in the robustness evaluation under varying noise levels (SNR = −6 dB to 6 dB), P2IFormer consistently maintained high diagnostic accuracy across all rotational speeds.Its performance remained stable even under low-SNR and variable-speed conditions, highlighting its strong noise resistance and adaptability to complex environments.

65In terms of model complexity and computational cost, P2IFormer comprises 17.14 million parameters, which is substantially lower than ViT (85.80 M) and ResNet (42.51 M), but significantly higher than lightweight models such as WDCNN (0.029 M), CNN-LSTM (0.093 M), and ECMCTP (0.781 M).Moreover, P2IFormer also incurs a higher per-epoch training time compared to these lightweight baselines, indicating a greater demand for computational resources.

Conclusions

66This paper proposes a deep learning model named P2IFormer, which is designed to address the limitations of existing fault diagnosis methods for high-speed train axle-box bearings in multi-scale modeling and temporal feature extraction.The proposed model first segments the raw vibration signals using multiple window lengths, generating patch sequences at various granularities to enable structured modeling across different temporal scales.Each patch is then transformed into a corresponding Gramian Angular Field (GAF) image, enhancing the representation of local temporal features.A Local Feature-Embedded Global Feature Extraction module is subsequently applied to extract deep semantic features and generate token embedding at each granularity.Furthermore, a multi-granularity self-attention mechanism is employed to capture both intra-and inter-granularity semantic dependencies, effectively integrating fault information across granularities and improving the model's capability to distinguish complex fault patterns.Experimental results demonstrate that P2IFormer achieves fault diagnosis accuracy exceeding 99.5% under four constant-speed conditions and one variable-speed condition, significantly outperforming mainstream Transformer-and CNN-based models.These results validate the model's strong robustness and generalization capability across diverse operating scenarios.Furthermore, ablation and noise robustness experiments confirm the effectiveness of the model's key components and its resilience to noise interference.Nevertheless, P2IFormer exhibits a larger parameter size and longer training time compared to lightweight models such as WDCNN and ECMCTP, indicating higher computational requirements.Future research will focus on lightweight model design to reduce computational resource requirements and improve deployment efficiency.Additionally, efforts will be directed toward developing improved strategies for handling scenarios with limited fault samples and imbalanced datasets, aiming to enhance the model's adaptability and robustness in real-world industrial applications.

Figure 1 .

67Figure 1.The structural location of the axle-box bearing in a high-speed train bogie.

Figure 2 .

68Figure 2. The overall architecture of the proposed P2IFormer model.The input consists of multichannel vibration signal sequences collected from axle-box bearings.These signals are first processed by the Multi-Granularity P2I Embedding module, which splits the time series into patch sequences at multiple granularities and transforms them into image representations.The resulting embeddings are passed through a stack of encoder layers, each consisting of layer normalization, Multi-Granularity Self-Attention (MGSA), and a feed-forward network (FFN) with residual connections.The outputs from different granularities are integrated via the Multi-Granularity Information Aggregation module.Finally, the fused features are classified into fault categories using a softmax classifier.

Figure 3 .

69Figure 3. Illustration of the multi-granularity patch-to-image (P2I) embedding process.

Figure 4 .

70Figure 4.The architecture of the Patch-to-Image (P2I) Embedding module.Subfigure (a) illustrates the P2I embedding process at a granularity level where the time series is split into 3 non-overlapping patches, where each time-series patch is first transformed into a Gramian Angular Field (GAF) image.These images are then processed through a convolutional backbone combined with the Local Feature Embedded Global Feature Extraction Module (LEGM) module to extract deep semantic features.A projection layer finally outputs the embedding token for each patch.Subfigure (b) shows the GAF transformation procedure, encoding temporal dependencies via polar coordinate mapping.Subfigure (c) depicts the structure of the LEGM module, which jointly captures local spatial patterns and long-range dependencies through the integration of convolution and self-attention mechanisms.

Figure 5 .

71Figure 5. Axle-box bearing experimental platform.

Figure 6 .

72Figure 6.Visualization of vibration signal segments for each fault category under the 80 Hz rotational speed condition and their corresponding GADF images (patch length = 85).

Figure 7 .

73Figure 7. Validation loss and accuracy curves of the P2IFormer model under four constant-speed conditions using GASF and GADF encodings: (a) 20 Hz, (b) 40 Hz, (c) 60 Hz, and (d) 80 Hz.

Figure 8 .

74Figure 8. Confusion matrices of the P2IFormer model under constant-speed conditions: (a) 20 Hz, (b) 40 Hz, (c) 60 Hz, and (d) 80 Hz.

Figure 9 .

75Figure 9. Validation loss and accuracy curves of P2IFormer using GASF and GADF encodings under the variable-speed condition.

Figure 10 .Figure 11 .

76Figure 10.Comparison of accuracy and F1-score for different models under variable-speed conditions.

Figure 12 .

77Figure 12.Ablation study results on the effectiveness of the patch-to-image embedding and LEGM.

Table 1 .

78Hyperparameter settings of the proposed P2IFormer model.

Table 2 .

79Comparison

80of fault diagnosis performance across different models under four constantspeed conditions.Accuracy and F1-score are expressed as percentages (%).

Table 3 .

81Performance of single-granularity variants and accuracy drop compared to the full multigranularity model.

Table 4 .

82Classification accuracy (%) under different SNR levels grouped by noise level.

83Cont.

참고문헌 46건

  1. Deep Residual Learning for Image Recognition 2016 10.1109/cvpr.2016.90
  2. A New Deep Learning Model for Fault Diagnosis with Good Anti-Noise and Domain Adaptation Ability on Raw Vibration Signals Sensors · Multidisciplinary Digital Publishing Institute · 2017 10.3390/s17020425
  3. Deep Learning Algorithms for Bearing Fault Diagnostics—A Comprehensive Review IEEE Access · Institute of Electrical and Electronics Engineers · 2020 10.1109/access.2020.2972859
  4. Bearing fault diagnosis base on multi-scale CNN and LSTM model Journal of Intelligent Manufacturing · Springer Science+Business Media · 2020 10.1007/s10845-020-01600-2
  5. A New Deep Learning Model for Fault Diagnosis with Good Anti-Noise and Domain Adaptation Ability on Raw Vibration Signal 2017 10.20944/preprints201701.0132.v1
  6. Multiscale Convolutional Neural Network With Feature Alignment for Bearing Fault Diagnosis IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2021 10.1109/tim.2021.3077673
  7. Comparative Analysis of Continuous Wavelet Transforms on Vibration signal in Bearing Fault Diagnosis of Induction Motor 2021 International Conference on Electronics, Communications and Information Technology (ICECIT) · 2021 10.1109/icecit54077.2021.9641199
  8. Intelligent fault diagnosis of train axle box bearing based on parameter optimization VMD and improved DBN Engineering Applications of Artificial Intelligence · Elsevier BV · 2022 10.1016/j.engappai.2022.104713
  9. A systematic review of rolling bearing fault diagnoses based on deep learning and transfer learning: Taxonomy, overview, application, open challenges, weaknesses and recommendations Ain Shams Engineering Journal · Elsevier BV · 2022 10.1016/j.asej.2022.101945
  10. Bearing fault diagnosis based on Gramian angular field and DenseNet Mathematical Biosciences & Engineering · Arizona State University · 2022 10.3934/mbe.2022656
  11. Weak Fault Feature Extraction of Axle Box Bearing Based on Pre-Identification and Singular Value Decomposition Machines · Multidisciplinary Digital Publishing Institute · 2022 10.3390/machines10121213
  12. MgNet: A fault diagnosis approach for multi-bearing system based on auxiliary bearing and multi-granularity information fusion Mechanical Systems and Signal Processing · Elsevier BV · 2023 10.1016/j.ymssp.2023.110253
  13. A Mask Self-Supervised Learning-Based Transformer for Bearing Fault Diagnosis With Limited Labeled Samples IEEE Sensors Journal · IEEE Sensors Council · 2023 10.1109/jsen.2023.3264853
  14. A Review of Fault Diagnosis Methods for Key Systems of the High-Speed Train Applied Sciences · Multidisciplinary Digital Publishing Institute · 2023 10.3390/app13084790
  15. Time–frequency Transformer with shifted windows for journal bearing-rotor systems fault diagnosis under multiple working conditions Measurement Science and Technology · IOP Publishing · 2023 10.1088/1361-6501/acd2f3
  16. A Novel Fault Diagnosis Method of Rolling Bearings Combining Convolutional Neural Network and Transformer Electronics · Multidisciplinary Digital Publishing Institute · 2023 10.3390/electronics12081838
  17. Rolling bearing faults identification based on multiscale singular value Advanced Engineering Informatics · Elsevier BV · 2023 10.1016/j.aei.2023.102040
  18. Diagnosisformer: An efficient rolling bearing fault diagnosis method based on improved Transformer Engineering Applications of Artificial Intelligence · Elsevier BV · 2023 10.1016/j.engappai.2023.106507
  19. Enhanced generative adversarial networks for bearing imbalanced fault diagnosis of rotating machinery Applied Intelligence · Springer Science+Business Media · 2023 10.1007/s10489-023-04870-4
  20. A rolling bearing fault diagnosis method based on Markov transition field and multi-scale Runge-Kutta residual network Measurement Science and Technology · IOP Publishing · 2023 10.1088/1361-6501/acf8e7
  21. A new bearing fault diagnosis method based on multi-scale CNN and LSTM 2023 10.1117/12.3006762
  22. Attention mechanism based multi-scale feature extraction of bearing fault diagnosis Journal of Systems Engineering and Electronics · Institute of Electrical and Electronics Engineers · 2023 10.23919/jsee.2023.000129
  23. Vibration-based bearing fault diagnosis of high-speed trains: A literature review High-speed Railway · Elsevier BV · 2023 10.1016/j.hspr.2023.11.001
  24. Fault detection of high-speed train axle bearings based on a hybridized physical and data-driven temperature model Mechanical Systems and Signal Processing · Elsevier BV · 2023 10.1016/j.ymssp.2023.111037
  25. Semi-supervised fault diagnosis of wheelset bearings in high-speed trains using autocorrelation and improved flow Gaussian mixture model Engineering Applications of Artificial Intelligence · Elsevier BV · 2024 10.1016/j.engappai.2024.107861
  26. Multi-Scale Rolling Bearing Fault Diagnosis Method Based on Transfer Learning Applied Sciences · Multidisciplinary Digital Publishing Institute · 2024 10.3390/app14031198
  27. Imbalanced data fault diagnosis of rolling bearings using enhanced relative generative adversarial network Journal of Mechanical Science and Technology · Springer Science+Business Media · 2024 10.1007/s12206-024-0104-2
  28. Application of Variational Graph Autoencoder in Traction Control of Energy-Saving Driving for High-Speed Train Applied Sciences · Multidisciplinary Digital Publishing Institute · 2024 10.3390/app14052037
  29. Intelligent Fault Diagnosis of Rolling Bearing Based on Gramian Angular Difference Field and Improved Dual Attention Residual Network Sensors · Multidisciplinary Digital Publishing Institute · 2024 10.3390/s24072156
  30. Transformer-based intelligent fault diagnosis methods of mechanical equipment: A survey Open Physics · De Gruyter Open · 2024 10.1515/phys-2024-0015
  31. Multi-resolution short-time Fourier transform providing deep features for 3D CNN to classify rolling bearing fault vibration signals Engineering Research Express · IOP Publishing · 2024 10.1088/2631-8695/ad5d52
  32. A novel adaptive gramian angle field based intelligent fault diagnosis for motor rolling bearings Journal of Physics Conference Series · IOP Publishing · 2024 10.1088/1742-6596/2785/1/012042
  33. A high-performance rolling bearing fault diagnosis method based on adaptive feature mode decomposition and Transformer Applied Acoustics · Elsevier BV · 2024 10.1016/j.apacoust.2024.110156
  34. Fault diagnosis method for rotating machinery based on SEDenseNet and Gramian Angular Field Eksploatacja i Niezawodnosc - Maintenance and Reliability · 2024 10.17531/ein/191445
  35. Review on deep learning classifiers for faults diagnosis of rotating industrial machinery Service Oriented Computing and Applications · Springer Science+Business Media · 2024 10.1007/s11761-024-00418-7
  36. Intelligent Fault Diagnosis Method for Rotating Machinery Based on Recurrence Binary Plot and DSD-CNN Entropy · Multidisciplinary Digital Publishing Institute · 2024 10.3390/e26080675
  37. Gearbox fault diagnosis based on Gramian angular field and TLCA-MobileNetV3 with limited samples International Journal of Metrology and Quality Engineering · EDP Sciences · 2024 10.1051/ijmqe/2024004
  38. Research on Fault Diagnosis of Rolling Bearing Based on Gramian Angular Field and Lightweight Model Sensors · Multidisciplinary Digital Publishing Institute · 2024 10.3390/s24185952
  39. Convolution Transformer Based Fault Diagnosis Method For Aircraft Engine Bearings 2024 10.23919/ccc63176.2024.10662769
  40. Depth Information Assisted Collaborative Mutual Promotion Network for Single Image Dehazing 2024 10.1109/cvpr52733.2024.00275
  41. A novel multi-scale convolutional neural network incorporating multiple attention mechanisms for bearing fault diagnosis Measurement · Elsevier BV · 2024 10.1016/j.measurement.2024.115927
  42. Bearing fault diagnosis method for unbalance data based on Gramian angular field Journal of Intelligent & Fuzzy Systems · IOS Press · 2024 10.3233/jifs-233797
  43. MT-ConvFormer: A Multitask Bearing Fault Diagnosis Method Using a Combination of CNN and Transformer IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2024 10.1109/tim.2024.3502821
  44. A comprehensive review of deep learning-based fault diagnosis approaches for rolling bearings: Advancements and challenges AIP Advances · American Institute of Physics · 2025 10.1063/5.0255451
  45. Bearing fault diagnosis based on efficient cross space multiscale CNN transformer parallelism Scientific Reports · Nature Portfolio · 2025 10.1038/s41598-025-95895-x
  46. Multi scale convolutional neural network combining BiLSTM and attention mechanism for bearing fault diagnosis under multiple working conditions Scientific Reports · Nature Portfolio · 2025 10.1038/s41598-025-96137-w