# Combining Contrastive Learning with Auto-Encoder for Out-of-Distribution Detection
## 2 Related Work
### OOD Detection
#### 2.1.1 Supervised Learning Methodology  
In the context of supervised learning, the methodology falls into three categories: the closed-set classifier-based detector, outlier exposure detector, and distance-based detector. Closed-set classifiers are still deployed as mainstream OOD detectors, leveraging the maximum softmax probability (MSP) to threshold the OOD samples, and it is proven there is a close relationship between the classification accuracy of a model and its open-set recognition performance [5]. [PERSON] and [PERSON] [6] first put forward a baseline for detecting misclassified and OOD examples in neural networks, which leverage MSP as the threshold to detect OOD samples. In this framework, great efforts are devoted to improving the feature representation ability such that the trained model can confidently detect outliers from the real world [7]. [PERSON] et al. [8] illustrated that the performance of OOD detection can degrade significantly when the number of in-distribution classes increases, so they proposed to decompose the large semantic space into smaller groups with similar concepts, which allows for simplifying the decision boundaries between known and unknown data. In addition, the confidence given by softmax limits the representation ability, as significantly different logits may output the same softmax probability. Some research has attempted to use the logits before the softmax layer to detect OOD [9; 10], while others have tried to calibrate the softmax probabilities to improve the performance [3; 11; 12; 13]. [PERSON] et al. [14] proposed using the energy score derived from the logit outputs for OOD detection and demonstrated superiority over the softmax score. Energy-based models map each input X to a single deterministic point that is called energy. [PERSON] et al. [15] proposed the Joint Energy criterion as a simple and effective method that estimates the OOD indicator scores by aggregating label-wise energy scores from multiple labels.  
Another research line is to train a classifier that treats the OOD samples as an additional new class. The classifier is trained with samples from a variety of sources in different research. For example, some OOD samples are derived from accessible auxiliary outlier datasets, some are generated with a GAN-based approach, and others are even crawled from the internet [16; 17; 18; 19; 20]. After a comparison between the effectiveness of different sources of OOD data, much attention has been paid to improving the generalization capability and robustness of the detector by utilizing fake or counterfactual OOD samples [21; 22; 23]. Compared to softmax or OpenMax, a distance-based detector decreases the risk factor [24]. Utilizing the labels, a set of prototypes or reciprocal points are learned to detect the OOD samples based on the distance concerning each prototype [25]. However, [PERSON] et al. [26] and [PERSON] et al. [27] claimed that a global average pooling can destroy image structures and result in compromised discriminative local representations of the target objects. [PERSON] et al. [28] proposed a balanced energy regulation loss that utilizes class-wise different prior probabilities for auxiliary data to address the class balance in OOD data.