## 2 Materials and Methods
### Methods
#### 2.2.1 Overview
\begin{table}
\begin{tabular}{c c c c} \hline
**Dataset** & **MCC5** & **HUST** & **Total** \\ \hline
4 s extraction & 3360 & 180 & 3540 \\
10 s extraction & 1440 & 90 & 1530 \\ \hline \end{tabular}
\end{table} 
Table 1: Comparison of sample counts generated by different sampling strategies. Figure 5: Time segment extraction. ```
Input: Raw vibration data files in CSV format. N was the length of the CSV format. Output: GAF image features in NPY format. 1. Global parameters initialization: scaler, paa, gasf, gadf, counter;
2. function get_gasf (X, sample_hz = 12,800, label = 0)
3. X \(\leftarrow\) X [1:N]
4. Xnorm \(\leftarrow\) scaler.fit_transform (X)
5. sample_split \(\leftarrow\) [[i, i + 6] for i \(\in\) {0, 4, \(\ldots\), 52}]
6. for sample \(\in\) sample_split do
7. counter \(\leftarrow\) counter + 1
8. (start, end) \(\leftarrow\) (sample [0] \(\times\) sample_hz, sample [1] \(\times\) sample_hz)
9. segment \(\leftarrow\) Xnorm [startend]
10. for ch \(\in\) {0, 1, \(\ldots\), 7} do
11. segment_ch \(\leftarrow\) segment[:, ch].reshape(1, \(-\)1)
12. segment_red \(\leftarrow\) paa.fit_transform(segment_ch)
13. combined \(\leftarrow\) concat(_gasf,_gadf, axis = 0)
14. gaf_feature \(\leftarrow\) concat(gat_features, axis = 0)
15. np.save(npy_file, gaf_feature)
16. function get_files()
17. return [f for f \(\in\) os.listdir(directory) if f.endswith(end_s)]
18. function read_csv_as_floats(file_path)
19. with open(file_path, 'r') as file:
20. for row \(\in\) reader do
21. row \(\leftarrow\) row[:8]
22. if len(row) < 8 then
23. row \(\leftarrow\) row + [0.0] \(\times\) (8 \(-\) len(row))
24. data.append([float(x) for x \(\in\) row])
25. return np.array(data)
```

**Algorithm 2** Data preprocessing

Figure 6: Data preprocessing. #### 2.2.3 Depthwise Feature Extractor

To further enhance the model's ability to model key fault features in time-series signals from complex operating conditions, the DWFE is introduced before the ViT encoding module in the transformer backbone structure. The input to DWFE are the GAF images generated by merging the GASF- and GADF-processed MCC and HUST gearbox dataset operating condition data. The DWFE utilizes depthwise convolution [46] to perform local feature extraction and high-frequency enhancement on GAF images, effectively capturing fine-grained feature representations of the input signals at different spatial scales. It also employs a channel dimensionality reduction mechanism to achieve feature compression and redundancy removal. The output of this module is used as the input to the ViT, significantly improving the transformer encoder's global modeling capability of complex time-series information. On this basis, the ViT encoder further models the long-term dependencies in the input sequence using its global self-attention mechanism, enabling the collaborative learning of local and global features and enhancing the model's ability to discern the operational state and potential fault behaviors of the equipment. The derivation of the following formulas was referenced from literature [46]. As shown in Figure 7, the first layer of the CNN encoder module uses a \(3\times 3\) convolution to capture the local spatial features of the GAF image \(X\in\mathbb{R}^{W\times H\times C}\), followed by a batch normalization layer to stabilize the training process. \[X_{gaf}=H\textit{swish}\Big{(}BN\Big{(}Conv_{3\times 3}\Big{(}X_{gaf}\Big{)} \Big{)}\Big{)} \tag{1}\]

\[H\textit{swish}(X)=X.\frac{ReLU6(x+3)}{6} \tag{2}\]

\[ReLU6=\min(max(0,x),6) \tag{3}\]

Hswish [47], a lightweight improvement based on the Swish function, is able to better capture the nonlinear characteristics of complex data compared to traditional activation functions. Hswish gradually approaches zero for smaller input values instead of being directly truncated to zero. This property makes it smoother than \(ReLU\) and more effective at handling gradient information. To achieve effective multi-scale feature extraction while maintaining low computational overhead, a modular structure based on DW Conv was designed in this paper.