# A New Defect Diagnosis Method for Wire Rope Based on CNN-Transformer and Transfer Learning
## 4 Case Studies
### Experiments  
#### 4.4.1 Comparison Experiments  
Comparison experiments were conducted to present the advantages and effectiveness of the DCNNT model proposed in this study. Several benchmark methods were selected for the comparison, namely, ELM [35], k-nearest neighbor (KNN) [36], backpropagation network (BP), and SVM. Furthermore, three SOTA approaches were also compared to substantiate the superiority of the proposed algorithm, namely 2D time-frequency image detection based on continuous wavelet transform and CNN (CWTCNN) [37], 1D time-sequence wire rope defect diagnosis based on the standard transformer (Transformer1D), and the deep residual learning network (ResNet) [38]. For the KNN, the selection of \(K\) was crucial for the prediction results. To determine the optimal \(K\) value, a range of values ranging from 0 to 200 were tested and the best performance was the result, while the corresponding \(K\) value was selected for cross-domain experiments. The numbers of neurons in the input, hidden, and output layers of ELM and BP were set as 100, 112, and 2, respectively. The parameters of SVM, kernel function, cost parameter \(c\), and kernel parameter \(\gamma\), were set as the radial basis function (RBF) 1 and 0.1, respectively. The structure of CWTCNN was proposed by [PERSON] et al. in 2022 and achieved a better performance for the diagnosis of broken wires. Thus, the original network structure and image processing method were preserved, while the length of the input LMA signal changed to 100 to ensure fairness during the comparison experiments. Transformer1D is a variant of DCNNT without the CNN component, and its input is the time domain LMA signals. This was performed to prove the ability of the CNN to reduce computational costs and improve inference speed. ResNet is an excellent network used for classification tasks; 50 residual layers were established in this study to conduct comparison experiments. Firstly, to present a clearer presentation of the effectiveness of the proposed DCNNT network, experiments were conducted under the same training and test conditions without cross-domain scenarios. According to the group list presented in Table 4, the dataset was split at a ratio of 4:1 for the training and test sets. A 10-fold cross-validation was conducted and the average accuracy results are presented in Figure 11 and Table 7. It can be observed that the proposed DCNNT network significantly outperforms the other methods in most of the groups. The reason was that the combination of the CNN and transformer improved \begin{table}
\begin{tabular}{c c c c} \hline \hline  & \multicolumn{3}{c}{**True Class**} \\  & & **Positive** & **Negative** \\ \hline \multirow{2}{*}{Predicted Class} & Positive & Ture positive (TP) & False positive (FP) \\  & Negative & False negative (FN) & Ture negative (TN) \\ \hline \hline \end{tabular}  
TP denotes the positive samples correctly predicted as positive. FP represents the negative samples incorrectly predicted as positive. Similarly, FN and TN can be obtained.  
\end{table} 
Table 6: Confusion matrix for accurate calculation. the ability of feature extraction and generalization. Although Transformer1D achieved the best performance in group D, its higher computational cost was not beneficial for practical applications, and this was analyzed in the subsequent discussion. The generalization of the TL architecture and the DCNNT model was studied through cross-domain experiments which are training the DCNNT model using the source domain dataset and fine-tuning the trained model using a small target domain dataset. Similarly, 10-fold cross-validations were conducted to guarantee the credibility of the results. According to the results presented in Figure 12 and Table 8, the DCNNT model achieved a higher detection accuracy compared to the other methods. Thus, the best performance was generated by DCNNT-5% which is based on DCNNT and TL architecture using only a 5% target domain dataset for fine-tuning purposes.