Skip to content

Universal Novelty Detection Through Adaptive Contrastive Learning (CVPR 2024)

License

Notifications You must be signed in to change notification settings

rohban-lab/UNODE

Repository files navigation

Universal Novelty Detection Through Adaptive Contrastive Learning

Official PyTorch implementation of "Universal Novelty Detection Through Adaptive Contrastive Learning" (CVPR 2024) by Hossein Mirzaei, Mojtaba Nafez, Mohammad Jafari, Mohammad Bagher Soltani, Jafar Habibi, Mohammad Sabokrou, and MohammadHossein Rohban.

Requirements

Environments

Datasets

Dataset Download Link:

Training

To train our models, run this command:

python train.py --model $model --epochs $epochs --eval_steps $eval_steps --normal_class $normal_class --normal_data_count $normal_data_count --image_size $image_size --dataset $dataset --batch_size $batch_size --outlier_dataset $outlier_dataset
  • The option --normal_class denotes the in-distribution for one-class training.

  • For multi-class training, set --outlier_dataset as the OOD target dataset, and --dataset will be the determined ID dataset.

Note: The config.json file specifies the probability of each negative transformation used during training. This probability distribution is determined by the AutoAugOOD module in AutoAugOOD.ipynb individually for each dataset and each normal class.

Evaluation

We provide the checkpoint of the Unode pre-trained model. Download the checkpoint from the following link:

To evaluate our model, run this command:

python ./eval.py --normal_class $normal_class --image_size $image_size --dataset $dataset --model $model --print_score --ood_samples 10 --resize_factor 0.54 --resize_fix --load_path $load_path 
  • The option --normal_class denotes the in-distribution for one-class training.

  • For multi-class training, set --outlier_dataset as the OOD target dataset, and --dataset will be the determined ID dataset.

  • The resize_factor & resize fix option fix the cropping size of RandomResizedCrop().

Notebook

Google Colab notebook as an example of training and evaluation.

Citation

@InProceedings{Mirzaei_2024_CVPR,
    author    = {Mirzaei, Hossein and Nafez, Mojtaba and Jafari, Mohammad and Soltani, Mohammad Bagher and Azizmalayeri, Mohammad and Habibi, Jafar and Sabokrou, Mohammad and Rohban, Mohammad Hossein},
    title     = {Universal Novelty Detection Through Adaptive Contrastive Learning},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2024},
    pages     = {22914-22923}
}

About

Universal Novelty Detection Through Adaptive Contrastive Learning (CVPR 2024)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published