# Research on Fault Diagnosis of Marine Diesel Engines Based on CNN-TCN-ATTENTION
## 3 Experiment
### Contrast Experiment  
To further validate the performance of the CNN-TCN-ATTENTION model, four popular deep learning models, namely Transformer, GRU, LSTM, and DBN, are selected for comparison. The dataset is input into each of the four comparison models, and to minimize randomness, each model is run 10 times, with the average result taken. The results are shown in Table 10, and the evaluation results for each model are presented in Figure 16. The experimental results indicate that the CNN-TCN-ATTENTION model achieves state-of-the-art performance in marine diesel engine fault diagnosis tasks. Although the LSTM and Transformer models achieve accuracy rates exceeding 90% in the test set and have shorter runtimes, there remains a noticeable performance gap compared to the CNN-TCN-ATTENTION model. Furthermore, the GRU and DBN exhibit unsatisfactory accuracy in the test set. Overall, the CNN-TCN-ATTENTION model demonstrates significant advantages. To highlight the specific classification performance of different diagnostic algorithms for faults, in addition to the aforementioned accuracy and runtime, this study also analyzes the precision and recall of each diagnostic algorithm. The results are presented in Table 11.  
As shown in Table 11, most algorithms can accurately classify normal operating conditions. However, the complexity of engine fault data leads to relatively poor classification performance for the GRU and DBN, which are less sensitive to temporal features. Although Transformer and LSTM achieve higher precision for each fault category compared to the GRU and DBN, their recall rates for condition F3 are relatively low. Furthermore, the precision of Transformer and LSTM in conditions F1 and F2 is lower than that of the proposed CNN-TCN-ATTENTION model. The CNN-TCN-ATTENTION model achieves 100% accuracy and recall across all conditions, demonstrating a significant advantage over the other diagnostic algorithms and better aligning with practical industrial requirements. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Algorithms** & **Test Accuracy \%** & **Running Time/s** \\ \hline CNN-TCN–ATTENTION & 100 & 29 \\ Transformer & 90.62 & 22 \\ LSTM & 93.13 & 23 \\ GRU & 83 & 19 \\ DBN & 84.4 & 20 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Comparison of diagnostic accuracy across different models. \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline
**Algorithms** & \multicolumn{4}{c}{**Precision**} & \multicolumn{4}{c}{**Recall**} \\ \cline{2-9}  & **F0** & **F1** & **F2** & **F3** & **F4** & **F0** & **F1** & **F2** & **F3** & **F4** \\ \hline CNN-TCN–ATTENTION & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ Transformer & 1 & 0.81 & 0.83 & 1 & 1 & 1 & 1 & 0.48 & 1 \\ LSTM & 1 & 0.78 & 1 & 1 & 1 & 1 & 1 & 0.62 & 1 \\ GRU & 1 & 0.68 & 1 & 0.76 & 1 & 1 & 0.57 & 1 & 1 & 1 \\ DBN & 1 & 1 & 1 & 1 & 1 & 0.22 & 1 & 1 & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 11: Precision and recall for each algorithm. As shown in Figure 16, the four comparison algorithms exhibit varying degrees of misclassification under conditions F1, F2, F3, and F4. In contrast, the confusion matrix in Figure 14d illustrates that the proposed CNN-TCN-ATTENTION model achieves complete recognition for each fault type. This indicates that the CNN-TCN-ATTENTION model can extract more information from the data, thereby enhancing the classification accuracy and stability of the diagnostic algorithm, outperforming the other models. The experimental data show that the CNN-TCN-ATTENTION model achieves excellent results in the marine diesel engine fault diagnosis task. Specifically, as shown in Figure 16, the LSTM model, which is currently the most widely used, has the highest accuracy (93.13%) out of the four models used for comparison. However, its performance in the validation set is poor, with significant fluctuations in the accuracy curve, indicating its instability.