Fine-Tuning Pre-trained Model with Prototype Learning for OOD Detection
摘要
Out-of-distribution (OOD) detection primarily learns the in-distribution (ID) representation to distinguish OOD samples from ID classes. Recent methods often fine-tune a pre-trained model with classification objective (cross-entropy, CE) to learn ID representation, disregarding the discrimination between ID and unknown OOD. In this work, we propose to fine-tune pre-trained models in the framework of open-set recognition, which trains a multi-class classifier with ID samples while considering OOD rejection according to distances to ID classes. We adopt prototype learning, which aims to discriminate the ID classes while guiding compact distributions for ID classes in the feature space. The compact ID distributions favor classification and OOD detection using distances, including Euclidean distance and Mahalanobis distance. We evaluated the method on various backbone architectures including ResNet, ViTs and BEiT, and the results show that the prototype learning method on pre-trained models outperforms classification-based method and produces state-of-the-art performance in OOD detection.