[Paper Review] OCFormer: One-Class Transformer Network for Image Classification
OCFormer proposes a novel Vision Transformer-based one-class classification framework that enhances representation learning by injecting zero-centered Gaussian noise as a pseudo-negative class in the latent space. The method achieves state-of-the-art performance on CIFAR-10, CIFAR-100, Fashion-MNIST, and CelebA eyeglasses datasets, outperforming existing CNN-based one-class classifiers by up to 6.7% in mean AUC.
We propose a novel deep learning framework based on Vision Transformers (ViT) for one-class classification. The core idea is to use zero-centered Gaussian noise as a pseudo-negative class for latent space representation and then train the network using the optimal loss function. In prior works, there have been tremendous efforts to learn a good representation using varieties of loss functions, which ensures both discriminative and compact properties. The proposed one-class Vision Transformer (OCFormer) is exhaustively experimented on CIFAR-10, CIFAR-100, Fashion-MNIST and CelebA eyeglasses datasets. Our method has shown significant improvements over competing CNN based one-class classifier approaches.
Motivation & Objective
- Address the challenge of one-class classification in highly imbalanced or skewed datasets where negative samples are absent.
- Overcome the limitations of traditional generative and discriminative methods in high-dimensional data representation.
- Leverage the representational power of Vision Transformers (ViT) for improved one-class classification performance.
- Mitigate the hypersphere collapse problem common in deep one-class classifiers through a novel noise-augmented latent space strategy.
- Demonstrate the effectiveness of ViT-based models in one-class classification, a largely unexplored area in prior work.
Proposed method
- Use a pre-trained Vision Transformer (ViT) as a feature extractor to encode input images into a high-dimensional latent space.
- Inject zero-centered Gaussian noise as a pseudo-negative class into the latent space representation to simulate outlier data.
- Train the classifier using an optimal loss function that encourages compactness of positive samples and separation from the pseudo-negative noise.
- Concatenate the original latent features with the injected noise vectors before feeding them into a downstream classifier head (MLP, SVM, or KDE).
- Employ standard regularization techniques to prevent overfitting despite increased model capacity from larger ViT architectures.
- Utilize ablation studies to analyze the impact of batch size, latent dimension, and classifier depth on model performance.
Experimental results
Research questions
- RQ1Can Vision Transformers be effectively adapted for one-class image classification without relying on real negative samples?
- RQ2How does injecting zero-centered Gaussian noise as a pseudo-negative class improve representation learning in one-class settings?
- RQ3What is the optimal configuration of latent dimension, batch size, and classifier depth for ViT-based one-class classification?
- RQ4How does OCFormer compare to state-of-the-art one-class classifiers in terms of AUC performance across diverse benchmarks?
- RQ5Does the use of ViT-based feature extraction lead to better generalization than CNN-based counterparts in one-class classification tasks?
Key findings
- OCFormer with ViT-large achieved a mean AUC of 96.58% across CIFAR-10, CIFAR-100, Fashion-MNIST, and CelebA eyeglasses datasets, outperforming all baselines.
- The model achieved 98.72% AUC-ROC on CIFAR-10 using ViT-base with a latent dimension of 1000, significantly outperforming contrastive learning and PANDA methods.
- Latent dimension D=1000 consistently outperformed D=4096 across all experiments, indicating that higher-dimensional noise injection can degrade performance.
- Increasing the depth of the MLP classifier initially reduced performance but improved with deeper architectures, suggesting a non-monotonic optimization landscape.
- The Grad-CAM visualization confirmed that attention mechanisms focused on the target abnormality (eyeglasses), validating the model's interpretability and relevance.
- OCFormer achieved a 6.7% relative improvement in mean AUC over competing methods when using MLP and SVM classifiers on CIFAR-10 and CIFAR-100.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.