# Combining Contrastive Learning with Auto-Encoder for Out-of-Distribution Detection
## 4 Experiments
### Comparisons with Other Methods  
Table 2 presents the comparisons of the proposed method with other different OOD detection methods. From the table, we can find that our method significantly improves the average AUROC when compared to other OOD detection methods, including those based on input reconstruction (such as the auto-encoder and variational auto-encoder) and one-class classification (specifically, deep-SVDD). One common limitation of these three detectors is their tendency to misclassify images from the SVHN dataset as being more in-distribution when they are trained on the CIFAR-10 or CIFAR-100 datasets. In contrast, our method demonstrates its capability to effectively identify a significant portion of outliers within the SVHN dataset. Additionally, we conducted experiments with rotation-loss, which is a non-contrastive self-supervised training objective. Our findings indicate that our method achieves a higher AUROC in general. Our method is inspired by the SSD [44] that only uses a contrastive learning framework for OOD detection. Our method takes the framework of the SSD as a backbone and adds an auto-encoder module at the end of it to fit a distribution space of datasets. The results in Table 3 show that our method has the best performance with the LSUN and Places365 datasets, where it improves the AUROC by 3% when the CIFAR-10 dataset is an in-distribution dataset, and improves theAUROC by about 25% when the CIFAR-100 dataset is an in-distribution dataset, compared with the SSD. In terms of the DTD dataset, our method performs best when the CIFAR-10 dataset is an in-distribution dataset and is placed second when the CIFAR-100 dataset is an in-distribution dataset. As for the SVHN \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**In-Distribution** & **Out-of-Distribution** & **FPR95 \(\downarrow\)** & **AUROC \(\uparrow\)** & **AUPR \(\uparrow\)** \\ \hline \multirow{4}{*}{CIFAR-10} & SVHN & 4.5 & 99.1 & 99.6 \\  & DTD & 5.2 & 98.9 & 98.4 \\ \cline{1-1}  & LSUN & 3.0 & 99.4 & 99.4 \\ \cline{1-1}  & Place365 & 5.4 & 98.9 & 99.0 \\ \cline{1-1}  & iNaturalist & 3.6 & 99.3 & 99.3 \\ \hline \multirow{4}{*}{CIFAR-100} & SVHN & 10.2 & 97.8 & 99.1 \\ \cline{1-1}  & DTD & 28.7 & 93.0 & 90.3 \\ \cline{1-1}  & LSUN & 21.1 & 96.0 & 95.8 \\ \cline{1-1}  & Place365 & 25.0 & 95.2 & 95.0 \\ \cline{1-1}  & iNaturalist & 26.2 & 94.6 & 94.6 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Results on five commonly used OOD detection datasets. \(\uparrow\) means larger is better and \(\downarrow\) indicates smaller is better. All values are in % format. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**In-Distribution** & **CIFAR-10** & **CIFAR-10** & **CIFAR-100** & **CIFAR-100** \\
**Out-of-Distribution** & **SVHN** & **CIFAR-100** & **SVHN** & **CIFAR-10** \\ \hline Autoencoder [53] & 2.5 & 51.3 & 3.0 & 51.4 \\ VAE [59] & 2.4 & 52.8 & 2.6 & 47.1 \\ Deep-SVDD [17] & 14.5 & 52.1 & 16.3 & 51.4 \\ Rotation-loss [34] & 97.9 & **81.2** & 94.4 & 50.1 \\ Ours & **99.1** & 72.4 & **97.8** & **53.4** \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparisons of the proposed method with different OOD detection methods. The metric in the table is AUROC. All values are in % format. dataset, our method has an extremely similar AUROC with SSD, where the difference is only 0.5%, and it improves the AUROC by 2.9% when the CIFAR-100 dataset is an in-distribution dataset. We argue that because the auto-encoder fits the unique distribution for each dataset, our method can have such good performance on these datasets, while, when it comes to identifying CIFAR-10 and CIFAR-100 datasets, the performance of our method is not satisfactory--it has a large gap with the SSD. We think the reason is that these two datasets are very similar, and the number of classes is relatively large, resulting in the auto-encoder failing to build a distinguished distribution for the datasets. A good attempt is to increase the number of auto-encoders to obtain a more powerful fitting ability.