  One-class classification (OCC), i.e., identifying whether an example belongs
to the same distribution as the training data, is essential for deploying
machine learning models in the real world. Adapting the pre-trained features on
the target dataset has proven to be a promising paradigm for improving OCC
performance. Existing methods are constrained by assumptions about the number
of classes. This contradicts the real scenario where the number of classes is
unknown. In this work, we propose a simple class-agnostic adaptive feature
adaptation method (CA2). We generalize the center-based method to unknown
classes and optimize this objective based on the prior existing in the
pre-trained network, i.e., pre-trained features that belong to the same class
are adjacent. CA2 is validated to consistently improve OCC performance across a
spectrum of training data classes, spanning from 1 to 1024, outperforming
current state-of-the-art methods. Code is available at
https://github.com/zhangzilongc/CA2.
