# Contrastive Learning Based on Transformer for Hyperspectral Image Classification
## 4 Experimental Descriptions and Result Analysis
### Result Analysis  
In this study, we used the overall accuracy (OA) and average accuracy (AA) as performance evaluation metrics. OA is the proportion of correctly classified samples to all samples; AA represents the average of classification accuracy for each category. We adopted six other methods as baselines. These models contain three supervised methods: linear discriminant analysis (LDA) [25], deep convolutional neural network (1D-CNN) [26], and supervised deep feature extraction (S-CNN) [27]; and three unsupervised methods: 3D convolutional autoencoder(3 DCAE) [16], adversarial autoencoder [28], and variational autoencoder [28]. The classification results with IP are shown in Table 3 and Figure 6. These results show that our model achieves the best performance with IP. As IP is more difficult to be classified among these three public datasets, we conclude that our model is superior to the others. The classification results with SV are presented in Table 4 and Figure 7. Similar to IP, our proposed method performed the best in 10 classes and approached the best performance in the other six classes. However, according to the results in UP demonstrated in Table 5 and Figure 8, the AA of our model is second only to the AA of AAE among all seven models. We presume this is due to the small number of training samples in the last category. Considering the overall performance, our findings demonstrate the feasibility of deep-learning-based hyperspectral image classification without convolution. Based on the above experimental results, the transformer is a promising model for hyperspectral image classification that warrants further investigation. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **Projector** & & & **Predictor** & \\ \hline \multirow{2}{*}{**Layer (Type)**} & **Output** & \multirow{2}{*}{**Parameters**} & \multirow{2}{*}{**Layer (Type)**} & **Output** & \multirow{2}{*}{**Parameters**} \\  & **Shape** & & & & \\ \hline Linear & \([-1,\,1024]\) & 263,168 & Linear & \([-1,\,1024]\) & 66,560 \\ BatchNorm1d & \([-1,\,1024]\) & 2048 & BatchNorm1d & \([-1,\,1024]\) & 2048 \\ ReLU & \([-1,\,1024]\) & 0 & ReLU & \([-1,\,1024]\) & 0 \\ Linear & \([-1,\,64]\) & 65,600 & Linear & \([-1,\,64]\) & 65,600 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The structures of our projector and predictor. Figure 6: The classification maps of IP. (**a–c**) Classification results of AAE, VAE, and our proposed model, respectively. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Class** & \multicolumn{3}{c}{**Supervised Feature Extraction**} & \multicolumn{3}{c}{**Unsupervised Feature Extraction**} \\ \hline  & **LDA** & **1D-CNN** & **S-CNN** & **3 DCAE** & **AAE** & **VAE** & **Proposed** \\ \hline
1 & 99.16 & 97.98 & 99.55 & **100.00** & 99.98 & 99.74 & **100.00** \\
2 & 99.94 & 99.25 & 99.43 & 99.29 & **100.00** & 99.79 & **100.00** \\
3 & 99.79 & 94.43 & 98.81 & 97.13 & **100.00** & **100.00** & **100.00** \\
4 & **99.77** & 99.42 & 97.45 & 97.91 & 99.09 & 99.57 & 98.17 \\
5 & 98.98 & 96.60 & 97.96 & 98.26 & 99.42 & **99.71** & 98.55 \\
6 & 99.89 & 99.51 & 99.83 & **99.98** & 99.97 & 99.86 & 99.49 \\
7 & 99.97 & 99.27 & 99.59 & 99.64 & 99.93 & 99.96 & **100.00** \\
8 & 81.84 & 86.79 & 94.40 & 91.58 & 91.21 & 86.91 & **100.00** \\
9 & 99.90 & 99.08 & 98.85 & 99.28 & 99.69 & **99.99** & 99.83 \\
10 & 96.31 & 93.71 & 97.35 & 96.65 & 98.46 & 96.54 & **100.00** \\
11 & 99.61 & 94.55 & 97.71 & 97.74 & 99.57 & **100.00** & 98.92 \\
12 & 99.67 & 99.59 & 98.73 & 98.84 & **100.00** & 99.44 & **100.00** \\
13 & 99.20 & 97.50 & 96.72 & 99.26 & **99.89** & 97.24 & 98.97 \\
14 & 96.56 & 94.08 & 95.22 & 97.49 & 99.08 & 96.49 & **100.00** \\
15 & 73.60 & 66.52 & 95.61 & 87.85 & 93.69 & 87.90 & **99.43** \\
16 & 98.48 & 97.48 & 99.44 & 98.34 & 99.73 & 99.61 & **100.00** \\ AA(\%) & 96.42 & 94.73 & 97.39 & 97.45 & 98.73 & 97.67 & **99.58** \\ OA(\%) & 92.18 & 91.30 & 97.92 & 95.81 & 97.10 & 95.23 & **99.71** \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Classification results of different models in SV.