# Combining Contrastive Learning with Auto-Encoder for Out-of-Distribution Detection
## 1 Introduction  
Due to the dramatic performance improvement in deep learning, a variety of powerful deep models have evolved and extended to occur in crucial scenarios like disease diagnosis and autonomous driving, which require high reliability and robustness. In the context of deep learning, out-of-distribution (OOD) refers to data points or samples that are different from or not well-represented by the data distribution the model was trained on. When a model encounters OOD data, its predictions or classifications may be unreliable or incorrect, as it lacks the knowledge or ability to make accurate assessments of these unfamiliar samples. For example, autonomous vehicles must operate in diverse and dynamic environments, including urban, suburban, and rural areas, each with unique challenges. If the vehicle encounters an entirely new object or an unusual environmental condition,the system should be able to recognize it as OOD and take the appropriate action, such as slowing down or requesting human intervention. However, the deployment of the trained models can suffer from disastrous failure because of distribution failure without filtering the OOD data [1]. Therefore, the perception of unknown/unseen/novel/OOD samples from test-time data has been a basic yet challenging open problem in the development of deep models. Various methods and techniques have been developed to improve OOD detection and make deep-learning models more robust in the face of unexpected data. In general, the tasks in this domain can be divided into anomaly detection, open-set detection, and OOD detection based on the source of the classes and the aims of the models [2]. An anomaly detection model aims to detect a novel class different from the class with which the model is trained, and there is only one known class. The open-set detection model needs to distinguish the known data from the unknown and further classify the known data into specific classes it has witnessed during training, and there are multiple classes in the training period. OOD detection tries to discriminate OOD instances from in-distribution ones, and the OOD instances come from the real world, which means the OOD instances do not belong to any specific datasets. Note, however, that the unknown samples are derived from some specific datasets, while the OOD detection deals with the samples without any limitation. Considering the differences above, OOD detection is the most helpful in the real-world application of deep models due to its robustness and reliability. However, compared with other tasks, OOD detection is also the most challenging problem because of limited access to labels and infinite unknown distributions. The purpose of OOD detection is to classify the samples that are semantically different from the training data into an unknown class [3]. Based on the frameworks, the methodologies fall into two main frameworks: discrimination and generative categories. The models have made rapid progress, along with advances in deep-learning architectures, algorithms, and training techniques. However, their performance improves at the cost of large amounts of labeled data, which are costly and impossible for most real-world applications. Because of that, unsupervised learning methods, which are trained on unlabeled data, have attracted growing attention on this topic in the past decade. Unsupervised OOD detection has a rich history, with roots tracing back to the work of [4], well before the advent of deep learning. One of the fundamental advantages of unsupervised learning lies in its ability to efficiently utilize unlabeled data, which is often more readily available compared to labeled data. In addition, unsupervised learning methods are particularly advantageous due to their scalability, making them well-suited for analyzing large datasets and handling big data applications. Given these characteristics, unsupervised learning presents a viable approach for addressing OOD detection challenges in real-world scenarios.