├── .gitignore ├── LICENSE ├── README.md ├── codespell_ignored.txt ├── configs ├── datasets │ ├── aircraft │ │ ├── aircraft.yml │ │ ├── aircraft_oe.yml │ │ └── aircraft_ood.yml │ ├── cifar10 │ │ ├── cifar10.yml │ │ ├── cifar10_double_label.yml │ │ ├── cifar10_extra.yml │ │ ├── cifar10_fsood.yml │ │ ├── cifar10_oe.yml │ │ └── cifar10_ood.yml │ ├── cifar100 │ │ ├── cifar100.yml │ │ ├── cifar100_double_label.yml │ │ ├── cifar100_extra.yml │ │ ├── cifar100_fsood.yml │ │ ├── cifar100_oe.yml │ │ └── cifar100_ood.yml │ ├── covid │ │ ├── covid.yml │ │ ├── covid_fsood.yml │ │ └── covid_ood.yml │ ├── imagenet │ │ ├── imagenet.yml │ │ ├── imagenet_double_label.yml │ │ ├── imagenet_double_label_fsood.yml │ │ ├── imagenet_fsood.yml │ │ └── imagenet_ood.yml │ ├── imagenet200 │ │ ├── imagenet200.yml │ │ ├── imagenet200_double_label.yml │ │ ├── imagenet200_double_label_fsood.yml │ │ ├── imagenet200_fsood.yml │ │ ├── imagenet200_oe.yml │ │ └── imagenet200_ood.yml │ ├── mnist │ │ ├── mnist.yml │ │ ├── mnist_fsood.yml │ │ └── mnist_ood.yml │ ├── mvtec │ │ ├── bottle.yml │ │ └── cable.yml │ ├── osr_cifar50 │ │ ├── cifar50_seed1.yml │ │ ├── cifar50_seed1_osr.yml │ │ ├── cifar50_seed2.yml │ │ ├── cifar50_seed2_osr.yml │ │ ├── cifar50_seed3.yml │ │ ├── cifar50_seed3_osr.yml │ │ ├── cifar50_seed4.yml │ │ ├── cifar50_seed4_osr.yml │ │ ├── cifar50_seed5.yml │ │ └── cifar50_seed5_osr.yml │ ├── osr_cifar6 │ │ ├── cifar6_seed1.yml │ │ ├── cifar6_seed1_osr.yml │ │ ├── cifar6_seed2.yml │ │ ├── cifar6_seed2_osr.yml │ │ ├── cifar6_seed3.yml │ │ ├── cifar6_seed3_osr.yml │ │ ├── cifar6_seed4.yml │ │ ├── cifar6_seed4_osr.yml │ │ ├── cifar6_seed5.yml │ │ └── cifar6_seed5_osr.yml │ ├── osr_mnist6 │ │ ├── mnist6_seed1.yml │ │ ├── mnist6_seed1_osr.yml │ │ ├── mnist6_seed2.yml │ │ ├── mnist6_seed2_osr.yml │ │ ├── mnist6_seed3.yml │ │ ├── mnist6_seed3_osr.yml │ │ ├── mnist6_seed4.yml │ │ ├── mnist6_seed4_osr.yml │ │ ├── mnist6_seed5.yml │ │ └── mnist6_seed5_osr.yml │ └── osr_tin20 │ │ ├── tin20_seed1.yml │ │ ├── tin20_seed1_osr.yml │ │ ├── tin20_seed2.yml │ │ ├── tin20_seed2_osr.yml │ │ ├── tin20_seed3.yml │ │ ├── tin20_seed3_osr.yml │ │ ├── tin20_seed4.yml │ │ ├── tin20_seed4_osr.yml │ │ ├── tin20_seed5.yml │ │ └── tin20_seed5_osr.yml ├── networks │ ├── arpl_gan.yml │ ├── arpl_net.yml │ ├── bit.yml │ ├── cider_net.yml │ ├── conf_branch.yml │ ├── csi_net.yml │ ├── cutpaste.yml │ ├── dcae.yml │ ├── draem.yml │ ├── dropout_net.yml │ ├── dsvdd.yml │ ├── godin_net.yml │ ├── lenet.yml │ ├── mcd_net.yml │ ├── mos.yml │ ├── npos_net.yml │ ├── opengan.yml │ ├── openmax.yml │ ├── patchcore_net.yml │ ├── rd4ad_net.yml │ ├── react_net.yml │ ├── repvgg.yml │ ├── resnet18_224x224.yml │ ├── resnet18_32x32.yml │ ├── resnet18_64x64.yml │ ├── resnet50.yml │ ├── rot_net.yml │ ├── rts_net.yml │ ├── simclr.yml │ ├── train_mos.yml │ ├── udg_net.yml │ ├── vit.yml │ └── vos_net.yml ├── pipelines │ ├── test │ │ ├── feat_extract.yml │ │ ├── test_acc.yml │ │ ├── test_arpl.yml │ │ ├── test_arplgan.yml │ │ ├── test_cutpaste.yml │ │ ├── test_draem.yml │ │ ├── test_dsvdd.yml │ │ ├── test_fsood.yml │ │ ├── test_kdad.yml │ │ ├── test_mos.yml │ │ ├── test_ood.yml │ │ ├── test_ood_aps.yml │ │ ├── test_opengan.yml │ │ ├── test_osr.yml │ │ ├── test_patchcore.yml │ │ └── test_rd4ad.yml │ └── train │ │ ├── baseline.yml │ │ ├── train_arpl.yml │ │ ├── train_arpl_gan.yml │ │ ├── train_augmix.yml │ │ ├── train_cider.yml │ │ ├── train_conf_branch.yml │ │ ├── train_csi.yml │ │ ├── train_cutmix.yml │ │ ├── train_cutpaste.yml │ │ ├── train_dcae.yml │ │ ├── train_draem.yml │ │ ├── train_dropout.yml │ │ ├── train_dsvdd.yml │ │ ├── train_ece.yml │ │ ├── train_kdad.yml │ │ ├── train_logitnorm.yml │ │ ├── train_mcd.yml │ │ ├── train_mixoe.yml │ │ ├── train_mixup.yml │ │ ├── train_mos.yml │ │ ├── train_npos.yml │ │ ├── train_oe.yml │ │ ├── train_opengan.yml │ │ ├── train_opengan_feat_extract.yml │ │ ├── train_rd4ad.yml │ │ ├── train_regmixup.yml │ │ ├── train_sem.yml │ │ ├── train_udg.yml │ │ └── train_vos.yml ├── postprocessors │ ├── _gmm_iter │ │ ├── cifar_gmm_0.yml │ │ ├── cifar_gmm_1.yml │ │ ├── cifar_gmm_2.yml │ │ ├── cifar_gmm_3.yml │ │ ├── cifar_gmm_4.yml │ │ ├── covid_gmm_0.yml │ │ ├── mnist_gmm_0.yml │ │ ├── mnist_gmm_1.yml │ │ ├── mnist_gmm_2.yml │ │ ├── mnist_gmm_3.yml │ │ ├── mnist_gmm_4.yml │ │ └── mnist_gmm_5.yml │ ├── ash.yml │ ├── ebo.yml │ ├── godin.yml │ ├── gradnorm.yml │ ├── gram.yml │ ├── klm.yml │ ├── knn.yml │ ├── mds.yml │ ├── mds_ensemble.yml │ ├── mls.yml │ ├── msp.yml │ ├── nac │ │ ├── resnet │ │ │ ├── nac_cifar10.yml │ │ │ ├── nac_cifar100.yml │ │ │ └── nac_imagenet.yml │ │ └── vit │ │ │ └── nac_imagenet.yml │ ├── odin.yml │ ├── rankfeat.yml │ ├── react.yml │ ├── rmds.yml │ ├── rot.yml │ ├── rotpred.yml │ ├── she.yml │ ├── ssd.yml │ ├── temp_scaling.yml │ └── vim.yml └── preprocessors │ ├── augmix_preprocessor.yml │ ├── base_preprocessor.yml │ ├── csi_preprocessor.yml │ ├── cutout_preprocessor.yml │ ├── cutpaste_preprocessor.yml │ ├── draem_preprocessor.yml │ ├── patchcore_preprocessor.yml │ ├── pixmix_preprocessor.yml │ └── randaugment_preprocessor.yml ├── domainbed ├── README.md ├── benchmark_notes │ ├── __init__.py │ ├── coverage.py │ ├── instr_state.py │ ├── metrics.py │ ├── nethook.py │ └── utils.py ├── config.yaml ├── domainbed │ ├── algorithms │ │ ├── __init__.py │ │ ├── algorithms.py │ │ └── miro.py │ ├── datasets │ │ ├── __init__.py │ │ ├── datasets.py │ │ └── transforms.py │ ├── evaluator.py │ ├── hparams_registry.py │ ├── misc │ │ ├── domain_net_duplicates.txt │ │ └── model_selection.py │ ├── models │ │ ├── mixstyle.py │ │ ├── resnet_mixstyle.py │ │ └── resnet_mixstyle2.py │ ├── networks │ │ ├── __init__.py │ │ ├── backbones.py │ │ ├── networks.py │ │ └── ur_networks.py │ ├── optimizers.py │ ├── scripts │ │ ├── collect_results.py │ │ └── download.py │ ├── swad │ │ ├── swa_utils.py │ │ └── swad.py │ └── trainer_nac.py ├── param_config │ └── erm_config.yaml ├── requirements.txt ├── scripts │ ├── run_all_train.sh │ └── run_single_train.sh └── train_all.py ├── environment.yml ├── figures └── cifar10.png ├── imglist_generator.py ├── main.py ├── openood ├── __init__.py ├── datasets │ ├── __init__.py │ ├── base_dataset.py │ ├── feature_dataset.py │ ├── imglist_augmix_dataset.py │ ├── imglist_dataset.py │ ├── imglist_extradata_dataset.py │ ├── udg_dataset.py │ └── utils.py ├── evaluation_api │ ├── __init__.py │ ├── datasets.py │ ├── evaluator.py │ ├── postprocessor.py │ └── preprocessor.py ├── evaluators │ ├── __init__.py │ ├── ad_evaluator.py │ ├── arpl_evaluator.py │ ├── base_evaluator.py │ ├── ece_evaluator.py │ ├── fsood_evaluator.py │ ├── metrics.py │ ├── mos_evaluator.py │ ├── ood_evaluator.py │ ├── osr_evaluator.py │ ├── patchcore_evaluator.py │ └── utils.py ├── losses │ ├── __init__.py │ ├── draem_loss.py │ ├── focal.py │ ├── kdad_losses.py │ ├── rd4ad_loss.py │ ├── reweight.py │ ├── sce.py │ └── ssim.py ├── networks │ ├── __init__.py │ ├── arpl_net.py │ ├── ash_net.py │ ├── bit.py │ ├── cider_net.py │ ├── conf_branch_net.py │ ├── csi_net.py │ ├── de_resnet18_256x256.py │ ├── densenet.py │ ├── draem_net.py │ ├── dropout_net.py │ ├── dsvdd_net.py │ ├── godin_net.py │ ├── lenet.py │ ├── mcd_net.py │ ├── mmcls_featext.py │ ├── net_utils_.py │ ├── npos_net.py │ ├── opengan.py │ ├── openmax_net.py │ ├── patchcore_net.py │ ├── projection_net.py │ ├── react_net.py │ ├── resnet18_224x224.py │ ├── resnet18_256x256.py │ ├── resnet18_32x32.py │ ├── resnet18_64x64.py │ ├── resnet50.py │ ├── rot_net.py │ ├── rts_net.py │ ├── simclr_net.py │ ├── swin_t.py │ ├── temp.py │ ├── udg_net.py │ ├── utils.py │ ├── vit.py │ ├── vit_b_16.py │ └── wrn.py ├── pipelines │ ├── __init__.py │ ├── feat_extract_opengan_pipeline.py │ ├── feat_extract_pipeline.py │ ├── finetune_pipeline.py │ ├── test_acc_pipeline.py │ ├── test_ad_pipeline.py │ ├── test_ood_pipeline.py │ ├── test_ood_pipeline_aps.py │ ├── train_ad_pipeline.py │ ├── train_aux_pipeline.py │ ├── train_ddt_pipeline.py │ ├── train_oe_pipeline.py │ ├── train_only_pipeline.py │ ├── train_opengan_pipeline.py │ ├── train_pipeline.py │ └── utils.py ├── postprocessors │ ├── __init__.py │ ├── ash_postprocessor.py │ ├── base_postprocessor.py │ ├── cider_postprocessor.py │ ├── conf_branch_postprocessor.py │ ├── cutpaste_postprocessor.py │ ├── dice_postprocessor.py │ ├── draem_postprocessor.py │ ├── dropout_postprocessor.py │ ├── dsvdd_postprocessor.py │ ├── ebo_postprocessor.py │ ├── ensemble_postprocessor.py │ ├── gmm_postprocessor.py │ ├── godin_postprocessor.py │ ├── gradnorm_postprocessor.py │ ├── gram_postprocessor.py │ ├── info.py │ ├── kl_matching_postprocessor.py │ ├── knn_postprocessor.py │ ├── maxlogit_postprocessor.py │ ├── mcd_postprocessor.py │ ├── mds_ensemble_postprocessor.py │ ├── mds_postprocessor.py │ ├── mos_postprocessor.py │ ├── nac │ │ ├── __init__.py │ │ ├── coverage.py │ │ ├── instr_state.py │ │ ├── nethook.py │ │ └── utils.py │ ├── nac_postprocessor.py │ ├── npos_postprocessor.py │ ├── odin_postprocessor.py │ ├── opengan_postprocessor.py │ ├── openmax_postprocessor.py │ ├── patchcore_postprocessor.py │ ├── rankfeat_postprocessor.py │ ├── rd4ad_postprocessor.py │ ├── react_postprocessor.py │ ├── residual_postprocessor.py │ ├── rmds_postprocessor.py │ ├── rotpred_postprocessor.py │ ├── rts_postprocessor.py │ ├── she_postprocessor.py │ ├── ssd_postprocessor.py │ ├── temp_scaling_postprocessor.py │ ├── utils.py │ └── vim_postprocessor.py ├── preprocessors │ ├── __init__.py │ ├── augmix_preprocessor.py │ ├── base_preprocessor.py │ ├── cider_preprocessor.py │ ├── csi_preprocessor.py │ ├── cutout_preprocessor.py │ ├── cutpaste_preprocessor.py │ ├── draem_preprocessor.py │ ├── pixmix_preprocessor.py │ ├── randaugment_preprocessor.py │ ├── test_preprocessor.py │ ├── transform.py │ └── utils.py ├── recorders │ ├── __init__.py │ ├── ad_recorder.py │ ├── arpl_recorder.py │ ├── base_recorder.py │ ├── cider_recorder.py │ ├── cutpaste_recorder.py │ ├── draem_recorder.py │ ├── dsvdd_recorder.py │ ├── kdad_recorder.py │ ├── opengan_recorder.py │ ├── rd4ad_recorder.py │ └── utils.py ├── trainers │ ├── __init__.py │ ├── arpl_gan_trainer.py │ ├── arpl_trainer.py │ ├── augmix_trainer.py │ ├── base_trainer.py │ ├── cider_trainer.py │ ├── conf_branch_trainer.py │ ├── csi_trainer.py │ ├── cutmix_trainer.py │ ├── cutpaste_trainer.py │ ├── draem_trainer.py │ ├── dropout_trainer.py │ ├── dsvdd_trainer.py │ ├── godin_trainer.py │ ├── kdad_trainer.py │ ├── logitnorm_trainer.py │ ├── lr_scheduler.py │ ├── mcd_trainer.py │ ├── mixoe_trainer.py │ ├── mixup_trainer.py │ ├── mos_trainer.py │ ├── npos_trainer.py │ ├── oe_trainer.py │ ├── opengan_trainer.py │ ├── rd4ad_trainer.py │ ├── regmixup_trainer.py │ ├── rotpred_trainer.py │ ├── rts_trainer.py │ ├── sae_trainer.py │ ├── udg_trainer.py │ ├── utils.py │ └── vos_trainer.py └── utils │ ├── __init__.py │ ├── comm.py │ ├── config.py │ ├── launch.py │ └── logger.py ├── scripts ├── classic_preprocess.py ├── download │ ├── download.py │ └── download.sh ├── eval_ood.py ├── eval_ood_imagenet.py ├── ood │ ├── ash │ │ ├── aug_imagenet_test_ood_ash.sh │ │ ├── cifar100_test_ood_ash.sh │ │ ├── cifar10_test_ood_ash.sh │ │ ├── imagenet200_test_ood_ash.sh │ │ └── imagenet_test_ood_ash.sh │ ├── dice │ │ ├── cifar100_test_ood_dice.sh │ │ ├── cifar10_test_ood_dice.sh │ │ ├── imagenet200_test_ood_dice.sh │ │ ├── imagenet_test_ood_dice.sh │ │ ├── mnist_test_ood_dice.sh │ │ ├── mnist_test_osr_dice.sh │ │ └── sweep_osr.py │ ├── ebo │ │ ├── cifar100_test_ood_ebo.sh │ │ ├── cifar100_train_ood_ebo.sh │ │ ├── cifar10_test_ood_ebo.sh │ │ ├── imagenet200_test_ood_ebo.sh │ │ ├── imagenet_test_ood_ebo.sh │ │ ├── mnist_test_ood_ebo.sh │ │ ├── mnist_test_ood_ebo_aps.sh │ │ ├── mnist_test_osr_ebo.sh │ │ └── sweep_osr.py │ ├── gradnorm │ │ ├── cifar100_test_ood_gradnorm.sh │ │ ├── cifar10_test_ood_gradnorm.sh │ │ ├── imagenet200_test_ood_gradnorm.sh │ │ ├── imagenet_test_ood_gradnorm.sh │ │ ├── mnist_test_ood_gradnorm.sh │ │ ├── mnist_test_osr_gradnorm.sh │ │ └── sweep_osr.py │ ├── kl_matching │ │ ├── cifar100_test_ood_kl_matching.sh │ │ ├── cifar10_test_ood_kl_matching.sh │ │ ├── imagenet200_test_ood_kl_matching.sh │ │ ├── imagenet_test_ood_kl_matching.sh │ │ ├── mnist_test_ood_kl_matching.sh │ │ ├── mnist_test_osr_kl_matching.sh │ │ └── sweep_osr.py │ ├── knn │ │ ├── cifar100_test_ood_knn.sh │ │ ├── cifar10_test_ood_knn.sh │ │ ├── imagenet200_test_ood_knn.sh │ │ ├── imagenet_test_ood_knn.sh │ │ ├── mnist_test_ood_knn.sh │ │ ├── mnist_test_osr_knn.sh │ │ └── sweep_osr.py │ ├── mds │ │ ├── cifar100_test_ood_mds.sh │ │ ├── cifar10_test_ood_mds.sh │ │ ├── imagenet200_test_ood_mds.sh │ │ └── imagenet_test_ood_mds.sh │ ├── mds_ensemble │ │ ├── cifar100_test_ood_mds_ensemble.sh │ │ ├── cifar10_test_ood_mds_ensemble.sh │ │ ├── imagenet200_test_ood_mds_ensemble.sh │ │ ├── imagenet_test_ood_mds.sh │ │ ├── mnist_test_ood_mds_ensemble.sh │ │ ├── mnist_test_osr_mds_ensemble.sh │ │ └── sweep_osr.py │ ├── mls │ │ ├── cifar100_test_ood_maxlogit.sh │ │ ├── cifar10_test_ood_maxlogit.sh │ │ ├── imagenet200_test_ood_maxlogit.sh │ │ ├── imagenet_test_ood_maxlogit.sh │ │ ├── mnist_test_ood_maxlogit.sh │ │ ├── mnist_test_osr_maxlogit.sh │ │ └── sweep_osr.py │ ├── msp │ │ ├── cifar100_test_ood_msp.sh │ │ ├── cifar10_test_ood_msp.sh │ │ ├── imagenet200_test_ood_msp.sh │ │ ├── imagenet_test_ood_msp.sh │ │ ├── mnist_test_fsood_msp.sh │ │ ├── mnist_test_ood_msp.sh │ │ ├── osr_cifar6_test_msp.sh │ │ ├── osr_mnist6_test_msp.sh │ │ └── sweep_osr.py │ ├── nac │ │ ├── cached_cifar100_test_ood_nac.sh │ │ ├── cached_cifar10_test_ood_nac.sh │ │ ├── cached_imagenet_test_ood_nac.sh │ │ ├── cifar100_test_ood_nac.sh │ │ ├── cifar10_test_ood_nac.sh │ │ └── imagenet_test_ood_nac.sh │ ├── odin │ │ ├── cifar100_test_ood_odin.sh │ │ ├── cifar10_test_ood_odin.sh │ │ ├── imagenet200_test_ood_odin.sh │ │ ├── imagenet_test_ood_odin.sh │ │ ├── mnist_test_ood_odin.sh │ │ ├── mnist_test_ood_odin_aps.sh │ │ ├── mnist_test_osr_odin.sh │ │ └── sweep_osr.py │ ├── others │ │ ├── cider │ │ │ ├── cifar100_test_cider.sh │ │ │ ├── cifar100_train_cider.sh │ │ │ ├── cifar10_test_cider.sh │ │ │ ├── cifar10_train_cider.sh │ │ │ ├── imagenet200_test_cider.sh │ │ │ ├── imagenet200_train_cider.sh │ │ │ ├── imagenet_test_cider.sh │ │ │ └── imagenet_train_cider.sh │ │ ├── conf_branch │ │ │ ├── cifar100_test_conf_branch.sh │ │ │ ├── cifar100_train_conf_branch.sh │ │ │ ├── cifar10_test_conf_branch.sh │ │ │ ├── cifar10_train_conf_branch.sh │ │ │ ├── imagenet200_test_conf_branch.sh │ │ │ ├── imagenet200_train_conf_branch.sh │ │ │ ├── imagenet_test_conf_branch.sh │ │ │ ├── imagenet_train_conf_branch.sh │ │ │ └── train_conf_branch.sh │ │ ├── csi │ │ │ ├── cifar100_test_ood_csi.sh │ │ │ ├── cifar100_train_csi_step1.sh │ │ │ ├── cifar100_train_csi_step2.sh │ │ │ ├── cifar10_test_ood_csi.sh │ │ │ ├── cifar10_train_csi_step1.sh │ │ │ └── cifar10_train_csi_step2.sh │ │ ├── godin │ │ │ ├── cifar100_test_ood_godin.sh │ │ │ ├── cifar100_train_godin.sh │ │ │ ├── cifar10_test_ood_godin.sh │ │ │ ├── cifar10_train_godin.sh │ │ │ ├── imagenet200_test_ood_godin.sh │ │ │ ├── imagenet200_train_godin.sh │ │ │ ├── imagenet_test_ood_godin.sh │ │ │ └── imagenet_train_godin.sh │ │ ├── gram │ │ │ ├── cifar100_test_ood_gram.sh │ │ │ ├── cifar10_test_ood_gram.sh │ │ │ ├── imagenet200_test_ood_gram.sh │ │ │ ├── imagenet_test_ood_gram.sh │ │ │ ├── mnist_test_osr_gram.sh │ │ │ └── sweep_osr.py │ │ ├── logitnorm │ │ │ ├── cifar100_test_logitnorm.sh │ │ │ ├── cifar100_train_logitnorm.sh │ │ │ ├── cifar10_test_logitnorm.sh │ │ │ ├── cifar10_train_logitnorm.sh │ │ │ ├── imagenet200_test_logitnorm.sh │ │ │ ├── imagenet200_train_logitnorm.sh │ │ │ ├── imagenet_test_logitnorm.sh │ │ │ └── imagenet_train_logitnorm.sh │ │ ├── mcd │ │ │ ├── cifar100_test_mcd.sh │ │ │ ├── cifar100_train_mcd.sh │ │ │ ├── cifar10_test_mcd.sh │ │ │ ├── cifar10_train_mcd.sh │ │ │ ├── imagenet200_test_mcd.sh │ │ │ └── imagenet200_train_mcd.sh │ │ ├── mixoe │ │ │ ├── cifar100_test_mixoe.sh │ │ │ ├── cifar100_train_mixoe.sh │ │ │ ├── cifar10_test_mixoe.sh │ │ │ ├── cifar10_train_mixoe.sh │ │ │ ├── imagenet200_test_mixoe.sh │ │ │ └── imagnet200_train_mixoe.sh │ │ ├── mos │ │ │ ├── cifar100_test_mos.sh │ │ │ ├── cifar100_train_mos.sh │ │ │ ├── cifar10_test_mos.sh │ │ │ ├── cifar10_train_mos.sh │ │ │ ├── imagenet200_test_mos.sh │ │ │ ├── imagenet200_train_mos.sh │ │ │ ├── imagenet_test_mos.sh │ │ │ └── imagenet_train_mos.sh │ │ ├── npos │ │ │ ├── cifar100_test_npos.sh │ │ │ ├── cifar100_train_npos.sh │ │ │ ├── cifar10_test_npos.sh │ │ │ ├── cifar10_train_npos.sh │ │ │ ├── imagenet200_test_npos.sh │ │ │ ├── imagenet200_train_npos.sh │ │ │ └── imagenet_train_npos.sh │ │ ├── oe │ │ │ ├── cifar100_test_oe.sh │ │ │ ├── cifar100_train_oe.sh │ │ │ ├── cifar10_test_oe.sh │ │ │ ├── cifar10_train_oe.sh │ │ │ ├── imagenet200_test_oe.sh │ │ │ └── imagnet200_train_oe.sh │ │ ├── residual │ │ │ ├── cifar100_test_ood_residual.sh │ │ │ ├── cifar10_test_ood_residual.sh │ │ │ └── imagenet_test_ood_residual.sh │ │ ├── rotpred │ │ │ ├── cifar100_test_rotpred.sh │ │ │ ├── cifar100_train_rotpred.sh │ │ │ ├── cifar10_test_rotpred.sh │ │ │ ├── cifar10_train_rotpred.sh │ │ │ ├── imagenet200_test_rotpred.sh │ │ │ ├── imagenet200_train_rotpred.sh │ │ │ ├── imagenet_test_rotpred.sh │ │ │ └── imagenet_train_rotpred.sh │ │ ├── sem │ │ │ ├── cifar100_test_ood_sem.sh │ │ │ ├── cifar100_train_sem.sh │ │ │ ├── cifar10_test_ood_sem.sh │ │ │ ├── cifar10_train_sem.sh │ │ │ ├── imagenet_test_ood_sem.sh │ │ │ ├── mnist_test_ood_sem.sh │ │ │ └── sweep_osr.py │ │ ├── ssd │ │ │ └── cifar_10_test_ood_ssd.sh │ │ ├── udg │ │ │ ├── cifar100_test_udg.sh │ │ │ ├── cifar100_train_udg.sh │ │ │ ├── cifar10_test_udg.sh │ │ │ ├── cifar10_train_udg.sh │ │ │ ├── imagenet200_test_udg.sh │ │ │ └── imagenet200_train_udg.sh │ │ └── vos │ │ │ ├── cifar100_test_vos.sh │ │ │ ├── cifar100_train_vos.sh │ │ │ ├── cifar10_test_vos.sh │ │ │ ├── cifar10_train_vos.sh │ │ │ ├── imagenet200_test_vos.sh │ │ │ ├── imagenet200_train_vos.sh │ │ │ └── imagenet_train_vos.sh │ ├── rankfeat │ │ ├── cifar100_test_ood_rankfeat.sh │ │ ├── cifar10_test_ood_rankfeat.sh │ │ ├── imagenet200_test_ood_rankfeat.sh │ │ └── imagenet_test_ood_rankfeat.sh │ ├── react │ │ ├── cifar100_test_ood_react.sh │ │ ├── cifar10_test_ood_react.sh │ │ ├── imagenet200_test_ood_react.sh │ │ ├── imagenet_test_ood_react.sh │ │ ├── mnist_test_ood_react.sh │ │ ├── mnist_test_osr_react.sh │ │ └── sweep_osr.py │ ├── rmds │ │ ├── cifar100_test_ood_rmds.sh │ │ ├── cifar10_test_ood_rmds.sh │ │ ├── imagenet200_test_ood_rmds.sh │ │ └── imagenet_test_ood_rmds.sh │ ├── she │ │ ├── cifar100_test_ood_she.sh │ │ ├── cifar10_test_ood_she.sh │ │ ├── imagenet200_test_ood_she.sh │ │ └── imagenet_test_ood_she.sh │ └── vim │ │ ├── cifar100_test_ood_vim.sh │ │ ├── cifar10_test_ood_vim.sh │ │ ├── imagenet200_test_ood_vim.sh │ │ ├── imagenet_test_ood_vim.sh │ │ ├── mnist_test_osr_vim.sh │ │ └── sweep_osr.py ├── preprocess.py └── split_train.sh ├── setup.py └── tools ├── plot └── tsne_tools.py └── sweep └── hyperparam.py /codespell_ignored.txt: -------------------------------------------------------------------------------- 1 | ans 2 | fpr 3 | als 4 | hist 5 | tha 6 | -------------------------------------------------------------------------------- /configs/datasets/aircraft/aircraft_oe.yml: -------------------------------------------------------------------------------- 1 | name: aircraft_oe 2 | 3 | dataset: 4 | name: aircraft_oe 5 | split_names: [train, oe, val, test] 6 | oe: 7 | dataset_class: ImglistDataset 8 | data_dir: ./data/images_largescale/ 9 | imglist_pth: ./data/benchmark_imglist/aircraft/train_oe.txt 10 | batch_size: 32 11 | shuffle: True 12 | interpolation: bilinear 13 | -------------------------------------------------------------------------------- /configs/datasets/aircraft/aircraft_ood.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: aircraft_ood 3 | num_classes: 50 4 | 5 | dataset_class: ImglistDataset 6 | interpolation: bilinear 7 | batch_size: 64 8 | shuffle: False 9 | 10 | pre_size: 512 11 | image_size: 448 12 | num_workers: '@{num_workers}' 13 | num_gpus: '@{num_gpus}' 14 | num_machines: '@{num_machines}' 15 | split_names: [val, nearood, farood] 16 | val: 17 | data_dir: ./data/images_largescale/ 18 | imglist_pth: ./data/benchmark_imglist/aircraft/val_ood.txt 19 | nearood: 20 | datasets: [hardood] 21 | hard: 22 | data_dir: ./data/images_largescale/ 23 | imglist_pth: ./data/benchmark_imglist/aircraft/test_ood_hard.txt 24 | farood: 25 | datasets: [easyood] 26 | easy: 27 | data_dir: ./data/images_largescale/ 28 | imglist_pth: ./data/benchmark_imglist/aircraft/test_ood_easy.txt 29 | -------------------------------------------------------------------------------- /configs/datasets/cifar10/cifar10_oe.yml: -------------------------------------------------------------------------------- 1 | name: cifar10_oe 2 | 3 | dataset: 4 | name: cifar10_oe 5 | split_names: [train, oe, val, test] 6 | oe: 7 | dataset_class: ImglistDataset 8 | data_dir: ./data/images_classic/ 9 | imglist_pth: ./data/benchmark_imglist/cifar10/train_tin597.txt 10 | batch_size: 256 11 | shuffle: True 12 | interpolation: bilinear 13 | -------------------------------------------------------------------------------- /configs/datasets/cifar100/cifar100_oe.yml: -------------------------------------------------------------------------------- 1 | name: cifar100_oe 2 | 3 | dataset: 4 | name: cifar100_oe 5 | split_names: [train, oe, val, test] 6 | oe: 7 | dataset_class: ImglistDataset 8 | data_dir: ./data/images_classic/ 9 | imglist_pth: ./data/benchmark_imglist/cifar100/train_tin597.txt 10 | batch_size: 256 11 | shuffle: True 12 | interpolation: bilinear 13 | -------------------------------------------------------------------------------- /configs/datasets/imagenet200/imagenet200_oe.yml: -------------------------------------------------------------------------------- 1 | name: imagenet200_oe 2 | 3 | dataset: 4 | name: imagenet200_oe 5 | split_names: [train, oe, val, test] 6 | oe: 7 | dataset_class: ImglistDataset 8 | data_dir: ./data/images_largescale/ 9 | imglist_pth: ./data/benchmark_imglist/imagenet200/train_imagenet800.txt 10 | batch_size: 256 11 | shuffle: True 12 | interpolation: bilinear 13 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar50/cifar50_seed1_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar50_seed1_osr 3 | num_classes: 50 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_id_seed1.txt 19 | osr: 20 | datasets: [cifar50] 21 | cifar50: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_ood_seed1.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar50/cifar50_seed2_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar50_seed2_osr 3 | num_classes: 50 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_id_seed2.txt 19 | osr: 20 | datasets: [cifar50] 21 | cifar50: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_ood_seed2.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar50/cifar50_seed3_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar50_seed3_osr 3 | num_classes: 50 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_id_seed3.txt 19 | osr: 20 | datasets: [cifar50] 21 | cifar50: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_ood_seed3.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar50/cifar50_seed4_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar50_seed4_osr 3 | num_classes: 50 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_id_seed4.txt 19 | osr: 20 | datasets: [cifar50] 21 | cifar50: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_ood_seed4.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar50/cifar50_seed5_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar50_seed5_osr 3 | num_classes: 50 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_id_seed5.txt 19 | osr: 20 | datasets: [cifar50] 21 | cifar50: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar50/test/test_cifar100_50_ood_seed5.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar6/cifar6_seed1_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar6_seed1_osr 3 | num_classes: 6 4 | 5 | num_workers: '@{num_workers}' 6 | num_gpus: '@{num_gpus}' 7 | num_machines: '@{num_machines}' 8 | 9 | dataset_class: ImglistDataset 10 | batch_size: 128 11 | shuffle: False 12 | 13 | split_names: [val, osr] 14 | val: 15 | data_dir: ./data/images_classic/ 16 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_6_id_seed1.txt 17 | osr: 18 | datasets: [cifar4] 19 | cifar4: 20 | data_dir: ./data/images_classic/ 21 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_4_ood_seed1.txt 22 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar6/cifar6_seed2_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar6_seed2_osr 3 | num_classes: 6 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_6_id_seed2.txt 19 | osr: 20 | datasets: [cifar4] 21 | cifar4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_4_ood_seed2.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar6/cifar6_seed3_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar6_seed3_osr 3 | num_classes: 6 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_6_id_seed3.txt 19 | osr: 20 | datasets: [cifar4] 21 | cifar4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_4_ood_seed3.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar6/cifar6_seed4_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar6_seed4_osr 3 | num_classes: 6 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_6_id_seed4.txt 19 | osr: 20 | datasets: [cifar4] 21 | cifar4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_4_ood_seed4.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_cifar6/cifar6_seed5_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: cifar6_seed5_osr 3 | num_classes: 6 4 | pre_size: 32 5 | image_size: 32 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_6_id_seed5.txt 19 | osr: 20 | datasets: [cifar4] 21 | cifar4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_cifar6/test/test_cifar10_4_ood_seed5.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_mnist6/mnist6_seed1_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: mnist6_seed1_osr 3 | num_classes: 6 4 | pre_size: 28 5 | image_size: 28 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_6_id_seed1.txt 19 | osr: 20 | datasets: [mnist4] 21 | mnist4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_4_ood_seed1.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_mnist6/mnist6_seed2_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: mnist6_seed2_osr 3 | num_classes: 6 4 | pre_size: 28 5 | image_size: 28 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_6_id_seed2.txt 19 | osr: 20 | datasets: [mnist4] 21 | mnist4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_4_ood_seed2.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_mnist6/mnist6_seed3_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: mnist6_seed3_osr 3 | num_classes: 6 4 | pre_size: 28 5 | image_size: 28 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_6_id_seed3.txt 19 | osr: 20 | datasets: [mnist4] 21 | mnist4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_4_ood_seed3.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_mnist6/mnist6_seed4_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: mnist6_seed4_osr 3 | num_classes: 6 4 | pre_size: 28 5 | image_size: 28 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_6_id_seed4.txt 19 | osr: 20 | datasets: [mnist4] 21 | mnist4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_4_ood_seed4.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_mnist6/mnist6_seed5_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: mnist6_seed5_osr 3 | num_classes: 6 4 | pre_size: 28 5 | image_size: 28 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_6_id_seed5.txt 19 | osr: 20 | datasets: [mnist4] 21 | mnist4: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_mnist6/test/test_mnist_4_ood_seed5.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_tin20/tin20_seed1_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: tin20_seed1_osr 3 | num_classes: 20 4 | pre_size: 64 5 | image_size: 64 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_20_id_seed1.txt 19 | osr: 20 | datasets: [tin180] 21 | tin180: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_180_ood_seed1.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_tin20/tin20_seed2_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: tin20_seed2_osr 3 | num_classes: 20 4 | pre_size: 64 5 | image_size: 64 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_20_id_seed2.txt 19 | osr: 20 | datasets: [tin180] 21 | tin180: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_180_ood_seed2.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_tin20/tin20_seed3_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: tin20_seed3_osr 3 | num_classes: 20 4 | pre_size: 64 5 | image_size: 64 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_20_id_seed3.txt 19 | osr: 20 | datasets: [tin180] 21 | tin180: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_180_ood_seed3.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_tin20/tin20_seed4_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: tin20_seed4_osr 3 | num_classes: 20 4 | pre_size: 64 5 | image_size: 64 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_20_id_seed4.txt 19 | osr: 20 | datasets: [tin180] 21 | tin180: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_180_ood_seed4.txt 24 | -------------------------------------------------------------------------------- /configs/datasets/osr_tin20/tin20_seed5_osr.yml: -------------------------------------------------------------------------------- 1 | ood_dataset: 2 | name: tin20_seed5_osr 3 | num_classes: 20 4 | pre_size: 64 5 | image_size: 64 6 | 7 | num_workers: '@{num_workers}' 8 | num_gpus: '@{num_gpus}' 9 | num_machines: '@{num_machines}' 10 | 11 | dataset_class: ImglistDataset 12 | batch_size: 128 13 | shuffle: False 14 | 15 | split_names: [val, osr] 16 | val: 17 | data_dir: ./data/images_classic/ 18 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_20_id_seed5.txt 19 | osr: 20 | datasets: [tin180] 21 | tin180: 22 | data_dir: ./data/images_classic/ 23 | imglist_pth: ./data/benchmark_imglist/osr_tin20/test/test_tin_180_ood_seed5.txt 24 | -------------------------------------------------------------------------------- /configs/networks/arpl_gan.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: arpl_gan 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | 9 | # Number of channels in the training images. For color images this is 3 10 | nc: 3 11 | # Size of z latent vector (i.e. size of generator input) 12 | nz: 100 13 | # Size of feature maps in generator 14 | ngf: 64 15 | # Size of feature maps in discriminator 16 | ndf : 64 17 | ns: 1 18 | 19 | weight_pl: 0.1 20 | temp: 1.0 21 | 22 | # network used for feature extraction 23 | feat_extract_network: 24 | name: resnet34ABN 25 | num_classes: '@{dataset.num_classes}' 26 | image_size: '@{dataset.image_size}' 27 | pretrained: False 28 | num_gpus: '@{num_gpus}' 29 | -------------------------------------------------------------------------------- /configs/networks/arpl_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: arpl_net 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | 9 | weight_pl: 0.1 10 | temp: 1.0 11 | 12 | # network used for feature extraction 13 | feat_extract_network: 14 | name: lenet 15 | num_classes: '@{dataset.num_classes}' 16 | pretrained: False # set 'True' to load pretrained model 17 | checkpoint: none # ignore if pretrained is false 18 | num_gpus: '@{num_gpus}' 19 | -------------------------------------------------------------------------------- /configs/networks/bit.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: bit 3 | model: BiT-S-R101x1 4 | num_classes: '@{dataset.num_classes}' 5 | image_size: '@{dataset.image_size}' 6 | pretrained: True # set 'True' to load pretrained model 7 | checkpoint: ./bit_pretrained_models/BiT-S-R101x1.npz # ignore if pretrained is false 8 | num_gpus: '@{num_gpus}' 9 | dataset: 10 | image_size: 480 11 | ood_dataset: 12 | image_size: 480 13 | -------------------------------------------------------------------------------- /configs/networks/cider_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: cider_net 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # In training pipeline:"False"; In testing pipeline:"True" 5 | num_gpus: '@{num_gpus}' 6 | checkpoint: none 7 | 8 | feat_dim: 128 9 | head: mlp 10 | 11 | backbone: 12 | name: resnet18_32x32 13 | num_classes: '@{dataset.num_classes}' 14 | image_size: '@{dataset.image_size}' 15 | pretrained: False 16 | checkpoint: none 17 | num_gpus: '@{num_gpus}' 18 | -------------------------------------------------------------------------------- /configs/networks/conf_branch.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: conf_branch_net 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # In training pipeline:"False"; In testing pipeline:"True" 5 | num_gpus: '@{num_gpus}' 6 | checkpoint: none 7 | backbone: 8 | name: resnet18_32x32 9 | num_classes: '@{dataset.num_classes}' 10 | image_size: '@{dataset.image_size}' 11 | pretrained: False 12 | checkpoint: ./results/mnist_conf_net_conf_esti/best.pth 13 | num_gpus: '@{num_gpus}' 14 | -------------------------------------------------------------------------------- /configs/networks/csi_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: csi_net 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: ./results/cifar10_csinet_csi_step2_e100_lr0.1/best.ckpt 7 | num_gpus: '@{num_gpus}' 8 | simclr_dim: 128 # Dimension of simclr layer 9 | shift_trans_type: rotation # choice ['rotation', 'cutperm', 'none'] 10 | 11 | backbone: 12 | name: resnet18_32x32 13 | num_classes: '@{dataset.num_classes}' 14 | image_size: '@{dataset.image_size}' 15 | pretrained: False 16 | num_gpus: '@{num_gpus}' 17 | -------------------------------------------------------------------------------- /configs/networks/cutpaste.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: projectionNet 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # set 'True' to load pretrained model 5 | checkpoint: none # ignore if pretrained is false 6 | num_gpus: '@{num_gpus}' 7 | 8 | # network used for feature extraction 9 | backbone: 10 | name: resnet18_32x32 11 | num_classes: '@{dataset.num_classes}' 12 | image_size: '@{dataset.image_size}' 13 | pretrained: True 14 | checkpoint: 'results/cifar100_resnet18_32x32_base_e100_lr0.1/best.ckpt' 15 | num_gpus: '@{num_gpus}' 16 | -------------------------------------------------------------------------------- /configs/networks/dcae.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: dcae 3 | type: cifar10_LeNet 4 | num_classes: '@{dataset.num_classes}' 5 | num_gpus: 1 6 | pretrained: False 7 | -------------------------------------------------------------------------------- /configs/networks/draem.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: draem 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False # set 'True' to load pretrained model 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | 9 | use_gt: False 10 | image_auroc_only: True 11 | -------------------------------------------------------------------------------- /configs/networks/dropout_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: dropout_net 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | dropout_p: 0.5 9 | 10 | # network used for feature extraction 11 | backbone: 12 | name: resnet18_32x32 13 | num_classes: '@{dataset.num_classes}' 14 | image_size: '@{dataset.image_size}' 15 | pretrained: False 16 | checkpoint: none 17 | num_gpus: '@{num_gpus}' 18 | -------------------------------------------------------------------------------- /configs/networks/dsvdd.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: dsvdd 3 | type: cifar10_LeNet 4 | num_classes: '@{dataset.num_classes}' 5 | num_gpus: 1 6 | pretrained: True 7 | checkpoint: './results/cifar10_dcae_dcae/AE_best_epoch1_roc_auc0.4976.pth' 8 | -------------------------------------------------------------------------------- /configs/networks/godin_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: godin_net 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | similarity_measure: 'cosine' # value in ['cosine', 'inner', 'euclid'] 9 | 10 | # network used for feature extraction 11 | backbone: 12 | name: resnet18_32x32 13 | num_classes: '@{dataset.num_classes}' 14 | image_size: '@{dataset.image_size}' 15 | pretrained: False 16 | num_gpus: '@{num_gpus}' 17 | checkpoint: none 18 | -------------------------------------------------------------------------------- /configs/networks/lenet.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: lenet 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # set 'True' to load pretrained model 5 | checkpoint: none # ignore if pretrained is false 6 | num_gpus: '@{num_gpus}' 7 | -------------------------------------------------------------------------------- /configs/networks/mcd_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: mcd 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # set 'True' to load pretrained model 5 | checkpoint: '' 6 | num_gpus: '@{num_gpus}' 7 | 8 | backbone: 9 | name: lenet 10 | num_classes: '@{dataset.num_classes}' 11 | image_size: '@{dataset.image_size}' 12 | pretrained: False 13 | checkpoint: '' 14 | num_gpus: '@{num_gpus}' 15 | -------------------------------------------------------------------------------- /configs/networks/mos.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: bit 3 | num_classes: '@{dataset.num_classes}' 4 | model: BiT-S-R101x1 5 | num_block_open: 0 6 | bit_pretrained_dir: bit_pretrained_models 7 | num_logits: 120 # total classes add num_group 8 | pretrained: True # set 'True' to load pretrained model 9 | normal_load: True # set True if it's load normal False if it load from the bit's own load_from 10 | # if you want to load a pre trained model downloaded from bit github you should set normal_load to False 11 | # otherwise if you want to load a pretrained model from this frame you should set normal_load to True 12 | checkpoint: ./results/cifar100_double_label_resnet18_32x32_mos_e100_lr0.003/model_epoch100.ckpt 13 | # checkpoint: ./bit_pretrained_models/BiT-S-R101x1.npz # download from https://github.com/google-research/big_transfer 14 | num_gpus: '@{num_gpus}' 15 | -------------------------------------------------------------------------------- /configs/networks/npos_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: npos_net 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # In training pipeline:"False"; In testing pipeline:"True" 5 | num_gpus: '@{num_gpus}' 6 | checkpoint: none 7 | 8 | feat_dim: 128 9 | head: mlp 10 | 11 | backbone: 12 | name: resnet18_32x32 13 | num_classes: '@{dataset.num_classes}' 14 | image_size: '@{dataset.image_size}' 15 | pretrained: False 16 | checkpoint: none 17 | num_gpus: '@{num_gpus}' 18 | -------------------------------------------------------------------------------- /configs/networks/opengan.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: opengan 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | 9 | # Number of channels in the training images. For color images this is 3 10 | nc: 512 11 | # Size of z latent vector (i.e. size of generator input) 12 | nz: 100 13 | # Size of feature maps in generator 14 | ngf: 64 15 | # Size of feature maps in discriminator 16 | ndf : 64 17 | 18 | # network used for feature extraction 19 | backbone: 20 | name: resnet18_32x32 21 | num_classes: '@{dataset.num_classes}' 22 | image_size: '@{dataset.image_size}' 23 | pretrained: False 24 | checkpoint: none 25 | num_gpus: '@{num_gpus}' 26 | -------------------------------------------------------------------------------- /configs/networks/openmax.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: openmax_network 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # set 'True' to load pretrained model 5 | checkpoint: ./results/mvtec_openmax_network_OpenMax_e100_lr0.1/best.ckpt # ignore if pretrained is false 6 | num_gpus: '@{num_gpus}' 7 | 8 | backbone: 9 | name: lenet 10 | num_classes: '@{dataset.num_classes}' 11 | image_size: '@{dataset.image_size}' 12 | pretrained: False 13 | checkpoint: '' 14 | num_gpus: '@{num_gpus}' 15 | -------------------------------------------------------------------------------- /configs/networks/patchcore_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: patchcore_net 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # set 'True' to load pretrained model 5 | checkpoint: none # ignore if pretrained is false 6 | num_gpus: '@{num_gpus}' 7 | load_cached_faiss: True 8 | 9 | # network used for feature extraction 10 | backbone: 11 | name: resnet18_32x32 12 | num_classes: '@{dataset.num_classes}' 13 | image_size: '@{dataset.image_size}' 14 | pretrained: True 15 | checkpoint: 'results/checkpoints/cifar10_res18_acc94.30.ckpt' 16 | num_gpus: '@{num_gpus}' 17 | -------------------------------------------------------------------------------- /configs/networks/rd4ad_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: rd4ad_net 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | 9 | backbone: 10 | name: resnet18_256x256 11 | num_classes: '@{dataset.num_classes}' 12 | image_size: '@{dataset.image_size}' 13 | pretrained: True # set 'True' to load pretrained model 14 | checkpoint: 'results/resnet18_rd4ad_teacher/resnet18-f37072fd.pth' # ignore if pretrained is false 15 | num_gpus: '@{num_gpus}' 16 | -------------------------------------------------------------------------------- /configs/networks/react_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: react_net 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | similarity_measure: 'cosine' # value in ['cosine', 'inner', 'euclid'] 9 | 10 | # network used for feature extraction 11 | backbone: 12 | name: resnet50 13 | num_classes: '@{dataset.num_classes}' 14 | image_size: '@{dataset.image_size}' 15 | pretrained: True 16 | checkpoint: 'results/checkpoints/imagenet_res50_acc76.10.pth' 17 | num_gpus: '@{num_gpus}' 18 | -------------------------------------------------------------------------------- /configs/networks/repvgg.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: repvgg_b3 3 | model: repvgg_b3 4 | num_classes: '@{dataset.num_classes}' 5 | image_size: '@{dataset.image_size}' 6 | pretrained: True # set 'True' to load pretrained model 7 | checkpoint: timm_load # ignore if pretrained is false 8 | num_gpus: '@{num_gpus}' 9 | dataset: 10 | image_size: 224 11 | ood_dataset: 12 | image_size: 224 13 | -------------------------------------------------------------------------------- /configs/networks/resnet18_224x224.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: resnet18_224x224 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # set 'True' to load pretrained model 5 | checkpoint: none # ignore if pretrained is false 6 | num_gpus: '@{num_gpus}' 7 | -------------------------------------------------------------------------------- /configs/networks/resnet18_32x32.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: resnet18_32x32 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # set 'True' to load pretrained model 5 | checkpoint: ./results/cifar10_double_label_resnet18_32x32_mos_e100_lr0.003/best.ckpt # ignore if pretrained is false 6 | num_gpus: '@{num_gpus}' 7 | -------------------------------------------------------------------------------- /configs/networks/resnet18_64x64.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: resnet18_64x64 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # set 'True' to load pretrained model 5 | checkpoint: ./results/cifar10_resnet18_32x32_base_e200_lr_0.1/best.ckpt # ignore if pretrained is false 6 | num_gpus: '@{num_gpus}' 7 | -------------------------------------------------------------------------------- /configs/networks/resnet50.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: resnet50 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: True # set 'True' to load pretrained model 6 | 7 | # default pretrained model: https://download.pytorch.org/models/resnet50-0676ba61.pth 8 | checkpoint: ./checkpoints/resnet50-0676ba61.pth # ignore if pretrained is false 9 | num_gpus: '@{num_gpus}' 10 | -------------------------------------------------------------------------------- /configs/networks/rot_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: rot_net 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # In training pipeline:"False"; In testing pipeline:"True" 5 | num_gpus: '@{num_gpus}' 6 | checkpoint: none 7 | backbone: 8 | name: resnet18_32x32 9 | num_classes: '@{dataset.num_classes}' 10 | image_size: '@{dataset.image_size}' 11 | pretrained: False 12 | checkpoint: none 13 | num_gpus: '@{num_gpus}' 14 | -------------------------------------------------------------------------------- /configs/networks/rts_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: rts_net 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: False 6 | checkpoint: none # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | dof: 32 9 | kl_scale: 0.1 10 | 11 | # network used for feature extraction 12 | backbone: 13 | name: resnet18_32x32 14 | num_classes: '@{dataset.num_classes}' 15 | image_size: '@{dataset.image_size}' 16 | pretrained: False 17 | num_gpus: '@{num_gpus}' 18 | -------------------------------------------------------------------------------- /configs/networks/simclr.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: simclr_net 3 | num_classes: '@{dataset.num_classes}' 4 | image_size: '@{dataset.image_size}' 5 | pretrained: True 6 | checkpoint: 'results/checkpoints/SSD/last_new.pth' # ignore if pretrained is false 7 | num_gpus: '@{num_gpus}' 8 | 9 | # network used for feature extraction 10 | backbone: 11 | name: resnet50 12 | num_classes: '@{dataset.num_classes}' 13 | image_size: '@{dataset.image_size}' 14 | pretrained: False 15 | checkpoint: none 16 | num_gpus: '@{num_gpus}' 17 | -------------------------------------------------------------------------------- /configs/networks/train_mos.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: bit 3 | num_classes: '@{dataset.num_classes}' 4 | model: BiT-S-R101x1 5 | num_block_open: 0 6 | bit_pretrained_dir: bit_pretrained_models 7 | num_logits: 120 # total classes add num_group 8 | pretrained: True # set 'True' to load pretrained model 9 | normal_load: False # set True if it's load normal False if it load from the bit's own load_from 10 | # if you want to load a pre trained model downloaded from bit github you should set normal_load to False 11 | # otherwise if you want to load a pretrained model from this frame you should set normal_load to True 12 | # checkpoint: ./results/cifar100_double_label_bit_mos_e100_lr0.003/mos_epoch_latest.ckpt 13 | checkpoint: ./bit_pretrained_models/BiT-S-R101x1.npz # download from https://github.com/google-research/big_transfer 14 | num_gpus: '@{num_gpus}' 15 | -------------------------------------------------------------------------------- /configs/networks/udg_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: udg 3 | num_classes: '@{dataset.num_classes}' 4 | num_clusters: 1000 5 | pretrained: False # set 'True' to load pretrained model 6 | checkpoint: '' 7 | num_gpus: '@{num_gpus}' 8 | 9 | backbone: 10 | name: resnet18_32x32 11 | num_classes: '@{dataset.num_classes}' 12 | image_size: '@{dataset.image_size}' 13 | pretrained: False 14 | checkpoint: '' 15 | num_gpus: '@{num_gpus}' 16 | -------------------------------------------------------------------------------- /configs/networks/vit.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: vit 3 | model: openood/networks/vit-base-p16-384.py 4 | num_classes: '@{dataset.num_classes}' 5 | image_size: '@{dataset.image_size}' 6 | pretrained: True # set 'True' to load pretrained model 7 | checkpoint: ./checkpoints/vit-base-p16_in21k-pre-3rdparty_ft-64xb64_in1k-384_20210928-98e8652b.pth # ignore if pretrained is false 8 | num_gpus: '@{num_gpus}' 9 | dataset: 10 | image_size: 384 11 | ood_dataset: 12 | image_size: 384 13 | -------------------------------------------------------------------------------- /configs/networks/vos_net.yml: -------------------------------------------------------------------------------- 1 | network: 2 | name: vos 3 | num_classes: '@{dataset.num_classes}' 4 | pretrained: False # In training pipeline:"False"; In testing pipeline:"True" 5 | num_gpus: '@{num_gpus}' 6 | num_layers: 40 7 | widen_factor: 2 8 | droprate: 0.3 9 | 10 | backbone: #for network without feature_list 11 | name: lenet 12 | num_classes: '@{dataset.num_classes}' 13 | image_size: '@{dataset.image_size}' 14 | pretrained: False 15 | checkpoint: None 16 | num_gpus: '@{num_gpus}' 17 | -------------------------------------------------------------------------------- /configs/pipelines/test/feat_extract.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | mark: default 6 | 7 | num_gpus: 1 8 | num_workers: 4 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | network: 13 | pretrained: True 14 | 15 | pipeline: 16 | name: feat_extract 17 | extract_target: test 18 | 19 | evaluator: 20 | name: base 21 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_acc.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'" 2 | output_dir: ./results/ 3 | save_output: False 4 | merge_option: merge # disabled if 'save_output' is False choices: [default, pass, merge] 5 | 6 | num_gpus: 1 7 | num_workers: 4 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | network: 12 | pretrained: True 13 | 14 | pipeline: 15 | name: test_acc 16 | 17 | evaluator: 18 | name: base 19 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_arpl.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{evaluator.name}'_'@{postprocessor.name}'_'@{mark}'/s'@{seed}'/'@{evaluator.ood_scheme}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | mark: default # to mark the version of experiment 6 | seed: 0 7 | 8 | num_gpus: 1 9 | num_workers: 0 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | network: 14 | pretrained: True 15 | checkpoint: ["results/imagenet200_arpl_net_arpl_e90_lr0.1/s0/best_NetF.ckpt", 16 | "results/imagenet200_arpl_net_arpl_e90_lr0.1/s0/best_criterion.ckpt"] 17 | 18 | pipeline: 19 | name: test_ood 20 | 21 | evaluator: 22 | name: arpl 23 | ood_scheme: ood # [ood, fsood] 24 | 25 | recorder: 26 | save_scores: True 27 | save_csv: True 28 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_arplgan.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{evaluator.name}'_'@{postprocessor.name}'_'@{mark}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | mark: default # to mark the version of experiment 6 | 7 | num_gpus: 1 8 | num_workers: 0 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | network: 13 | pretrained: True 14 | checkpoint: ["./results/mnist_arpl_gan_arpl_gan_e100_lr0.1/best_NetF.ckpt", 15 | "./results/mnist_arpl_gan_arpl_gan_e100_lr0.1/best_criterion.ckpt", 16 | null, 17 | null] 18 | 19 | pipeline: 20 | name: test_ood 21 | 22 | evaluator: 23 | name: arpl 24 | 25 | recorder: 26 | save_scores: True 27 | save_csv: True 28 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_cutpaste.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: merge # disabled if 'save_output' is False choices: [default, pass, merge] 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | network: 12 | pretrained: True 13 | checkpoint: results/bottle_projectionNet_cutpaste_e100_lr0.03/best_epoch15_auroc97.48015873015873.ckpt 14 | 15 | pipeline: 16 | name: test_ad 17 | 18 | evaluator: 19 | name: ood 20 | 21 | recorder: 22 | save_scores: True 23 | save_csv: True 24 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_draem.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: merge # disabled if 'save_output' is False choices: [default, pass, merge] 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | network: 12 | pretrained: True 13 | checkpoint: ["results/osr_mnist6_seed1_draem_train_e100_lr0.0001/draem_test_0.0001_100_bs32_osr_mnist6_seed1_best_epoch1_loss0.5001.ckpt", 14 | "results/osr_mnist6_seed1_draem_train_e100_lr0.0001/draem_test_0.0001_100_bs32_osr_mnist6_seed1_best_epoch1_loss0.5001_seg.ckpt"] 15 | # ignore if pretrained is false 16 | 17 | pipeline: 18 | name: test_ad 19 | 20 | evaluator: 21 | name: ood 22 | 23 | recorder: 24 | save_scores: True 25 | save_csv: True 26 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_dsvdd.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{evaluator.name}'_'@{postprocessor.name}'_'@{mark}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | mark: default # to mark the version of experiment 6 | 7 | num_gpus: 1 8 | num_workers: 0 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | 13 | R: 0 14 | c: None 15 | objective: one-class 16 | 17 | network: 18 | pretrained: True 19 | 20 | pipeline: 21 | name: test_ad 22 | 23 | evaluator: 24 | name: ood 25 | use_react: False 26 | 27 | recorder: 28 | save_scores: True 29 | save_csv: True 30 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_fsood.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{evaluator.name}'_'@{postprocessor.name}'_'@{mark}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | mark: default # to mark the version of experiment 6 | 7 | num_gpus: 1 8 | num_workers: 0 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | network: 13 | pretrained: True 14 | 15 | pipeline: 16 | name: test_ood 17 | 18 | evaluator: 19 | name: fsood 20 | 21 | recorder: 22 | save_scores: True 23 | save_csv: True 24 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_kdad.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer_name}'" 2 | output_dir: ./results/ 3 | save_output: False 4 | merge_option: merge # disabled if 'save_output' is False choices: [default, pass, merge] 5 | normal_class: 3 #use @ may let int -->str 6 | lamda: 0.01 7 | 8 | num_gpus: 1 9 | num_workers: 0 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | trainer_name: kdad 14 | dataset_name: '@{dataset.name}' 15 | direction_loss_only: False 16 | last_checkpoint: 201 17 | metrics: roc_auc 18 | pipeline: 19 | name: test_ad 20 | evaluator: 21 | name: kdad 22 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_ood.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{evaluator.name}'_'@{postprocessor.name}'_'@{mark}'/s'@{seed}'/'@{evaluator.ood_scheme}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | mark: default # to mark the version of experiment 6 | seed: 0 7 | 8 | num_gpus: 1 9 | num_workers: 0 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | network: 14 | pretrained: True 15 | 16 | pipeline: 17 | name: test_ood 18 | 19 | evaluator: 20 | name: ood 21 | ood_scheme: ood 22 | 23 | recorder: 24 | save_scores: True 25 | save_csv: True 26 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_ood_aps.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{evaluator.name}'_'@{postprocessor.name}'_'@{mark}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | force_merge: False # disabled if 'save_output' is False 5 | mark: default # to mark the version of experiment 6 | 7 | num_gpus: 1 8 | num_workers: 0 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | network: 13 | pretrained: True 14 | 15 | pipeline: 16 | name: test_ood_aps 17 | 18 | evaluator: 19 | name: ood 20 | 21 | recorder: 22 | save_scores: True 23 | save_csv: True 24 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_osr.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{evaluator.name}'_'@{postprocessor.name}'_'@{mark}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: merge # disabled if 'save_output' is False choices: [default, pass, merge] 5 | mark: default # to mark the version of experiment 6 | 7 | num_gpus: 1 8 | num_workers: 4 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | network: 13 | pretrained: True 14 | 15 | pipeline: 16 | name: test_ood 17 | 18 | evaluator: 19 | name: osr 20 | 21 | recorder: 22 | save_scores: True 23 | save_csv: True 24 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_patchcore.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{evaluator.name}'_'@{postprocessor.name}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | network: 12 | pretrained: False 13 | 14 | pipeline: 15 | name: test_ad 16 | 17 | evaluator: 18 | name: ad 19 | test_pix: True 20 | 21 | recorder: 22 | save_scores: True 23 | save_csv: True 24 | -------------------------------------------------------------------------------- /configs/pipelines/test/test_rd4ad.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: merge # disabled if 'save_output' is False choices: [default, pass, merge] 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | network: 12 | pretrained: True 13 | checkpoint: ["results/cifar10_rd4ad_net_rd4ad_e200_lr0.005_default/bn_best.ckpt", 14 | "results/cifar10_rd4ad_net_rd4ad_e200_lr0.005_default/decoder_best.ckpt"] 15 | # ignore if pretrained is false 16 | 17 | pipeline: 18 | name: test_ad 19 | 20 | evaluator: 21 | name: ood 22 | 23 | recorder: 24 | save_scores: True 25 | save_csv: True 26 | -------------------------------------------------------------------------------- /configs/pipelines/train/baseline.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_'@{mark}'/s'@{seed}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | mark: default 6 | seed: 0 7 | 8 | num_gpus: 1 9 | num_workers: 8 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | preprocessor: 14 | name: base 15 | 16 | network: 17 | pretrained: False 18 | 19 | pipeline: 20 | name: train 21 | 22 | trainer: 23 | name: base 24 | 25 | evaluator: 26 | name: base 27 | 28 | optimizer: 29 | name: sgd 30 | num_epochs: 100 31 | lr: 0.1 32 | momentum: 0.9 33 | weight_decay: 0.0005 34 | 35 | recorder: 36 | name: base 37 | save_all_models: False 38 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_arpl.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'/s'@{seed}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | seed: 0 6 | 7 | num_gpus: 1 8 | num_workers: 0 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | pipeline: 13 | name: train 14 | 15 | trainer: 16 | name: arpl 17 | 18 | evaluator: 19 | name: arpl 20 | 21 | optimizer: 22 | name: sgd 23 | num_epochs: 100 24 | lr: 0.1 25 | momentum: 0.9 26 | weight_decay: 0.0001 27 | 28 | recorder: 29 | name: arpl 30 | save_all_models: False 31 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_arpl_gan.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | loss: 12 | beta: 0.1 13 | 14 | pipeline: 15 | name: train_arplgan 16 | 17 | trainer: 18 | name: arpl_gan 19 | auxiliary: arpl 20 | 21 | evaluator: 22 | name: arpl 23 | 24 | optimizer: 25 | name: sgd 26 | num_epochs: 100 27 | lr: 0.1 28 | gan_lr: 0.0002 29 | momentum: 0.9 30 | weight_decay: 0.0005 31 | 32 | recorder: 33 | name: arpl 34 | save_all_models: False 35 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_augmix.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_'@{mark}'/s'@{seed}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | mark: default 6 | seed: 0 7 | 8 | num_gpus: 1 9 | num_workers: 8 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | pipeline: 14 | name: train 15 | 16 | trainer: 17 | name: augmix 18 | trainer_args: 19 | jsd: True 20 | lam: 12 21 | 22 | evaluator: 23 | name: base 24 | 25 | optimizer: 26 | name: sgd 27 | num_epochs: 100 28 | lr: 0.1 29 | momentum: 0.9 30 | weight_decay: 0.0005 31 | 32 | recorder: 33 | name: base 34 | save_all_models: False 35 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_conf_branch.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_'@{mark}'/s'@{seed}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | num_classes: '@{dataset.num_classes}' 6 | mark: default 7 | 8 | num_gpus: 1 9 | num_workers: 8 10 | num_machines: 1 11 | machine_rank: 0 12 | seed: 0 13 | 14 | baseline: False 15 | 16 | pipeline: 17 | name: train 18 | 19 | trainer: 20 | name: conf_branch 21 | budget: 0.3 22 | lmbda: 0.1 23 | eps: 1.0e-12 24 | 25 | evaluator: 26 | name: base 27 | 28 | optimizer: 29 | num_epochs: 100 30 | lr: 0.1 31 | momentum: 0.9 32 | nesterov: True 33 | weight_decay: 5.0e-4 34 | 35 | recorder: 36 | name: base 37 | save_all_models: False 38 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_cutmix.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_'@{mark}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | 6 | mark: default 7 | num_gpus: 1 8 | num_workers: 8 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | pipeline: 13 | name: train 14 | 15 | trainer: 16 | name: cutmix 17 | trainer_args: 18 | beta: 1.0 19 | cutmix_prob: 1.0 # cutmix probability 20 | 21 | evaluator: 22 | name: base 23 | 24 | optimizer: 25 | name: sgd 26 | num_epochs: 100 27 | lr: 0.1 28 | momentum: 0.9 29 | weight_decay: 0.0005 30 | 31 | recorder: 32 | name: base 33 | save_all_models: False 34 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_cutpaste.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | pipeline: 12 | name: train_ad 13 | 14 | trainer: 15 | name: cutpaste 16 | 17 | evaluator: 18 | name: ad 19 | 20 | optimizer: 21 | name: sgd 22 | num_epochs: 100 23 | lr: 0.03 24 | momentum: 0.9 25 | weight_decay: 0.0005 26 | 27 | recorder: 28 | name: ad 29 | save_all_models: False 30 | save_csv: False 31 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_dcae.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'" 2 | save_output: True 3 | merge_option: default 4 | normal_class: 3 5 | output_dir: ./results/ 6 | lr: 0.0001 7 | 8 | num_gpus: 1 9 | num_workers: 0 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | lr_milestones: [50] 14 | weight_decay: 0.5e-6 15 | 16 | R: 0 17 | c: None 18 | 19 | pipeline: 20 | name: train_ad 21 | evaluator: 22 | name: dcae 23 | trainer: 24 | name: dcae 25 | recorder: 26 | name: dcae 27 | save_all_models: False 28 | optimizer: 29 | name: adam 30 | num_epochs: 150 31 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_draem.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_train_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: merge 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | pipeline: 12 | name: train_ad 13 | 14 | trainer: 15 | name: draem 16 | 17 | evaluator: 18 | name: ad 19 | 20 | optimizer: 21 | name: MultiStep 22 | num_epochs: 700 23 | steps: [0.8, 0.9] 24 | lr: 0.0001 25 | gamma: 0.2 26 | 27 | recorder: 28 | name: ad 29 | best_model_basis: image_auroc 30 | save_all_models: False 31 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_dropout.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_dropout" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | 9 | pipeline: 10 | name: train 11 | 12 | trainer: 13 | name: dropout 14 | dropout_p: 0.5 15 | 16 | evaluator: 17 | name: base 18 | 19 | optimizer: 20 | name: sgd 21 | num_epochs: 100 22 | lr: 0.1 23 | momentum: 0.9 24 | weight_decay: 0.0005 25 | 26 | recorder: 27 | name: base 28 | save_all_models: False 29 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_dsvdd.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'" 2 | save_output: True 3 | merge_option: default 4 | normal_class: 3 5 | output_dir: ./results/ 6 | lr: 0.0001 7 | 8 | num_gpus: 1 9 | num_workers: 0 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | lr_milestones: [50] 14 | weight_decay: 0.5e-6 15 | warm_up_n_epochs: 10 16 | 17 | R: 0 18 | c: None 19 | 20 | pipeline: 21 | name: train_ad 22 | evaluator: 23 | name: ad 24 | 25 | trainer: 26 | name: dsvdd 27 | 28 | recorder: 29 | name: ad 30 | save_all_models: False 31 | 32 | optimizer: 33 | name: adam 34 | num_epochs: 150 35 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_ece.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | 6 | num_gpus: 1 7 | num_workers: 0 8 | num_machines: 1 9 | machine_rank: 0 10 | 11 | preprocessor: 12 | name: base 13 | 14 | pipeline: 15 | name: train 16 | 17 | trainer: 18 | name: base 19 | 20 | evaluator: 21 | name: ece 22 | 23 | optimizer: 24 | name: sgd 25 | num_epochs: 100 26 | lr: 0.1 27 | momentum: 0.9 28 | weight_decay: 0.0005 29 | 30 | recorder: 31 | name: base 32 | save_all_models: False 33 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_kdad.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | normal_class: 3 6 | lamda: 0.01 7 | dataset_name: '@{dataset.name}' 8 | direction_loss_only: False 9 | learning_rate: 1e-3 10 | metrics: roc_auc 11 | last_checkpoint: 201 12 | continue_train: False 13 | 14 | num_gpus: 1 15 | num_workers: 0 16 | num_machines: 1 17 | machine_rank: 0 18 | 19 | pipeline: 20 | name: train_ad 21 | evaluator: 22 | name: kdad 23 | trainer: 24 | name: kdad 25 | recorder: 26 | name: kdad 27 | save_all_models: False 28 | optimizer: 29 | num_epochs: 201 30 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_logitnorm.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_alpha'@{trainer.trainer_args.tau}'_'@{mark}'/s'@{seed}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | mark: default 6 | seed: 0 7 | 8 | num_gpus: 1 9 | num_workers: 8 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | preprocessor: 14 | name: base 15 | 16 | pipeline: 17 | name: train 18 | 19 | trainer: 20 | name: logitnorm 21 | trainer_args: 22 | tau: 0.04 23 | 24 | evaluator: 25 | name: base 26 | 27 | optimizer: 28 | name: sgd 29 | num_epochs: 100 30 | lr: 0.1 31 | momentum: 0.9 32 | weight_decay: 0.0005 33 | 34 | recorder: 35 | name: base 36 | save_all_models: False 37 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_mcd.yml: -------------------------------------------------------------------------------- 1 | pipeline: 2 | name: train_oe 3 | 4 | trainer: 5 | name: mcd 6 | lambda_oe: 1 7 | margin: 1.2 8 | start_epoch_ft: 90 9 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_mixoe.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_alpha'@{trainer.alpha}'_beta'@{trainer.beta}'_'@{trainer.mix_op}'_lam'@{trainer.lambda_oe}'_'@{mark}'/s'@{seed}'" 2 | 3 | pipeline: 4 | name: train_oe 5 | 6 | trainer: 7 | name: mixoe 8 | lambda_oe: 1.0 9 | alpha: 0.1 10 | beta: 1.0 11 | mix_op: cutmix 12 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_mixup.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'\ 2 | _e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'\ 3 | _alpha'@{trainer.trainer_args.alpha}'_'@{mark}'" 4 | output_dir: ./results/ 5 | save_output: True 6 | merge_option: default 7 | mark: default 8 | 9 | 10 | num_gpus: 1 11 | num_workers: 8 12 | num_machines: 1 13 | machine_rank: 0 14 | 15 | pipeline: 16 | name: train 17 | 18 | trainer: 19 | name: mixup 20 | trainer_args: 21 | alpha: 0.2 22 | 23 | evaluator: 24 | name: base 25 | 26 | optimizer: 27 | name: sgd 28 | num_epochs: 100 29 | lr: 0.1 30 | momentum: 0.9 31 | weight_decay: 0.0005 32 | 33 | recorder: 34 | name: base 35 | save_all_models: False 36 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_oe.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_lam'@{trainer.lambda_oe}'_'@{mark}'/s'@{seed}'" 2 | 3 | pipeline: 4 | name: train_oe 5 | 6 | trainer: 7 | name: oe 8 | lambda_oe: 0.5 9 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_opengan.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_'@{mark}'/s'@{seed}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default 5 | mark: default 6 | seed: 0 7 | 8 | dataset: 9 | # cached features extracted from classifier 10 | feat_root: './results/cifar10_resnet18_32x32_feat_extract_opengan_default/s0' 11 | 12 | num_gpus: 1 13 | num_workers: 8 14 | num_machines: 1 15 | machine_rank: 0 16 | 17 | pipeline: 18 | name: train_opengan 19 | 20 | trainer: 21 | name: opengan 22 | 23 | evaluator: 24 | name: ood 25 | 26 | optimizer: 27 | name: Adam 28 | num_epochs: 100 29 | lr: 0.0001 30 | beta1: 0.5 31 | 32 | recorder: 33 | name: opengan 34 | save_all_models: False 35 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_opengan_feat_extract.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'_'@{mark}'/s'@{seed}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | merge_option: default # disabled if 'save_output' is False 5 | mark: default 6 | seed: 0 7 | 8 | num_gpus: 1 9 | num_workers: 8 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | network: 14 | pretrained: True 15 | 16 | pipeline: 17 | name: feat_extract_opengan 18 | 19 | evaluator: 20 | name: base 21 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_rd4ad.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'_e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'_'@{mark}'" 2 | output_dir: ./results/ 3 | save_output: True 4 | force_merge: False 5 | merge_option: merge 6 | mark: default 7 | 8 | num_gpus: 1 9 | num_workers: 0 10 | num_machines: 1 11 | machine_rank: 0 12 | 13 | preprocessor: 14 | name: base 15 | 16 | pipeline: 17 | name: train_ad 18 | 19 | trainer: 20 | name: rd4ad 21 | 22 | evaluator: 23 | name: ad 24 | 25 | optimizer: 26 | name: adam 27 | num_epochs: 200 28 | lr: 0.005 29 | betas: [0.5,0.999] 30 | 31 | recorder: 32 | name: rd4ad 33 | save_all_models: False 34 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_regmixup.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'\ 2 | _e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'\ 3 | _alpha'@{trainer.trainer_args.alpha}'_'@{mark}'/s'@{seed}'" 4 | output_dir: ./results/ 5 | save_output: True 6 | merge_option: default 7 | mark: default 8 | seed: 0 9 | 10 | num_gpus: 1 11 | num_workers: 8 12 | num_machines: 1 13 | machine_rank: 0 14 | 15 | pipeline: 16 | name: train 17 | 18 | trainer: 19 | name: regmixup 20 | trainer_args: 21 | alpha: 20 22 | 23 | evaluator: 24 | name: base 25 | 26 | optimizer: 27 | name: sgd 28 | num_epochs: 100 29 | lr: 0.1 30 | momentum: 0.9 31 | weight_decay: 0.0005 32 | 33 | recorder: 34 | name: base 35 | save_all_models: False 36 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_sem.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{trainer.name}'\ 2 | _e'@{optimizer.num_epochs}'_lr'@{optimizer.lr}'" 3 | output_dir: ./results/ 4 | save_output: True 5 | merge_option: default 6 | 7 | num_gpus: 1 8 | num_workers: 0 9 | num_machines: 1 10 | machine_rank: 0 11 | 12 | pipeline: 13 | name: finetune 14 | 15 | network: 16 | pretrained: True 17 | 18 | trainer: 19 | name: sae 20 | trainer_args: 21 | num_clusters: 3 22 | feature_type: stat # flat/mean/stat 23 | reduce_dim: pca_50 # none/capca_10/pca_50 24 | loss_weight: [0.5, 0.5, 0.1, 0.1] # [cls_std, cls_mix, sae_id, sae_ood] 25 | alpha: 0.5 26 | 27 | evaluator: 28 | name: base 29 | 30 | optimizer: 31 | name: sgd 32 | num_epochs: 30 33 | lr: 0.05 34 | momentum: 0.9 35 | weight_decay: 0.0005 36 | 37 | recorder: 38 | name: base 39 | save_all_models: False 40 | -------------------------------------------------------------------------------- /configs/pipelines/train/train_udg.yml: -------------------------------------------------------------------------------- 1 | pipeline: 2 | name: train_oe 3 | 4 | trainer: 5 | name: udg 6 | num_clusters: 1000 7 | pca_dim: 256 8 | purity_ind_thresh: 0.8 9 | purity_ood_thresh: 0.8 10 | oe_enhance_ratio: 2.0 11 | lambda_oe: 0.5 12 | lambda_aux: 0.1 13 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/cifar_gmm_0.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_'@{postprocessor.name}'\ 3 | _'@{postprocessor.postprocessor_args.num_clusters_list}'\ 4 | _'@{postprocessor.postprocessor_args.feature_type_list}'\ 5 | _'@{postprocessor.postprocessor_args.alpha_list}'\ 6 | _'@{postprocessor.postprocessor_args.reduce_dim_list}'\ 7 | _'@{mark}'" 8 | 9 | postprocessor: 10 | name: gmm 11 | postprocessor_args: 12 | num_clusters_list: [3, 1, 1, 1, 10] 13 | feature_type_list: [stat, mean, mean, mean, flat] # flat/mean/stat 14 | alpha_list: [-0.0001, 0, 0, 0, 1] 15 | reduce_dim_list: [pca_10, none, none, none, pca_10] # none/capca_10/pca_50 16 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/cifar_gmm_1.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_'@{postprocessor.name}'\ 3 | _'@{postprocessor.postprocessor_args.num_clusters_list}'\ 4 | _'@{postprocessor.postprocessor_args.feature_type_list}'\ 5 | _'@{postprocessor.postprocessor_args.alpha_list}'\ 6 | _'@{postprocessor.postprocessor_args.reduce_dim_list}'\ 7 | _'@{mark}'" 8 | 9 | postprocessor: 10 | name: gmm 11 | postprocessor_args: 12 | num_clusters_list: [3, 1, 1, 1, 10] 13 | feature_type_list: [stat, mean, mean, mean, flat] # flat/mean/stat 14 | alpha_list: [-0.0001, 0, 0, 0, 1] 15 | reduce_dim_list: [pca_50, none, none, none, pca_50] # none/capca_10/pca_50 16 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/cifar_gmm_2.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_'@{postprocessor.name}'\ 3 | _'@{postprocessor.postprocessor_args.num_clusters_list}'\ 4 | _'@{postprocessor.postprocessor_args.feature_type_list}'\ 5 | _'@{postprocessor.postprocessor_args.alpha_list}'\ 6 | _'@{postprocessor.postprocessor_args.reduce_dim_list}'\ 7 | _'@{mark}'" 8 | 9 | postprocessor: 10 | name: gmm 11 | postprocessor_args: 12 | num_clusters_list: [3, 1, 1, 1, 10] 13 | feature_type_list: [stat, mean, mean, mean, flat] # flat/mean/stat 14 | alpha_list: [-0.0001, 0, 0, 0, 1] 15 | reduce_dim_list: [pca_50, none, none, none, pca_50] # none/capca_10/pca_50 16 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/cifar_gmm_3.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_'@{postprocessor.name}'\ 3 | _'@{postprocessor.postprocessor_args.num_clusters_list}'\ 4 | _'@{postprocessor.postprocessor_args.feature_type_list}'\ 5 | _'@{postprocessor.postprocessor_args.alpha_list}'\ 6 | _'@{postprocessor.postprocessor_args.reduce_dim_list}'\ 7 | _'@{mark}'" 8 | 9 | postprocessor: 10 | name: gmm 11 | postprocessor_args: 12 | num_clusters_list: [3, 1, 1, 1, 10] 13 | feature_type_list: [stat, mean, mean, mean, flat] # flat/mean/stat 14 | alpha_list: [-0.0001, 0, 0, 0, 1] 15 | reduce_dim_list: [pca_50, none, none, none, pca_50] # none/capca_10/pca_50 16 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/cifar_gmm_4.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_'@{postprocessor.name}'\ 3 | _'@{postprocessor.postprocessor_args.num_clusters_list}'\ 4 | _'@{postprocessor.postprocessor_args.feature_type_list}'\ 5 | _'@{postprocessor.postprocessor_args.alpha_list}'\ 6 | _'@{postprocessor.postprocessor_args.reduce_dim_list}'\ 7 | _'@{mark}'" 8 | 9 | postprocessor: 10 | name: gmm 11 | postprocessor_args: 12 | num_clusters_list: [3, 1, 1, 1, 10] 13 | feature_type_list: [stat, mean, mean, mean, flat] # flat/mean/stat 14 | alpha_list: [-0.0001, 0, 0, 0, 1] 15 | reduce_dim_list: [pca_50, none, none, none, pca_50] # none/capca_10/pca_50 16 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/covid_gmm_0.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_'@{postprocessor.name}'\ 3 | _'@{postprocessor.postprocessor_args.num_clusters_list}'\ 4 | _'@{postprocessor.postprocessor_args.feature_type_list}'\ 5 | _'@{postprocessor.postprocessor_args.alpha_list}'\ 6 | _'@{postprocessor.postprocessor_args.reduce_dim_list}'\ 7 | _'@{mark}'" 8 | 9 | postprocessor: 10 | name: gmm 11 | postprocessor_args: 12 | num_clusters_list: [1, 1, 1, 1, 5] 13 | feature_type_list: [stat, mean, mean, mean, flat] # flat/mean/stat 14 | alpha_list: [-0.001, 0, 0, 0, 1] 15 | reduce_dim_list: [pca_10, pca_10, pca_10, pca_10, pca_10] # none/capca_10/pca_50 16 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/mnist_gmm_0.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_gmm0_'@{mark}'" 3 | 4 | postprocessor: 5 | name: gmm 6 | postprocessor_args: 7 | num_clusters_list: [3, 1, 10] 8 | feature_type_list: [flat, mean, flat] # flat/mean/stat 9 | alpha_list: [1, 0, 0] 10 | reduce_dim_list: [pca_50, none, pca_50] # none/capca_10/pca_50 11 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/mnist_gmm_1.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_gmm1_'@{mark}'" 3 | 4 | postprocessor: 5 | name: gmm 6 | postprocessor_args: 7 | num_clusters_list: [3, 1, 10] 8 | feature_type_list: [flat, mean, flat] # flat/mean/stat 9 | alpha_list: [-0.001, 0, 1] 10 | reduce_dim_list: [none, none, pca_50] # none/capca_10/pca_50 11 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/mnist_gmm_2.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_gmm2_'@{mark}'" 3 | 4 | postprocessor: 5 | name: gmm 6 | postprocessor_args: 7 | num_clusters_list: [3, 1, 10] 8 | feature_type_list: [flat, mean, flat] # flat/mean/stat 9 | alpha_list: [-0.01, 0, 1] 10 | reduce_dim_list: [none, none, pca_50] # none/capca_10/pca_50 11 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/mnist_gmm_3.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_gmm3_'@{mark}'" 3 | 4 | postprocessor: 5 | name: gmm 6 | postprocessor_args: 7 | num_clusters_list: [3, 1, 10] 8 | feature_type_list: [stat, mean, flat] # flat/mean/stat 9 | alpha_list: [-0.01, 0, 1] 10 | reduce_dim_list: [none, none, pca_50] # none/capca_10/pca_50 11 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/mnist_gmm_4.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_gmm4_'@{mark}'" 3 | 4 | postprocessor: 5 | name: gmm 6 | postprocessor_args: 7 | num_clusters_list: [3, 1, 10] 8 | feature_type_list: [stat, mean, flat] # flat/mean/stat 9 | alpha_list: [-0.01, 0, 1] 10 | reduce_dim_list: [none, none, pca_50] # none/capca_10/pca_50 11 | -------------------------------------------------------------------------------- /configs/postprocessors/_gmm_iter/mnist_gmm_5.yml: -------------------------------------------------------------------------------- 1 | exp_name: "'@{dataset.name}'_'@{network.name}'_'@{pipeline.name}'\ 2 | _'@{evaluator.name}'_gmm0_'@{mark}'" 3 | 4 | postprocessor: 5 | name: gmm 6 | postprocessor_args: 7 | num_clusters_list: [3, 1, 10] 8 | feature_type_list: [stat, mean, flat] # flat/mean/stat 9 | alpha_list: [-0.01, 0, 1] 10 | reduce_dim_list: [none, none, pca_50] # none/capca_10/pca_50 11 | -------------------------------------------------------------------------------- /configs/postprocessors/ash.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: ash 3 | APS_mode: True 4 | postprocessor_args: 5 | percentile: 90 6 | postprocessor_sweep: 7 | percentile_list: [70, 75, 80, 85, 90, 95] 8 | -------------------------------------------------------------------------------- /configs/postprocessors/ebo.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: ebo 3 | APS_mode: False 4 | postprocessor_args: 5 | temperature: 1 6 | postprocessor_sweep: 7 | temperature_list: [1, 10, 100, 1000] 8 | -------------------------------------------------------------------------------- /configs/postprocessors/godin.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: godin 3 | APS_mode: False 4 | postprocessor_args: 5 | score_func: h # use h or g 6 | noise_magnitude: 0.0025 # in range of [0, 0.0025, 0.005, 0.01, 0.02, 0.04, 0.08] 7 | -------------------------------------------------------------------------------- /configs/postprocessors/gradnorm.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: gradnorm 3 | APS_mode: False 4 | postprocessor_args: 5 | -------------------------------------------------------------------------------- /configs/postprocessors/gram.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: gram 3 | APS_mode: True 4 | postprocessor_args: 5 | powers: [1,2,3,4,5] 6 | postprocessor_sweep: 7 | powers_list: [[1,2,3,4,5]] 8 | -------------------------------------------------------------------------------- /configs/postprocessors/klm.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: klm 3 | APS_mode: False 4 | -------------------------------------------------------------------------------- /configs/postprocessors/knn.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: knn 3 | APS_mode: True 4 | postprocessor_args: 5 | K: 50 6 | postprocessor_sweep: 7 | K_list: [50, 100, 200, 500, 1000] 8 | -------------------------------------------------------------------------------- /configs/postprocessors/mds.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: mds 3 | APS_mode: False 4 | -------------------------------------------------------------------------------- /configs/postprocessors/mds_ensemble.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: mds_ensemble 3 | APS_mode: True 4 | postprocessor_args: 5 | noise: 0.0014 6 | feature_type_list: [mean] # flat/mean/stat 7 | alpha_list: [1] 8 | reduce_dim_list: [none] # none/capca/pca_50/lda 9 | postprocessor_sweep: 10 | noise_list: [0.0014] 11 | -------------------------------------------------------------------------------- /configs/postprocessors/mls.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: mls 3 | APS_mode: False 4 | postprocessor_args: 5 | -------------------------------------------------------------------------------- /configs/postprocessors/msp.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: msp 3 | APS_mode: False 4 | -------------------------------------------------------------------------------- /configs/postprocessors/odin.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: odin 3 | APS_mode: True 4 | postprocessor_args: 5 | temperature: 1000 6 | noise: 0.0014 7 | postprocessor_sweep: 8 | temperature: [1, 10, 100, 1000] 9 | noise: [0.0014, 0.0028] 10 | -------------------------------------------------------------------------------- /configs/postprocessors/rankfeat.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: rankfeat 3 | APS_mode: False 4 | postprocessor_args: 5 | accelerate: False 6 | temperature: 1 7 | -------------------------------------------------------------------------------- /configs/postprocessors/react.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: react 3 | APS_mode: True 4 | postprocessor_args: 5 | percentile: 90 6 | postprocessor_sweep: 7 | percentile_list: [85, 90, 95, 99] 8 | -------------------------------------------------------------------------------- /configs/postprocessors/rmds.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: rel_mds 3 | APS_mode: False 4 | -------------------------------------------------------------------------------- /configs/postprocessors/rot.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: rot 3 | APS_mode: False 4 | -------------------------------------------------------------------------------- /configs/postprocessors/rotpred.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: rot 3 | APS_mode: False 4 | -------------------------------------------------------------------------------- /configs/postprocessors/she.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: she 3 | APS_mode: False 4 | postprocessor_args: 5 | metric: inner_product 6 | -------------------------------------------------------------------------------- /configs/postprocessors/ssd.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: mds 3 | APS_mode: True 4 | postprocessor_args: 5 | noise: 0.0014 6 | feature_type_list: [mean] # flat/mean/stat 7 | alpha_list: [1] 8 | reduce_dim_list: [none] # none/capca/pca_50/lda 9 | postprocessor_sweep: 10 | noise_list: [0.0014] 11 | -------------------------------------------------------------------------------- /configs/postprocessors/temp_scaling.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: temperature_scaling 3 | APS_mode: False 4 | -------------------------------------------------------------------------------- /configs/postprocessors/vim.yml: -------------------------------------------------------------------------------- 1 | postprocessor: 2 | name: vim 3 | APS_mode: True 4 | postprocessor_args: 5 | dim: 256 6 | postprocessor_sweep: 7 | dim_list: [256, 1000] 8 | -------------------------------------------------------------------------------- /configs/preprocessors/augmix_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: augmix 3 | severity: 1 # see torchvision docs for meaning of the args 4 | all_ops: true 5 | mixture_width: 3 6 | alpha: 1.0 7 | chain_depth: -1 8 | -------------------------------------------------------------------------------- /configs/preprocessors/base_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: base 3 | -------------------------------------------------------------------------------- /configs/preprocessors/csi_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: csi 3 | -------------------------------------------------------------------------------- /configs/preprocessors/cutout_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: cutout 3 | n_holes: 1 4 | length: 16 5 | -------------------------------------------------------------------------------- /configs/preprocessors/cutpaste_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: cutpaste 3 | preprocessor_args: 4 | area_ratio: [0.02, 0.15] 5 | aspect_ratio: 0.3 6 | -------------------------------------------------------------------------------- /configs/preprocessors/draem_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: draem 3 | preprocessor_args: 4 | image_size: 256 5 | anomaly_source: ./data/images_classic/texture 6 | -------------------------------------------------------------------------------- /configs/preprocessors/patchcore_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: patchcore 3 | -------------------------------------------------------------------------------- /configs/preprocessors/pixmix_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: pixmix 3 | preprocessor_args: 4 | mixing_set_dir: data/benchmark_imglist/cifar10/fractals_fvis.txt 5 | aug_severity: 3 # severity of base augmentation operators 6 | all_ops: true # turn on all augmentation operations (+brightness,contrast,color,sharpness 7 | k: 4 # augment the image a random number of times with a maximum of k times (mixing iterations) 8 | beta: 3 # severity of mixing 9 | -------------------------------------------------------------------------------- /configs/preprocessors/randaugment_preprocessor.yml: -------------------------------------------------------------------------------- 1 | preprocessor: 2 | name: randaugment 3 | n: 1 4 | m: 14 5 | -------------------------------------------------------------------------------- /domainbed/benchmark_notes/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Create Time: 22/3/2023 3 | Author: BierOne (lyibing112@gmail.com) 4 | """ 5 | -------------------------------------------------------------------------------- /domainbed/config.yaml: -------------------------------------------------------------------------------- 1 | # Default update config 2 | # Config order: hparams_registry -> config.yaml -> CLI 3 | swad: False # True / False 4 | swad_kwargs: 5 | n_converge: 3 6 | n_tolerance: 6 7 | tolerance_ratio: 0.3 8 | test_batchsize: 128 9 | 10 | # resnet18, resnet50 vit-t16, vit-b16 11 | model: resnet50 12 | feat_layers: stem_block 13 | 14 | # MIRO params 15 | ld: 0.1 # lambda 16 | lr_mult: 10. 17 | 18 | # Coverage params 19 | coverage: True 20 | coverage_kwargs: 21 | report_name: micro_avg 22 | build_kwargs: 23 | O: 500 24 | M: 50 25 | step_kwargs: 26 | sig_alpha: 1e-1 27 | method: sigmoid(o*g_kl[f]) 28 | save_state: False 29 | update_kwargs: 30 | method: avg 31 | -------------------------------------------------------------------------------- /domainbed/domainbed/algorithms/__init__.py: -------------------------------------------------------------------------------- 1 | from .algorithms import * 2 | from .miro import MIRO 3 | 4 | 5 | def get_algorithm_class(algorithm_name): 6 | """Return the algorithm class with the given name.""" 7 | if algorithm_name not in globals(): 8 | raise NotImplementedError("Algorithm not found: {}".format(algorithm_name)) 9 | return globals()[algorithm_name] 10 | -------------------------------------------------------------------------------- /domainbed/domainbed/datasets/transforms.py: -------------------------------------------------------------------------------- 1 | from torchvision import transforms as T 2 | 3 | 4 | basic = T.Compose( 5 | [ 6 | T.Resize((224, 224)), 7 | T.ToTensor(), 8 | T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), 9 | ] 10 | ) 11 | aug = T.Compose( 12 | [ 13 | T.RandomResizedCrop(224, scale=(0.7, 1.0)), 14 | T.RandomHorizontalFlip(), 15 | T.ColorJitter(0.3, 0.3, 0.3, 0.3), 16 | T.RandomGrayscale(p=0.1), 17 | T.ToTensor(), 18 | T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), 19 | ] 20 | ) 21 | -------------------------------------------------------------------------------- /domainbed/domainbed/networks/__init__.py: -------------------------------------------------------------------------------- 1 | from .networks import * 2 | from .ur_networks import URFeaturizer, URResNet 3 | -------------------------------------------------------------------------------- /domainbed/domainbed/optimizers.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | 4 | def get_optimizer(name, params, **kwargs): 5 | name = name.lower() 6 | optimizers = {"adam": torch.optim.Adam, "sgd": torch.optim.SGD, "adamw": torch.optim.AdamW} 7 | optim_cls = optimizers[name] 8 | 9 | return optim_cls(params, **kwargs) 10 | -------------------------------------------------------------------------------- /domainbed/param_config/erm_config.yaml: -------------------------------------------------------------------------------- 1 | # Default update config for ERM 2 | # Config order: hparams_registry -> config.yaml -> CLI 3 | ERM_PACS_params: 4 | lr: 1e-5 5 | resnet_dropout: 0.1 6 | weight_decay: 1e-4 7 | 8 | ERM_VLCS_params: 9 | lr: 1e-5 10 | resnet_dropout: 0.1 11 | weight_decay: 1e-4 12 | 13 | ERM_OfficeHome_params: 14 | lr: 1e-5 15 | resnet_dropout: 0.5 16 | weight_decay: 1e-6 17 | 18 | ERM_TerraIncognita_params: 19 | lr: 3e-5 20 | resnet_dropout: 0.0 21 | weight_decay: 1e-4 22 | 23 | ERM_DomainNet_params: 24 | lr: 3e-5 25 | resnet_dropout: 0.5 26 | weight_decay: 1e-6 27 | -------------------------------------------------------------------------------- /domainbed/requirements.txt: -------------------------------------------------------------------------------- 1 | prettytable==2.0.0 2 | numpy==1.19.4 3 | torch==1.7.0+cu92 4 | gdown==3.12.2 5 | imageio==2.9.0 6 | sconf==0.2.3 7 | torchvision==0.8.1+cu92 8 | tqdm==4.51.0 9 | tensorboard==2.3.0 10 | Pillow==8.1.0 11 | tensorboardX==2.1 -------------------------------------------------------------------------------- /figures/cifar10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BierOne/ood_coverage/b00278098a8f4c629d785161c48605a5f837d563/figures/cifar10.png -------------------------------------------------------------------------------- /openood/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BierOne/ood_coverage/b00278098a8f4c629d785161c48605a5f837d563/openood/__init__.py -------------------------------------------------------------------------------- /openood/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | from .utils import get_dataloader, get_feature_dataloader, get_feature_opengan_dataloader, get_ood_dataloader 2 | -------------------------------------------------------------------------------- /openood/datasets/feature_dataset.py: -------------------------------------------------------------------------------- 1 | from torch.utils.data import Dataset 2 | 3 | 4 | class FeatDataset(Dataset): 5 | def __init__(self, feat, labels): 6 | self.data = feat 7 | self.labels = labels 8 | self.len = feat.shape[0] 9 | assert self.len == len(labels) 10 | 11 | def __len__(self): 12 | return self.len 13 | 14 | def __getitem__(self, idx): 15 | data = self.data[idx] 16 | label = self.labels[idx] 17 | return {'data': data, 'label': label} 18 | -------------------------------------------------------------------------------- /openood/evaluation_api/__init__.py: -------------------------------------------------------------------------------- 1 | from .evaluator import Evaluator 2 | -------------------------------------------------------------------------------- /openood/evaluators/__init__.py: -------------------------------------------------------------------------------- 1 | from .utils import get_evaluator 2 | -------------------------------------------------------------------------------- /openood/losses/__init__.py: -------------------------------------------------------------------------------- 1 | from .draem_loss import get_draem_losses 2 | from .reweight import rew_ce, rew_sce 3 | from .sce import soft_cross_entropy 4 | -------------------------------------------------------------------------------- /openood/losses/draem_loss.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | from .focal import FocalLoss 4 | from .ssim import SSIM 5 | 6 | 7 | def get_draem_losses(): 8 | losses = { 9 | 'l2': torch.nn.modules.loss.MSELoss(), 10 | 'ssim': SSIM(), 11 | 'focal': FocalLoss() 12 | } 13 | return losses 14 | -------------------------------------------------------------------------------- /openood/losses/rd4ad_loss.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from torch import nn 3 | 4 | def loss_function(a, b): 5 | 6 | cos_loss = torch.nn.CosineSimilarity() 7 | loss = 0 8 | for item in range(len(a)): 9 | loss += torch.mean(1-cos_loss(a[item].view(a[item].shape[0],-1), 10 | b[item].view(b[item].shape[0],-1))) 11 | return loss -------------------------------------------------------------------------------- /openood/losses/reweight.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn.functional as F 3 | 4 | from .sce import soft_cross_entropy 5 | 6 | 7 | def rew_ce(logits, labels, sample_weights): 8 | losses = F.cross_entropy(logits, labels, reduction='none') 9 | return (losses * sample_weights.type_as(losses)).mean() 10 | 11 | 12 | def rew_sce(logits, soft_labels, sample_weights): 13 | losses = soft_cross_entropy(logits, soft_labels, reduce=False) 14 | return torch.mean(losses * sample_weights.type_as(losses)) 15 | -------------------------------------------------------------------------------- /openood/networks/__init__.py: -------------------------------------------------------------------------------- 1 | from .ash_net import ASHNet 2 | from .densenet import DenseNet3 3 | # from .mmcls_featext import ImageClassifierWithReturnFeature 4 | from .resnet18_32x32 import ResNet18_32x32 5 | from .resnet18_224x224 import ResNet18_224x224 6 | from .resnet50 import ResNet50 7 | from .utils import get_network 8 | from .wrn import WideResNet 9 | from .swin_t import Swin_T 10 | from .vit_b_16 import ViT_B_16 11 | -------------------------------------------------------------------------------- /openood/networks/dropout_net.py: -------------------------------------------------------------------------------- 1 | import torch.nn as nn 2 | import torch.nn.functional as F 3 | 4 | 5 | class DropoutNet(nn.Module): 6 | def __init__(self, backbone, dropout_p): 7 | super(DropoutNet, self).__init__() 8 | self.backbone = backbone 9 | self.dropout_p = dropout_p 10 | 11 | def forward(self, x, use_dropout=True): 12 | if use_dropout: 13 | return self.forward_with_dropout(x) 14 | else: 15 | return self.backbone(x) 16 | 17 | def forward_with_dropout(self, x): 18 | _, feature = self.backbone(x, return_feature=True) 19 | feature = F.dropout2d(feature, self.dropout_p, training=True) 20 | logits_cls = self.backbone.fc(feature) 21 | 22 | return logits_cls 23 | -------------------------------------------------------------------------------- /openood/networks/mcd_net.py: -------------------------------------------------------------------------------- 1 | import torch.nn as nn 2 | 3 | 4 | class MCDNet(nn.Module): 5 | def __init__(self, backbone, num_classes): 6 | super(MCDNet, self).__init__() 7 | 8 | self.backbone = backbone 9 | try: 10 | feature_size = backbone.feature_size 11 | except AttributeError: 12 | feature_size = backbone.module.feature_size 13 | 14 | self.fc1 = nn.Linear(feature_size, num_classes) 15 | self.fc2 = nn.Linear(feature_size, num_classes) 16 | 17 | # test conf 18 | def forward(self, x, return_double=False): 19 | 20 | _, feature = self.backbone(x, return_feature=True) 21 | 22 | logits1 = self.fc1(feature) 23 | logits2 = self.fc2(feature) 24 | 25 | if return_double: 26 | return logits1, logits2 27 | else: 28 | return logits1 29 | -------------------------------------------------------------------------------- /openood/networks/mmcls_featext.py: -------------------------------------------------------------------------------- 1 | from mmcls.models import CLASSIFIERS, ImageClassifier 2 | 3 | 4 | @CLASSIFIERS.register_module() 5 | class ImageClassifierWithReturnFeature(ImageClassifier): 6 | def forward(self, x, *args, **kwargs): 7 | if 'return_feature' in kwargs: 8 | return self.backbone(x)[0][-1] 9 | else: 10 | return super().forward(x, *args, **kwargs) 11 | -------------------------------------------------------------------------------- /openood/networks/simclr_net.py: -------------------------------------------------------------------------------- 1 | import torch.nn as nn 2 | import torch.nn.functional as F 3 | 4 | 5 | class SimClrNet(nn.Module): 6 | def __init__(self, backbone, out_dim=128) -> None: 7 | super(SimClrNet, self).__init__() 8 | 9 | self.backbone = backbone 10 | feature_dim = backbone.feature_size 11 | self.simclr_head = nn.Sequential( 12 | nn.Linear(feature_dim, feature_dim), 13 | nn.ReLU(inplace=True), 14 | nn.Linear(feature_dim, out_dim) 15 | ) 16 | 17 | def forward(self, x, return_feature=False, return_feature_list=False): 18 | _, feature = self.backbone.forward(x, return_feature=True) 19 | 20 | return _, [F.normalize(self.simclr_head(feature), dim=-1)] -------------------------------------------------------------------------------- /openood/pipelines/__init__.py: -------------------------------------------------------------------------------- 1 | from .utils import get_pipeline 2 | -------------------------------------------------------------------------------- /openood/postprocessors/conf_branch_postprocessor.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | import torch 4 | import torch.nn as nn 5 | 6 | from .base_postprocessor import BasePostprocessor 7 | 8 | 9 | class ConfBranchPostprocessor(BasePostprocessor): 10 | def __init__(self, config): 11 | super(ConfBranchPostprocessor, self).__init__(config) 12 | self.config = config 13 | 14 | @torch.no_grad() 15 | def postprocess(self, net: nn.Module, data: Any): 16 | output, conf = net(data, return_confidence=True) 17 | conf = torch.sigmoid(conf) 18 | _, pred = torch.max(output, dim=1) 19 | return pred, conf 20 | -------------------------------------------------------------------------------- /openood/postprocessors/info.py: -------------------------------------------------------------------------------- 1 | num_classes_dict = { 2 | 'cifar10': 10, 3 | 'cifar100': 100, 4 | 'imagenet200': 200, 5 | 'imagenet': 1000 6 | } 7 | -------------------------------------------------------------------------------- /openood/postprocessors/maxlogit_postprocessor.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | import numpy as np 4 | import torch 5 | import torch.nn as nn 6 | from tqdm import tqdm 7 | 8 | from .base_postprocessor import BasePostprocessor 9 | 10 | 11 | class MaxLogitPostprocessor(BasePostprocessor): 12 | def __init__(self, config): 13 | super().__init__(config) 14 | self.args = self.config.postprocessor.postprocessor_args 15 | 16 | @torch.no_grad() 17 | def postprocess(self, net: nn.Module, data: Any): 18 | output = net(data) 19 | conf, pred = torch.max(output, dim=1) 20 | return pred, conf 21 | -------------------------------------------------------------------------------- /openood/postprocessors/mcd_postprocessor.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | import torch 4 | import torch.nn as nn 5 | 6 | from .base_postprocessor import BasePostprocessor 7 | 8 | 9 | class MCDPostprocessor(BasePostprocessor): 10 | @torch.no_grad() 11 | def postprocess(self, net: nn.Module, data: Any): 12 | logits1, logits2 = net(data, return_double=True) 13 | score1 = torch.softmax(logits1, dim=1) 14 | score2 = torch.softmax(logits2, dim=1) 15 | conf = -torch.sum(torch.abs(score1 - score2), dim=1) 16 | _, pred = torch.max(score1, dim=1) 17 | return pred, conf 18 | -------------------------------------------------------------------------------- /openood/postprocessors/nac/__init__.py: -------------------------------------------------------------------------------- 1 | from .coverage import KMNC -------------------------------------------------------------------------------- /openood/preprocessors/__init__.py: -------------------------------------------------------------------------------- 1 | from .base_preprocessor import BasePreprocessor 2 | from .cutpaste_preprocessor import CutPastePreprocessor 3 | from .draem_preprocessor import DRAEMPreprocessor 4 | from .pixmix_preprocessor import PixMixPreprocessor 5 | from .test_preprocessor import TestStandardPreProcessor 6 | from .utils import get_preprocessor 7 | -------------------------------------------------------------------------------- /openood/preprocessors/test_preprocessor.py: -------------------------------------------------------------------------------- 1 | import torchvision.transforms as tvs_trans 2 | 3 | from openood.utils.config import Config 4 | 5 | from .base_preprocessor import BasePreprocessor 6 | from .transform import Convert 7 | 8 | 9 | class TestStandardPreProcessor(BasePreprocessor): 10 | """For test and validation dataset standard image transformation.""" 11 | def __init__(self, config: Config): 12 | super(TestStandardPreProcessor, self).__init__(config) 13 | self.transform = tvs_trans.Compose([ 14 | Convert('RGB'), 15 | tvs_trans.Resize(self.pre_size, interpolation=self.interpolation), 16 | tvs_trans.CenterCrop(self.image_size), 17 | tvs_trans.ToTensor(), 18 | tvs_trans.Normalize(mean=self.mean, std=self.std), 19 | ]) 20 | -------------------------------------------------------------------------------- /openood/recorders/__init__.py: -------------------------------------------------------------------------------- 1 | from .utils import get_recorder 2 | -------------------------------------------------------------------------------- /openood/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | from .utils import get_trainer 2 | -------------------------------------------------------------------------------- /openood/trainers/lr_scheduler.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def cosine_annealing(step, total_steps, lr_max, lr_min): 5 | return lr_min + (lr_max - lr_min) * 0.5 * \ 6 | (1 + np.cos(step / total_steps * np.pi)) 7 | -------------------------------------------------------------------------------- /openood/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .config import Config, setup_config 2 | from .launch import launch 3 | from .logger import setup_logger 4 | -------------------------------------------------------------------------------- /scripts/download/download.sh: -------------------------------------------------------------------------------- 1 | # sh ./scripts/download/dowanload.sh 2 | # download the up-to-date benchmarks and checkpoints 3 | # provided by OpenOOD v1.5 4 | 5 | # --contents 'datasets' 'checkpoints' \ 6 | 7 | python ./scripts/download/download.py \ 8 | --contents 'datasets' 'checkpoints' \ 9 | --datasets 'ood_v1.5' \ 10 | --checkpoints 'ood_v1.5' \ 11 | --save_dir './data' './results' \ 12 | --dataset_mode 'benchmark' 13 | -------------------------------------------------------------------------------- /scripts/ood/ash/imagenet200_test_ood_ash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ash/imagenet200_test_ood_ash.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor ash \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor ash \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/dice/imagenet200_test_ood_dice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/dice/imagenet200_test_ood_dice.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor dice \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor dice \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/dice/mnist_test_ood_dice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/dice/mnist_test_ood_dice.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=36 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/dice.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/dice/mnist_test_osr_dice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/dice/mnist_test_osr_dice.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=36 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/dice.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/ebo/cifar100_train_ood_ebo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/cifar100_train_ood_ebo.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/cifar100/cifar100.yml \ 16 | configs/datasets/cifar100/cifar100_ood.yml \ 17 | configs/networks/resnet18_32x32.yml \ 18 | configs/pipelines/train/baseline.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/ebo.yml 21 | -------------------------------------------------------------------------------- /scripts/ood/ebo/imagenet200_test_ood_ebo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/imagenet200_test_ood_ebo.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor ebo \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor ebo \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/ebo/mnist_test_ood_ebo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/mnist_test_ood_ebo.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/ebo.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc98.50.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/ebo/mnist_test_ood_ebo_aps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/mnist_test_ood_ebo_aps.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood_aps.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/ebo.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc98.50.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/ebo/mnist_test_osr_ebo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/mnist_test_osr_ebo.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/ebo.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/gradnorm/imagenet200_test_ood_gradnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/imagenet200_test_ood_gradnorm.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor gradnorm \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor gradnorm \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/gradnorm/mnist_test_ood_gradnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/gradnorm/mnist_test_ood_gradnorm.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/gradnorm.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/gradnorm/mnist_test_osr_gradnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/gradnorm/mnist_test_osr_gradnorm.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/gradnorm.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/kl_matching/imagenet200_test_ood_kl_matching.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/imagenet200_test_ood_kl_matching.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor klm \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor klm \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/kl_matching/mnist_test_ood_kl_matching.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/kl_matching/mnist_test_ood_kl_matching.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p mediasuper -x SZ-IDC1-10-112-2-17 --gres=gpu:${GPU} \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/klm.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/kl_matching/mnist_test_osr_kl_matching.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/kl_matching/mnist_test_osr_kl_matching.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p mediasuper -x SZ-IDC1-10-112-2-17 --gres=gpu:${GPU} \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/klm.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/knn/imagenet200_test_ood_knn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/imagenet200_test_ood_knn.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor knn \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor knn \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/knn/mnist_test_ood_knn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/knn/mnist_test_ood_knn.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=36 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/knn.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/knn/mnist_test_osr_knn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/knn/mnist_test_osr_knn.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=36 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/knn.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/mds/imagenet200_test_ood_mds.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mds/imagenet200_test_ood_mds.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor mds \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor mds \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/mds_ensemble/imagenet200_test_ood_mds_ensemble.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mds_ensemble/imagenet200_test_ood_mds_ensemble.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor mds_ensemble \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor mds_ensemble \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/mds_ensemble/mnist_test_ood_mds_ensemble.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mds_ensemble/mnist_test_ood_mds_ensemble.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/mds_ensemble.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/mds_ensemble/mnist_test_osr_mds_ensemble.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mds_ensemble/mnist_test_osr_mds_ensemble.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/mds_ensemble.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/mls/imagenet200_test_ood_maxlogit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mls/imagenet200_test_ood_maxlogit.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor mls \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor mls \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/mls/mnist_test_ood_maxlogit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mls/mnist_test_ood_maxlogit.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p mediasuper -x SZ-IDC1-10-112-2-17 --gres=gpu:${GPU} \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/mls.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/mls/mnist_test_osr_maxlogit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mls/mnist_test_osr_maxlogit.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p mediasuper -x SZ-IDC1-10-112-2-17 --gres=gpu:${GPU} \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/mls.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/msp/imagenet200_test_ood_msp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/msp/imagenet200_test_ood_msp.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor msp \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor msp \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/msp/mnist_test_fsood_msp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/msp/mnist_test_fsood_msp.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_fsood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_fsood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/msp.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc98.50.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/msp/mnist_test_ood_msp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/msp/mnist_test_ood_msp.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/msp.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc98.50.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/msp/osr_cifar6_test_msp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/msp/osr_cifar6_test_msp.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | python main.py \ 14 | --config configs/datasets/osr_cifar6/cifar6_seed1.yml \ 15 | configs/datasets/osr_cifar6/cifar6_seed1.yml \ 16 | configs/preprocessors/base_preprocessor.yml \ 17 | configs/networks/resnet18_32x32.yml \ 18 | configs/pipelines/test/test_acc.yml \ 19 | --num_workers 8 \ 20 | --network.checkpoint './results/checkpoints/osr/cifar6_seed1.ckpt' 21 | -------------------------------------------------------------------------------- /scripts/ood/msp/osr_mnist6_test_msp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/msp/mnist_test_osr_msp.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | python main.py \ 14 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 15 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 16 | configs/networks/lenet.yml \ 17 | configs/pipelines/test/test_osr.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/postprocessors/msp.yml \ 20 | --num_workers 8 \ 21 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 22 | --mark 0 23 | -------------------------------------------------------------------------------- /scripts/ood/nac/cached_cifar100_test_ood_nac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ash/cifar100_test_ood_ash.sh 3 | BATCH=$1 4 | SubNum=$2 5 | LAYER=$3 6 | APS=$4 7 | 8 | 9 | if [[ "aps" = "$APS" ]]; then 10 | python scripts/eval_ood.py \ 11 | --id-data cifar100 \ 12 | --root ./results/cifar100_resnet18_32x32_base_e100_lr0.1_default \ 13 | --postprocessor nac \ 14 | --batch-size $BATCH \ 15 | --valid-num $SubNum \ 16 | --layer-names $LAYER \ 17 | --save-score --aps --use_cache \ 18 | --save-csv 19 | else 20 | python scripts/eval_ood.py \ 21 | --id-data cifar100 \ 22 | --root ./results/cifar100_resnet18_32x32_base_e100_lr0.1_default \ 23 | --postprocessor nac \ 24 | --batch-size $BATCH \ 25 | --valid-num $SubNum \ 26 | --layer-names $LAYER --use_cache\ 27 | --save-score --save-csv 28 | fi 29 | 30 | -------------------------------------------------------------------------------- /scripts/ood/nac/cached_cifar10_test_ood_nac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ash/cifar10_test_ood_ash.sh 3 | BATCH=$1 4 | SubNum=$2 5 | LAYER=$3 6 | APS=$4 7 | 8 | if [[ "aps" = "$APS" ]]; then 9 | python scripts/eval_ood.py \ 10 | --id-data cifar10 \ 11 | --root ./results/cifar10_resnet18_32x32_base_e100_lr0.1_default \ 12 | --postprocessor nac \ 13 | --batch-size $BATCH \ 14 | --valid-num $SubNum \ 15 | --layer-names $LAYER \ 16 | --save-score --aps --use_cache \ 17 | --save-csv 18 | else 19 | python scripts/eval_ood.py \ 20 | --id-data cifar10 \ 21 | --root ./results/cifar10_resnet18_32x32_base_e100_lr0.1_default \ 22 | --postprocessor nac \ 23 | --batch-size $BATCH \ 24 | --valid-num $SubNum \ 25 | --layer-names $LAYER \ 26 | --save-score --use_cache \ 27 | --save-csv 28 | fi 29 | -------------------------------------------------------------------------------- /scripts/ood/nac/cifar100_test_ood_nac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ash/cifar100_test_ood_ash.sh 3 | BATCH=$1 4 | SubNum=$2 5 | LAYER=$3 6 | APS=$4 7 | 8 | 9 | if [[ "aps" = "$APS" ]]; then 10 | python scripts/eval_ood.py \ 11 | --id-data cifar100 \ 12 | --root ./results/cifar100_resnet18_32x32_base_e100_lr0.1_default \ 13 | --postprocessor nac \ 14 | --batch-size $BATCH \ 15 | --valid-num $SubNum \ 16 | --layer-names $LAYER \ 17 | --save-score --aps \ 18 | --save-csv 19 | else 20 | python scripts/eval_ood.py \ 21 | --id-data cifar100 \ 22 | --root ./results/cifar100_resnet18_32x32_base_e100_lr0.1_default \ 23 | --postprocessor nac \ 24 | --batch-size $BATCH \ 25 | --valid-num $SubNum \ 26 | --layer-names $LAYER \ 27 | --save-score --save-csv 28 | fi 29 | 30 | -------------------------------------------------------------------------------- /scripts/ood/nac/cifar10_test_ood_nac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ash/cifar10_test_ood_ash.sh 3 | BATCH=$1 4 | SubNum=$2 5 | LAYER=$3 6 | APS=$4 7 | 8 | if [[ "aps" = "$APS" ]]; then 9 | python scripts/eval_ood.py \ 10 | --id-data cifar10 \ 11 | --root ./results/cifar10_resnet18_32x32_base_e100_lr0.1_default \ 12 | --postprocessor nac \ 13 | --batch-size $BATCH \ 14 | --valid-num $SubNum \ 15 | --layer-names $LAYER \ 16 | --save-score --aps --save-csv 17 | else 18 | python scripts/eval_ood.py \ 19 | --id-data cifar10 \ 20 | --root ./results/cifar10_resnet18_32x32_base_e100_lr0.1_default \ 21 | --postprocessor nac \ 22 | --batch-size $BATCH \ 23 | --valid-num $SubNum \ 24 | --layer-names $LAYER \ 25 | --save-score --save-csv 26 | fi 27 | -------------------------------------------------------------------------------- /scripts/ood/nac/imagenet_test_ood_nac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ash/imagenet_test_ood_ash.sh 3 | MODEL=$1 4 | BATCH=$2 5 | SubNum=$3 6 | LAYER=$4 7 | APS=$5 8 | AUG=$6 9 | 10 | # available architectures: 11 | # resnet50, swin-t, vit-b-16 12 | # ood 13 | 14 | if [[ "aps" = "$APS" ]]; then 15 | python scripts/eval_ood_imagenet.py \ 16 | --tvs-pretrained \ 17 | --arch $MODEL \ 18 | --postprocessor nac \ 19 | --aug $AUG \ 20 | --batch-size $BATCH \ 21 | --valid-num $SubNum \ 22 | --layer-names $LAYER \ 23 | --save-score --save-csv --aps #--fsood 24 | else 25 | python scripts/eval_ood_imagenet.py \ 26 | --tvs-pretrained \ 27 | --arch $MODEL \ 28 | --aug $AUG \ 29 | --postprocessor nac \ 30 | --batch-size $BATCH \ 31 | --valid-num $SubNum \ 32 | --layer-names $LAYER \ 33 | --save-score --save-csv #--fsood 34 | 35 | fi 36 | 37 | -------------------------------------------------------------------------------- /scripts/ood/odin/imagenet200_test_ood_odin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/odin/imagenet200_test_ood_odin.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor odin \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor odin \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/odin/mnist_test_ood_odin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/odin/mnist_test_ood_odin.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/odin.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/odin/mnist_test_ood_odin_aps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/odin/mnist_test_ood_odin_aps.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/mnist/mnist.yml \ 16 | configs/datasets/mnist/mnist_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/odin.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc98.50.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/odin/mnist_test_osr_odin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/odin/mnist_test_osr_odin.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/odin.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/others/cider/cifar100_test_cider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/cider/cifar100_test_cider.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar100 \ 12 | --root ./results/cifar100_cider_net_cider_e100_lr0.5_protom0.5_default \ 13 | --postprocessor cider \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/cider/cifar100_train_cider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/cider/cifar100_train_cider.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/cifar100/cifar100.yml \ 6 | configs/networks/cider_net.yml \ 7 | configs/pipelines/train/train_cider.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --preprocessor.name cider \ 10 | --network.backbone.name resnet18_32x32 \ 11 | --dataset.train.batch_size 512 \ 12 | --trainer.trainer_args.proto_m 0.5 \ 13 | --num_workers 8 \ 14 | --optimizer.num_epochs 100 \ 15 | --seed 0 16 | -------------------------------------------------------------------------------- /scripts/ood/others/cider/cifar10_test_cider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/cider/cifar10_test_cider.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar10 \ 12 | --root ./results/cifar10_cider_net_cider_e100_lr0.5_protom0.95_default \ 13 | --postprocessor cider \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/cider/cifar10_train_cider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/cider/cifar10_train_cider.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/cifar10/cifar10.yml \ 6 | configs/networks/cider_net.yml \ 7 | configs/pipelines/train/train_cider.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --preprocessor.name cider \ 10 | --network.backbone.name resnet18_32x32 \ 11 | --dataset.train.batch_size 512 \ 12 | --trainer.trainer_args.proto_m 0.95 \ 13 | --num_workers 8 \ 14 | --optimizer.num_epochs 100 \ 15 | --seed 0 16 | -------------------------------------------------------------------------------- /scripts/ood/others/cider/imagenet200_test_cider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/cider/imagenet200_test_cider.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_cider_net_cider_e10_lr0.01_protom0.95_default \ 15 | --postprocessor cider \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_cider_net_cider_e10_lr0.01_protom0.95_default \ 22 | --postprocessor cider \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/cider/imagenet200_train_cider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/cider/imagenet200_train_cider.sh 3 | 4 | SEED=0 5 | python main.py \ 6 | --config configs/datasets/imagenet200/imagenet200.yml \ 7 | configs/networks/cider_net.yml \ 8 | configs/pipelines/train/train_cider.yml \ 9 | configs/preprocessors/base_preprocessor.yml \ 10 | --preprocessor.name cider \ 11 | --network.backbone.name resnet18_224x224 \ 12 | --network.backbone.pretrained True \ 13 | --network.backbone.checkpoint ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default/s${SEED}/best.ckpt \ 14 | --optimizer.lr 0.01 \ 15 | --optimizer.num_epochs 10 \ 16 | --dataset.train.batch_size 512 \ 17 | --trainer.trainer_args.proto_m 0.95 \ 18 | --num_gpus 1 --num_workers 16 \ 19 | --merge_option merge \ 20 | --seed ${SEED} 21 | -------------------------------------------------------------------------------- /scripts/ood/others/cider/imagenet_test_cider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/cider/imagenet_test_cider.sh 3 | 4 | ############################################ 5 | # we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood_imagenet.py 8 | 9 | # available architectures: 10 | # resnet50 11 | # ood 12 | python scripts/eval_ood_imagenet.py \ 13 | --ckpt-path ./results/imagenet_cider_net_cider_e10_lr0.001_protom0.95_default/s0/best.ckpt \ 14 | --arch resnet50 \ 15 | --postprocessor cider \ 16 | --save-score --save-csv #--fsood 17 | 18 | 19 | # full-spectrum ood 20 | python scripts/eval_ood_imagenet.py \ 21 | --ckpt-path ./results/imagenet_cider_net_cider_e10_lr0.001_protom0.95_default/s0/best.ckpt \ 22 | --arch resnet50 \ 23 | --postprocessor cider \ 24 | --save-score --save-csv --fsood 25 | -------------------------------------------------------------------------------- /scripts/ood/others/cider/imagenet_train_cider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/cider/imagenet_train_cider.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet/imagenet.yml \ 6 | configs/networks/cider_net.yml \ 7 | configs/pipelines/train/train_cider.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --preprocessor.name cider \ 10 | --network.backbone.name resnet50 \ 11 | --network.backbone.pretrained True \ 12 | --network.backbone.checkpoint ./results/pretrained_weights/resnet50_imagenet1k_v1.pth \ 13 | --optimizer.lr 0.001 \ 14 | --optimizer.num_epochs 10 \ 15 | --dataset.train.batch_size 512 \ 16 | --trainer.trainer_args.proto_m 0.95 \ 17 | --num_gpus 1 --num_workers 16 \ 18 | --merge_option merge \ 19 | --seed 0 20 | -------------------------------------------------------------------------------- /scripts/ood/others/conf_branch/cifar100_train_conf_branch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/conf_branch/cifar100_train_conf_branch.sh 3 | 4 | PYTHONPATH='.':$PYTHONPATH \ 5 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 6 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 7 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 8 | 9 | python main.py \ 10 | --config configs/datasets/cifar100/cifar100.yml \ 11 | configs/networks/conf_branch.yml \ 12 | configs/pipelines/train/train_conf_branch.yml \ 13 | configs/preprocessors/base_preprocessor.yml \ 14 | --network.backbone.name resnet18_32x32 \ 15 | --seed 0 16 | -------------------------------------------------------------------------------- /scripts/ood/others/conf_branch/cifar10_train_conf_branch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/conf_branch/cifar10_train_conf_branch.sh 3 | 4 | PYTHONPATH='.':$PYTHONPATH \ 5 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 6 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 7 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 8 | 9 | python main.py \ 10 | --config configs/datasets/cifar10/cifar10.yml \ 11 | configs/networks/conf_branch.yml \ 12 | configs/pipelines/train/train_conf_branch.yml \ 13 | configs/preprocessors/base_preprocessor.yml \ 14 | --network.backbone.name resnet18_32x32 \ 15 | --seed ${SEED} 16 | -------------------------------------------------------------------------------- /scripts/ood/others/conf_branch/imagenet200_test_conf_branch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/conf_branch/imagenet200_test_conf_branch.sh 3 | 4 | ############################################ 5 | # we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_conf_branch_net_conf_branch_e90_lr0.1_default \ 15 | --postprocessor conf_branch \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_conf_branch_net_conf_branch_e90_lr0.1_default \ 22 | --postprocessor conf_branch \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/conf_branch/imagenet200_train_conf_branch.sh: -------------------------------------------------------------------------------- 1 | python main.py \ 2 | --config configs/datasets/imagenet200/imagenet200.yml \ 3 | configs/networks/conf_branch.yml \ 4 | configs/pipelines/train/train_conf_branch.yml \ 5 | configs/preprocessors/base_preprocessor.yml \ 6 | --network.backbone.name resnet18_224x224 \ 7 | --optimizer.num_epochs 90 \ 8 | --dataset.train.batch_size 128 \ 9 | --num_gpus 2 --num_workers 16 \ 10 | --merge_option merge \ 11 | --seed 0 12 | -------------------------------------------------------------------------------- /scripts/ood/others/conf_branch/imagenet_test_conf_branch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/conf_branch/imagenet_test_conf_branch.sh 3 | 4 | ############################################ 5 | # we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood_imagenet.py 8 | 9 | # ood 10 | python scripts/eval_ood_imagenet.py \ 11 | --ckpt-path ./results/imagenet_conf_branch_net_conf_branch_e30_lr0.001_default/s0/best.ckpt \ 12 | --arch resnet50 \ 13 | --postprocessor conf_branch \ 14 | --save-score --save-csv #--fsood 15 | 16 | # full-spectrum ood 17 | python scripts/eval_ood_imagenet.py \ 18 | --ckpt-path ./results/imagenet_conf_branch_net_conf_branch_e30_lr0.001_default/s0/best.ckpt \ 19 | --arch resnet50 \ 20 | --postprocessor conf_branch \ 21 | --save-score --save-csv --fsood 22 | -------------------------------------------------------------------------------- /scripts/ood/others/conf_branch/imagenet_train_conf_branch.sh: -------------------------------------------------------------------------------- 1 | python main.py \ 2 | --config configs/datasets/imagenet/imagenet.yml \ 3 | configs/networks/conf_branch.yml \ 4 | configs/pipelines/train/train_conf_branch.yml \ 5 | configs/preprocessors/base_preprocessor.yml \ 6 | --network.backbone.name resnet50 \ 7 | --network.backbone.pretrained True \ 8 | --network.backbone.checkpoint ./results/pretrained_weights/resnet50_imagenet1k_v1.pth \ 9 | --optimizer.lr 0.001 \ 10 | --optimizer.num_epochs 30 \ 11 | --dataset.train.batch_size 128 \ 12 | --num_gpus 2 --num_workers 16 \ 13 | --merge_option merge \ 14 | --seed 0 15 | -------------------------------------------------------------------------------- /scripts/ood/others/conf_branch/train_conf_branch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/train_conf_branch.sh 3 | 4 | PYTHONPATH='.':$PYTHONPATH \ 5 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 6 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 7 | --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 8 | python main.py \ 9 | --config configs/datasets/digits/mnist.yml \ 10 | configs/pipelines/train/train_conf_esti.yml \ 11 | configs/networks/conf_net.yml 12 | -------------------------------------------------------------------------------- /scripts/ood/others/csi/cifar100_train_csi_step1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/csi/cifar100_train_csi_step1.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | # -w SG-IDC1-10-51-2-${node} \ 14 | 15 | python main.py \ 16 | --config configs/datasets/cifar100/cifar100.yml \ 17 | configs/networks/csi_net.yml \ 18 | configs/pipelines/train/train_csi.yml \ 19 | configs/preprocessors/csi_preprocessor.yml \ 20 | --network.pretrained False \ 21 | --optimizer.num_epochs 100 \ 22 | --dataset.train.batch_size 64 \ 23 | --merge_option merge \ 24 | --mode csi_step1 \ 25 | --seed 0 26 | -------------------------------------------------------------------------------- /scripts/ood/others/csi/cifar100_train_csi_step2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/csi/cifar100_train_csi_step2.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | # -w SG-IDC1-10-51-2-${node} \ 14 | 15 | SEED=0 16 | python main.py \ 17 | --config configs/datasets/cifar100/cifar100.yml \ 18 | configs/networks/csi_net.yml \ 19 | configs/pipelines/train/train_csi.yml \ 20 | configs/preprocessors/base_preprocessor.yml \ 21 | --network.pretrained True \ 22 | --network.checkpoint ./results/cifar100_csi_net_csi_step1_e100_lr0.1/s${SEED}/best.ckpt \ 23 | --optimizer.num_epochs 100 \ 24 | --dataset.train.batch_size 128 \ 25 | --mode csi_step2 \ 26 | --seed ${SEED} 27 | -------------------------------------------------------------------------------- /scripts/ood/others/csi/cifar10_train_csi_step1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/csi/cifar10_train_csi_step1.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | # -w SG-IDC1-10-51-2-${node} \ 14 | 15 | python main.py \ 16 | --config configs/datasets/cifar10/cifar10.yml \ 17 | configs/networks/csi_net.yml \ 18 | configs/pipelines/train/train_csi.yml \ 19 | configs/preprocessors/csi_preprocessor.yml \ 20 | --network.pretrained False \ 21 | --optimizer.num_epochs 100 \ 22 | --dataset.train.batch_size 64 \ 23 | --merge_option merge \ 24 | --mode csi_step1 \ 25 | --seed 0 26 | -------------------------------------------------------------------------------- /scripts/ood/others/csi/cifar10_train_csi_step2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/csi/cifar10_train_csi_step2.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | # -w SG-IDC1-10-51-2-${node} \ 14 | 15 | SEED=0 16 | python main.py \ 17 | --config configs/datasets/cifar10/cifar10.yml \ 18 | configs/networks/csi_net.yml \ 19 | configs/pipelines/train/train_csi.yml \ 20 | configs/preprocessors/base_preprocessor.yml \ 21 | --network.pretrained True \ 22 | --network.checkpoint ./results/cifar10_csi_net_csi_step1_e100_lr0.1/s${SEED}/best.ckpt \ 23 | --optimizer.num_epochs 100 \ 24 | --dataset.train.batch_size 128 \ 25 | --mode csi_step2 \ 26 | --seed ${SEED} 27 | -------------------------------------------------------------------------------- /scripts/ood/others/godin/cifar100_train_godin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/godin/cifar100_train_godin.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | # -w SG-IDC1-10-51-2-${node} \ 14 | python main.py \ 15 | --config configs/datasets/cifar100/cifar100.yml \ 16 | configs/networks/godin_net.yml \ 17 | configs/pipelines/train/baseline.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/postprocessors/godin.yml \ 20 | --network.backbone.name resnet18_32x32 \ 21 | --num_workers 8 \ 22 | --trainer.name godin \ 23 | --optimizer.num_epochs 100 \ 24 | --merge_option merge \ 25 | --seed 0 26 | -------------------------------------------------------------------------------- /scripts/ood/others/godin/cifar10_train_godin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/godin/cifar10_train_godin.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | # -w SG-IDC1-10-51-2-${node} \ 14 | python main.py \ 15 | --config configs/datasets/cifar10/cifar10.yml \ 16 | configs/networks/godin_net.yml \ 17 | configs/pipelines/train/baseline.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/postprocessors/godin.yml \ 20 | --network.backbone.name resnet18_32x32 \ 21 | --num_workers 8 \ 22 | --trainer.name godin \ 23 | --optimizer.num_epochs 100 \ 24 | --merge_option merge \ 25 | --seed 0 26 | -------------------------------------------------------------------------------- /scripts/ood/others/godin/imagenet200_test_ood_godin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/godin/imagenet200_test_ood_godin.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_godin_net_godin_e90_lr0.1_default \ 15 | --postprocessor godin \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_godin_net_godin_e90_lr0.1_default \ 22 | --postprocessor godin \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/godin/imagenet200_train_godin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/godin/imagenet200_train_godin.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet200/imagenet200.yml \ 6 | configs/networks/godin_net.yml \ 7 | configs/pipelines/train/baseline.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | configs/postprocessors/godin.yml \ 10 | --network.backbone.name resnet18_224x224 \ 11 | --trainer.name godin \ 12 | --optimizer.num_epochs 90 \ 13 | --dataset.train.batch_size 128 \ 14 | --num_gpus 2 --num_workers 16 \ 15 | --merge_option merge \ 16 | --seed 0 17 | -------------------------------------------------------------------------------- /scripts/ood/others/godin/imagenet_test_ood_godin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/godin/imagenet_test_ood_godin.sh 3 | 4 | ############################################ 5 | # we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood_imagenet.py 8 | 9 | # available architectures: 10 | # resnet50 11 | # ood 12 | python scripts/eval_ood_imagenet.py \ 13 | --ckpt-path ./results/imagenet_godin_net_godin_e30_lr0.001_default/s0/best.ckpt \ 14 | --arch resnet50 \ 15 | --postprocessor godin \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood_imagenet.py \ 20 | --ckpt-path ./results/imagenet_godin_net_godin_e30_lr0.001_default/s0/best.ckpt \ 21 | --arch resnet50 \ 22 | --postprocessor godin \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/godin/imagenet_train_godin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/godin/imagenet_train_godin.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet/imagenet.yml \ 6 | configs/networks/godin_net.yml \ 7 | configs/pipelines/train/baseline.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | configs/postprocessors/godin.yml \ 10 | --network.backbone.name resnet50 \ 11 | --network.backbone.pretrained True \ 12 | --network.backbone.checkpoint ./results/pretrained_weights/resnet50_imagenet1k_v1.pth \ 13 | --trainer.name godin \ 14 | --optimizer.lr 0.001 \ 15 | --optimizer.num_epochs 30 \ 16 | --dataset.train.batch_size 128 \ 17 | --num_gpus 2 --num_workers 16 \ 18 | --merge_option merge \ 19 | --seed 0 20 | -------------------------------------------------------------------------------- /scripts/ood/others/gram/imagenet200_test_ood_gram.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ebo/imagenet200_test_ood_gram.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor gram \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor gram \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/gram/mnist_test_osr_gram.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/gram/mnist_test_osr_gram.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/gram.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/others/logitnorm/cifar100_test_logitnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/logitnorm/cifar100_test_logitnorm.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar100 \ 12 | --root ./results/cifar100_resnet18_32x32_logitnorm_e100_lr0.1_alpha0.04_default \ 13 | --postprocessor msp \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/logitnorm/cifar100_train_logitnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/logitnorm/cifar100_train_logitnorm.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/cifar100/cifar100.yml \ 6 | configs/networks/resnet18_32x32.yml \ 7 | configs/pipelines/train/train_logitnorm.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --seed 0 10 | -------------------------------------------------------------------------------- /scripts/ood/others/logitnorm/cifar10_test_logitnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/logitnorm/cifar10_test_logitnorm.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar10 \ 12 | --root ./results/cifar10_resnet18_32x32_logitnorm_e100_lr0.1_alpha0.04_default \ 13 | --postprocessor msp \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/logitnorm/cifar10_train_logitnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/logitnorm/cifar10_train_logitnorm.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/cifar10/cifar10.yml \ 6 | configs/networks/resnet18_32x32.yml \ 7 | configs/pipelines/train/train_logitnorm.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --seed 0 10 | -------------------------------------------------------------------------------- /scripts/ood/others/logitnorm/imagenet200_test_logitnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/logitnorm/imagenet200_test_logitnorm.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_logitnorm_e90_lr0.1_alpha0.04_default \ 15 | --postprocessor msp \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_logitnorm_e90_lr0.1_alpha0.04_default \ 22 | --postprocessor msp \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/logitnorm/imagenet200_train_logitnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/logitnorm/imagenet200_train_logitnorm.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet200/imagenet200.yml \ 6 | configs/networks/resnet18_224x224.yml \ 7 | configs/pipelines/train/train_logitnorm.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --optimizer.num_epochs 90 \ 10 | --dataset.train.batch_size 128 \ 11 | --num_gpus 2 --num_workers 16 \ 12 | --merge_option merge \ 13 | --seed 0 14 | -------------------------------------------------------------------------------- /scripts/ood/others/logitnorm/imagenet_test_logitnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/logitnorm/imagenet_test_logitnorm.sh 3 | 4 | ############################################ 5 | # we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood_imagenet.py 8 | 9 | # available architectures: 10 | # resnet50 11 | # ood 12 | python scripts/eval_ood_imagenet.py \ 13 | --ckpt-path ./results/imagenet_resnet50_logitnorm_e30_lr0.001_alpha0.04_default/s0/best.ckpt \ 14 | --arch resnet50 \ 15 | --postprocessor msp \ 16 | --save-score --save-csv #--fsood 17 | 18 | 19 | # full-spectrum ood 20 | python scripts/eval_ood_imagenet.py \ 21 | --ckpt-path ./results/imagenet_resnet50_logitnorm_e30_lr0.001_alpha0.04_default/s0/best.ckpt \ 22 | --arch resnet50 \ 23 | --postprocessor msp \ 24 | --save-score --save-csv --fsood 25 | -------------------------------------------------------------------------------- /scripts/ood/others/logitnorm/imagenet_train_logitnorm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/logitnorm/imagenet_train_logitnorm.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet/imagenet.yml \ 6 | configs/networks/resnet50.yml \ 7 | configs/pipelines/train/train_logitnorm.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --network.pretrained True \ 10 | --network.checkpoint ./results/pretrained_weights/resnet50_imagenet1k_v1.pth \ 11 | --optimizer.lr 0.001 \ 12 | --optimizer.num_epochs 30 \ 13 | --dataset.train.batch_size 128 \ 14 | --num_gpus 2 --num_workers 16 \ 15 | --merge_option merge \ 16 | --seed 0 17 | -------------------------------------------------------------------------------- /scripts/ood/others/mcd/cifar100_train_mcd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mcd/cifar100_train_mcd.sh 3 | 4 | GPU=1 5 | CPU=1 6 | jobname=openood 7 | 8 | PYTHONPATH='.':$PYTHONPATH \ 9 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 10 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 11 | --kill-on-bad-exit=1 --job-name=${jobname} \ 12 | python main.py \ 13 | --config configs/datasets/cifar100/cifar100.yml \ 14 | configs/datasets/cifar100/cifar100_oe.yml \ 15 | configs/networks/mcd_net.yml \ 16 | configs/preprocessors/base_preprocessor.yml \ 17 | configs/pipelines/train/baseline.yml \ 18 | configs/pipelines/train/train_mcd.yml \ 19 | --network.backbone.name resnet18_32x32 \ 20 | --network.pretrained False \ 21 | --dataset.image_size 32 \ 22 | --optimizer.num_epochs 100 \ 23 | --num_workers 8 \ 24 | --seed 0 25 | -------------------------------------------------------------------------------- /scripts/ood/others/mcd/cifar10_train_mcd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mcd/cifar10_train_mcd.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | -w SG-IDC1-10-51-2-${node} \ 14 | python main.py \ 15 | --config configs/datasets/cifar10/cifar10.yml \ 16 | configs/datasets/cifar10/cifar10_oe.yml \ 17 | configs/networks/mcd_net.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/pipelines/train/baseline.yml \ 20 | configs/pipelines/train/train_mcd.yml \ 21 | --network.backbone.name resnet18_32x32 \ 22 | --network.pretrained False \ 23 | --dataset.image_size 32 \ 24 | --optimizer.num_epochs 100 \ 25 | --num_workers 8 \ 26 | --seed ${SEED} 27 | -------------------------------------------------------------------------------- /scripts/ood/others/mcd/imagenet200_train_mcd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mcd/imagenet200_train_mcd.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet200/imagenet200.yml \ 6 | configs/datasets/imagenet200/imagenet200_oe.yml \ 7 | configs/networks/mcd_net.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | configs/pipelines/train/baseline.yml \ 10 | configs/pipelines/train/train_mcd.yml \ 11 | --network.backbone.name resnet18_224x224 \ 12 | --network.pretrained False \ 13 | --trainer.start_epoch_ft 80 \ 14 | --optimizer.num_epochs 90 \ 15 | --dataset.train.batch_size 128 \ 16 | --num_gpus 2 --num_workers 16 \ 17 | --merge_option merge \ 18 | --seed 0 19 | -------------------------------------------------------------------------------- /scripts/ood/others/mixoe/cifar100_test_mixoe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mixoe/cifar100_test_mixoe.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar100 \ 12 | --root ./results/cifar100_oe_resnet18_32x32_mixoe_e10_lr0.001_alpha0.1_beta1.0_cutmix_lam1.0_default \ 13 | --postprocessor msp \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/mixoe/cifar100_train_mixoe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mixoe/cifar100_train_mixoe.sh 3 | 4 | SEED=0 5 | python main.py \ 6 | --config configs/datasets/cifar100/cifar100.yml \ 7 | configs/datasets/cifar100/cifar100_oe.yml \ 8 | configs/networks/resnet18_32x32.yml \ 9 | configs/pipelines/train/baseline.yml \ 10 | configs/pipelines/train/train_mixoe.yml \ 11 | configs/preprocessors/base_preprocessor.yml \ 12 | --network.pretrained True \ 13 | --network.checkpoint ./results/cifar100_resnet18_32x32_base_e100_lr0.1_default/s${SEED}/best.ckpt \ 14 | --optimizer.lr 0.001 \ 15 | --optimizer.num_epochs 10 \ 16 | --dataset.train.batch_size 128 \ 17 | --dataset.oe.batch_size 128 \ 18 | --seed ${SEED} 19 | -------------------------------------------------------------------------------- /scripts/ood/others/mixoe/cifar10_test_mixoe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mixoe/cifar10_test_mixoe.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar10 \ 12 | --root ./results/cifar10_oe_resnet18_32x32_mixoe_e10_lr0.001_alpha0.1_beta1.0_cutmix_lam1.0_default \ 13 | --postprocessor msp \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/mixoe/cifar10_train_mixoe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mixoe/cifar10_train_mixoe.sh 3 | 4 | SEED=0 5 | python main.py \ 6 | --config configs/datasets/cifar10/cifar10.yml \ 7 | configs/datasets/cifar10/cifar10_oe.yml \ 8 | configs/networks/resnet18_32x32.yml \ 9 | configs/pipelines/train/baseline.yml \ 10 | configs/pipelines/train/train_mixoe.yml \ 11 | configs/preprocessors/base_preprocessor.yml \ 12 | --network.pretrained True \ 13 | --network.checkpoint ./results/cifar10_resnet18_32x32_base_e100_lr0.1_default/s${SEED}/best.ckpt \ 14 | --optimizer.lr 0.001 \ 15 | --optimizer.num_epochs 10 \ 16 | --dataset.train.batch_size 128 \ 17 | --dataset.oe.batch_size 128 \ 18 | --seed ${SEED} 19 | -------------------------------------------------------------------------------- /scripts/ood/others/mixoe/imagenet200_test_mixoe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mixoe/imagenet200_test_mixoe.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_oe_resnet18_224x224_mixoe_e10_lr0.001_alpha0.1_beta1.0_cutmix_lam1.0_default \ 15 | --postprocessor msp \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_oe_resnet18_224x224_mixoe_e10_lr0.001_alpha0.1_beta1.0_cutmix_lam1.0_default \ 22 | --postprocessor msp \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/mixoe/imagnet200_train_mixoe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mixoe/imagenet200_train_mixoe.sh 3 | 4 | SEED=0 5 | python main.py \ 6 | --config configs/datasets/imagenet200/imagenet200.yml \ 7 | configs/datasets/imagenet200/imagenet200_oe.yml \ 8 | configs/networks/resnet18_224x224.yml \ 9 | configs/pipelines/train/baseline.yml \ 10 | configs/pipelines/train/train_mixoe.yml \ 11 | configs/preprocessors/base_preprocessor.yml \ 12 | --network.pretrained True \ 13 | --network.checkpoint ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default/s${SEED}/best.ckpt \ 14 | --optimizer.lr 0.001 \ 15 | --optimizer.num_epochs 10 \ 16 | --dataset.train.batch_size 128 \ 17 | --num_gpus 2 --num_workers 16 \ 18 | --merge_option merge \ 19 | --seed ${SEED} 20 | -------------------------------------------------------------------------------- /scripts/ood/others/mos/cifar100_test_mos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mos/cifar100_test_mos.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | 11 | SEED=0 12 | python main.py \ 13 | --config configs/datasets/cifar100/cifar100_double_label.yml \ 14 | configs/datasets/cifar100/cifar100_ood.yml \ 15 | configs/networks/resnet18_32x32.yml \ 16 | configs/pipelines/test/test_mos.yml \ 17 | configs/postprocessors/mos.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | --network.pretrained True \ 20 | --network.checkpoint results/cifar100_double_label_resnet18_32x32_mos_e30_lr0.003/s${SEED}/best.ckpt \ 21 | --num_workers 8 \ 22 | --seed ${SEED} 23 | -------------------------------------------------------------------------------- /scripts/ood/others/mos/cifar100_train_mos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mos/cifar100_train_mos.sh 3 | 4 | # GPU=1 5 | # CPU=0 6 | 7 | 8 | # node=73 9 | # jobname=openood 10 | 11 | # PYTHONPATH='.':$PYTHONPATH \ 12 | 13 | SEED=0 14 | python main.py \ 15 | --config configs/datasets/cifar100/cifar100_double_label.yml \ 16 | configs/networks/resnet18_32x32.yml \ 17 | configs/pipelines/train/train_mos.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | --network.pretrained True \ 20 | --network.checkpoint ./results/cifar100_resnet18_32x32_base_e100_lr0.1_default/s${SEED}/best.ckpt \ 21 | --optimizer.num_epochs 30 \ 22 | --merge_option merge \ 23 | --seed ${SEED} 24 | -------------------------------------------------------------------------------- /scripts/ood/others/mos/cifar10_test_mos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mos/cifar10_test_mos.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | 11 | SEED=0 12 | python main.py \ 13 | --config configs/datasets/cifar10/cifar10_double_label.yml \ 14 | configs/datasets/cifar10/cifar10_ood.yml \ 15 | configs/networks/resnet18_32x32.yml \ 16 | configs/pipelines/test/test_mos.yml \ 17 | configs/postprocessors/mos.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | --network.pretrained True \ 20 | --network.checkpoint results/cifar10_double_label_resnet18_32x32_mos_e30_lr0.003/s${SEED}/best.ckpt \ 21 | --num_workers 8 \ 22 | --seed ${SEED} 23 | -------------------------------------------------------------------------------- /scripts/ood/others/mos/cifar10_train_mos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mos/cifar10_train_mos.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | 11 | SEED=0 12 | python main.py \ 13 | --config configs/datasets/cifar10/cifar10_double_label.yml \ 14 | configs/networks/resnet18_32x32.yml \ 15 | configs/pipelines/train/train_mos.yml \ 16 | configs/preprocessors/base_preprocessor.yml \ 17 | --network.pretrained True \ 18 | --network.checkpoint ./results/cifar10_resnet18_32x32_base_e100_lr0.1_default/s${SEED}/best.ckpt \ 19 | --optimizer.num_epochs 30 \ 20 | --merge_option merge \ 21 | --seed ${SEED} 22 | -------------------------------------------------------------------------------- /scripts/ood/others/mos/imagenet200_train_mos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mos/imagenet200_train_mos.sh 3 | 4 | SEED=0 5 | python main.py \ 6 | --config configs/datasets/imagenet200/imagenet200_double_label.yml \ 7 | configs/networks/resnet18_224x224.yml \ 8 | configs/pipelines/train/train_mos.yml \ 9 | configs/preprocessors/base_preprocessor.yml \ 10 | --network.pretrained True \ 11 | --network.checkpoint ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default/s${SEED}/best.ckpt \ 12 | --optimizer.num_epochs 10 \ 13 | --dataset.train.batch_size 128 \ 14 | --num_gpus 2 --num_workers 16 \ 15 | --merge_option merge \ 16 | --seed ${SEED} 17 | -------------------------------------------------------------------------------- /scripts/ood/others/mos/imagenet_train_mos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/mos/imagenet_train_mos.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet/imagenet_double_label.yml \ 6 | configs/networks/resnet50.yml \ 7 | configs/pipelines/train/train_mos.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --network.pretrained True \ 10 | --network.checkpoint ./results/pretrained_weights/resnet50_imagenet1k_v1.pth \ 11 | --optimizer.num_epochs 5 \ 12 | --dataset.train.batch_size 128 \ 13 | --num_gpus 2 --num_workers 16 \ 14 | --merge_option merge \ 15 | --seed 0 16 | -------------------------------------------------------------------------------- /scripts/ood/others/npos/cifar100_test_npos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/npos/cifar100_test_npos.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar100 \ 12 | --root ./results/cifar100_npos_net_npos_e100_lr0.1_default \ 13 | --postprocessor npos \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/npos/cifar100_train_npos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/npos/cifar100_train_npos.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/cifar100/cifar100.yml \ 6 | configs/networks/npos_net.yml \ 7 | configs/pipelines/train/train_npos.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --preprocessor.name cider \ 10 | --network.backbone.name resnet18_32x32 \ 11 | --dataset.train.batch_size 256 \ 12 | --trainer.trainer_args.temp 0.1 \ 13 | --trainer.trainer_args.sample_from 600 \ 14 | --trainer.trainer_args.K 300 \ 15 | --trainer.trainer_args.cov_mat 0.1 \ 16 | --trainer.trainer_args.start_epoch_KNN 40 \ 17 | --trainer.trainer_args.ID_points_num 200 \ 18 | --optimizer.num_epochs 100 \ 19 | --optimizer.lr 0.1 \ 20 | --seed 0 21 | -------------------------------------------------------------------------------- /scripts/ood/others/npos/cifar10_test_npos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/npos/cifar10_test_npos.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar10 \ 12 | --root ./results/cifar10_npos_net_npos_e100_lr0.1_default \ 13 | --postprocessor npos \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/npos/cifar10_train_npos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/npos/cifar10_train_npos.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/cifar10/cifar10.yml \ 6 | configs/networks/npos_net.yml \ 7 | configs/pipelines/train/train_npos.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --preprocessor.name cider \ 10 | --network.backbone.name resnet18_32x32 \ 11 | --dataset.train.batch_size 256 \ 12 | --trainer.trainer_args.temp 0.1 \ 13 | --trainer.trainer_args.sample_from 600 \ 14 | --trainer.trainer_args.K 300 \ 15 | --trainer.trainer_args.cov_mat 0.1 \ 16 | --trainer.trainer_args.start_epoch_KNN 40 \ 17 | --trainer.trainer_args.ID_points_num 200 \ 18 | --optimizer.num_epochs 100 \ 19 | --optimizer.lr 0.1 \ 20 | --seed 0 21 | -------------------------------------------------------------------------------- /scripts/ood/others/npos/imagenet200_test_npos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/npos/imagenet200_test_npos.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_npos_net_npos_e90_lr0.1_default \ 15 | --postprocessor npos \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_npos_net_npos_e90_lr0.1_default \ 22 | --postprocessor npos \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/oe/cifar100_train_oe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/oe/cifar100_train_oe.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | -w SG-IDC1-10-51-2-${node} \ 14 | python main.py \ 15 | --config configs/datasets/cifar100/cifar100.yml \ 16 | configs/datasets/cifar100/cifar100_oe.yml \ 17 | configs/networks/resnet18_32x32.yml \ 18 | configs/pipelines/train/baseline.yml \ 19 | configs/pipelines/train/train_oe.yml \ 20 | configs/preprocessors/base_preprocessor.yml \ 21 | --seed 0 22 | -------------------------------------------------------------------------------- /scripts/ood/others/oe/cifar10_train_oe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/oe/cifar10_train_oe.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | -w SG-IDC1-10-51-2-${node} \ 14 | python main.py \ 15 | --config configs/datasets/cifar10/cifar10.yml \ 16 | configs/datasets/cifar10/cifar10_oe.yml \ 17 | configs/networks/resnet18_32x32.yml \ 18 | configs/pipelines/train/baseline.yml \ 19 | configs/pipelines/train/train_oe.yml \ 20 | configs/preprocessors/base_preprocessor.yml \ 21 | --seed 0 22 | -------------------------------------------------------------------------------- /scripts/ood/others/oe/imagenet200_test_oe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/oe/imagenet200_test_oe.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_oe_resnet18_224x224_oe_e90_lr0.1_lam0.5_default \ 15 | --postprocessor msp \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_oe_resnet18_224x224_oe_e90_lr0.1_lam0.5_default \ 22 | --postprocessor msp \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/oe/imagnet200_train_oe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/oe/imagenet200_train_oe.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet200/imagenet200.yml \ 6 | configs/datasets/imagenet200/imagenet200_oe.yml \ 7 | configs/networks/resnet18_224x224.yml \ 8 | configs/pipelines/train/baseline.yml \ 9 | configs/pipelines/train/train_oe.yml \ 10 | configs/preprocessors/base_preprocessor.yml \ 11 | --optimizer.num_epochs 90 \ 12 | --dataset.train.batch_size 128 \ 13 | --num_gpus 2 --num_workers 16 \ 14 | --merge_option merge \ 15 | --seed 0 16 | -------------------------------------------------------------------------------- /scripts/ood/others/residual/cifar100_test_ood_residual.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/residual/cifar100_test_ood_residual.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p mediasuper -x SZ-IDC1-10-112-2-17 --gres=gpu:${GPU} \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/cifar100/cifar100.yml \ 16 | configs/datasets/cifar100/cifar100_ood.yml \ 17 | configs/networks/resnet18_32x32.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/residual.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/cifar100_resnet18_32x32_base_e100_lr0.1/best.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/others/residual/cifar10_test_ood_residual.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/residual/cifar10_test_ood_residual.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p mediasuper -x SZ-IDC1-10-112-2-17 --gres=gpu:${GPU} \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/cifar10/cifar10.yml \ 16 | configs/datasets/cifar10/cifar10_ood.yml \ 17 | configs/networks/resnet18_32x32.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/residual.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/cifar10_res18_acc94.30.ckpt' \ 23 | --mark 0 24 | -------------------------------------------------------------------------------- /scripts/ood/others/residual/imagenet_test_ood_residual.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/residual/imagenet_test_ood_residual.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | srun -p mediasuper -x SZ-IDC1-10-112-2-17 --gres=gpu:${GPU} \ 11 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | python main.py \ 14 | --config configs/datasets/imagenet/imagenet.yml \ 15 | configs/datasets/imagenet/imagenet_ood.yml \ 16 | configs/networks/vit.yml \ 17 | configs/pipelines/test/test_ood.yml \ 18 | configs/postprocessors/residual.yml \ 19 | --num_workers 8 \ 20 | --network.checkpoint ./checkpoints/vit-base-p16_in21k-pre-3rdparty_ft-64xb64_in1k-384_20210928-98e8652b.pth \ 21 | --mark 0 22 | -------------------------------------------------------------------------------- /scripts/ood/others/rotpred/cifar100_test_rotpred.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rotpred/cifar100_test_rotpred.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar100 \ 12 | --root ./results/cifar100_rot_net_rotpred_e100_lr0.1_default \ 13 | --postprocessor rotpred \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/rotpred/cifar100_train_rotpred.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rotpred/cifar100_train_rotpred.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/cifar100/cifar100.yml \ 6 | configs/networks/rot_net.yml \ 7 | configs/pipelines/train/baseline.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --trainer.name rotpred \ 10 | --seed 0 11 | -------------------------------------------------------------------------------- /scripts/ood/others/rotpred/cifar10_test_rotpred.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rotpred/cifar10_test_rotpred.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | python scripts/eval_ood.py \ 11 | --id-data cifar10 \ 12 | --root ./results/cifar10_rot_net_rotpred_e100_lr0.1_default \ 13 | --postprocessor rotpred \ 14 | --save-score --save-csv 15 | -------------------------------------------------------------------------------- /scripts/ood/others/rotpred/cifar10_train_rotpred.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rotpred/cifar10_train_rotpred.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/cifar10/cifar10.yml \ 6 | configs/networks/rot_net.yml \ 7 | configs/pipelines/train/baseline.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --trainer.name rotpred \ 10 | --seed 0 11 | -------------------------------------------------------------------------------- /scripts/ood/others/rotpred/imagenet200_test_rotpred.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rotpred/imagenet200_test_rotpred.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_rot_net_rotpred_e90_lr0.1_default \ 15 | --postprocessor rotpred \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_rot_net_rotpred_e90_lr0.1_default \ 22 | --postprocessor rotpred \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/rotpred/imagenet200_train_rotpred.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rotpred/imagenet200_train_rotpred.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet200/imagenet200.yml \ 6 | configs/networks/rot_net.yml \ 7 | configs/pipelines/train/baseline.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | --network.backbone.name resnet18_224x224 \ 10 | --trainer.name rotpred \ 11 | --optimizer.num_epochs 90 \ 12 | --dataset.train.batch_size 128 \ 13 | --num_gpus 2 --num_workers 16 \ 14 | --merge_option merge \ 15 | --seed 0 16 | -------------------------------------------------------------------------------- /scripts/ood/others/rotpred/imagenet_test_rotpred.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rotpred/imagenet_test_rotpred.sh 3 | 4 | ############################################ 5 | # we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood_imagenet.py 8 | 9 | # available architectures: 10 | # resnet50 11 | # ood 12 | python scripts/eval_ood_imagenet.py \ 13 | --ckpt-path ./results/imagenet_rot_net_rotpred_e30_lr0.001_default/s0/best.ckpt \ 14 | --arch resnet50 \ 15 | --postprocessor rotpred \ 16 | --save-score --save-csv #--fsood 17 | 18 | 19 | # full-spectrum ood 20 | python scripts/eval_ood_imagenet.py \ 21 | --ckpt-path ./results/imagenet_rot_net_rotpred_e30_lr0.001_default/s0/best.ckpt \ 22 | --arch resnet50 \ 23 | --postprocessor rotpred \ 24 | --save-score --save-csv --fsood 25 | -------------------------------------------------------------------------------- /scripts/ood/others/rotpred/imagenet_train_rotpred.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rotpred/imagenet_train_rotpred.sh 3 | 4 | # batch size is 64 otherwise will run out of GPU memory 5 | python main.py \ 6 | --config configs/datasets/imagenet/imagenet.yml \ 7 | configs/networks/rot_net.yml \ 8 | configs/pipelines/train/baseline.yml \ 9 | configs/preprocessors/base_preprocessor.yml \ 10 | --network.backbone.name resnet50 \ 11 | --network.backbone.pretrained True \ 12 | --network.backbone.checkpoint ./results/pretrained_weights/resnet50_imagenet1k_v1.pth \ 13 | --trainer.name rotpred \ 14 | --optimizer.lr 0.001 \ 15 | --optimizer.num_epochs 30 \ 16 | --dataset.train.batch_size 64 \ 17 | --num_gpus 2 --num_workers 16 \ 18 | --merge_option merge \ 19 | --seed 0 20 | -------------------------------------------------------------------------------- /scripts/ood/others/sem/cifar100_test_ood_sem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/sem/cifar100_test_ood_sem.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | python main.py \ 14 | --config configs/datasets/cifar100/cifar100.yml \ 15 | configs/datasets/cifar100/cifar100_ood.yml \ 16 | configs/networks/resnet18_32x32.yml \ 17 | configs/pipelines/test/test_ood.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/postprocessors/gmm.yml \ 20 | --num_workers 8 \ 21 | --network.checkpoint 'results/cifar100_resnet18_32x32_sae_e100_lr0.05/best.ckpt' \ 22 | --mark 0 23 | -------------------------------------------------------------------------------- /scripts/ood/others/sem/cifar100_train_sem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/sem/cifar100_train_sem.sh 3 | 4 | #GPU=1 5 | #CPU=1 6 | #node=79 7 | #jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | #--kill-on-bad-exit=1 --job-name=${jobname} \ 13 | #-w SG-IDC1-10-51-2-${node} \ 14 | python main.py \ 15 | --config configs/datasets/cifar100/cifar100.yml \ 16 | configs/datasets/cifar100/cifar100_ood.yml \ 17 | configs/networks/resnet18_32x32.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/pipelines/train/train_sem.yml \ 20 | --optimizer.num_epochs 100 \ 21 | --network.pretrained False \ 22 | --network.checkpoint ./results/mnist_0408_3/mnist_lenet_base_e100_lr0.1/best_epoch77_acc0.9940.ckpt \ 23 | --num_workers 8 -------------------------------------------------------------------------------- /scripts/ood/others/sem/cifar10_test_ood_sem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/sem/cifar10_test_ood_sem.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | python main.py \ 14 | --config configs/datasets/cifar10/cifar10.yml \ 15 | configs/datasets/cifar10/cifar10_ood.yml \ 16 | configs/networks/resnet18_32x32.yml \ 17 | configs/pipelines/test/test_ood.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/postprocessors/gmm.yml \ 20 | --num_workers 8 \ 21 | --network.checkpoint 'results/checkpoints/cifar10_res18_acc94.30.ckpt' \ 22 | --mark no_train 23 | -------------------------------------------------------------------------------- /scripts/ood/others/sem/cifar10_train_sem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/sem/cifar10_train_sem.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=79 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | # -w SG-IDC1-10-51-2-${node} \ 14 | 15 | python main.py \ 16 | --config configs/datasets/cifar10/cifar10.yml \ 17 | configs/datasets/cifar10/cifar10_ood.yml \ 18 | configs/networks/resnet18_32x32.yml \ 19 | configs/pipelines/train/train_sem.yml \ 20 | configs/preprocessors/base_preprocessor.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/cifar10_res18_acc94.30.ckpt' 23 | -------------------------------------------------------------------------------- /scripts/ood/others/sem/mnist_test_ood_sem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/sem/mnist_test_ood_sem.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | python main.py \ 14 | --config configs/datasets/mnist/mnist.yml \ 15 | configs/datasets/mnist/mnist_ood.yml \ 16 | configs/networks/lenet.yml \ 17 | configs/pipelines/test/test_ood.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/postprocessors/gmm.yml \ 20 | --num_workers 8 \ 21 | --network.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 22 | --mark no_train 23 | -------------------------------------------------------------------------------- /scripts/ood/others/ssd/cifar_10_test_ood_ssd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/ssd/cifar_10_test_ood_ssd.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/cifar10/cifar10.yml \ 16 | configs/datasets/cifar10/cifar10_ood.yml \ 17 | configs/networks/simclr.yml \ 18 | configs/pipelines/test/test_ood.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/mds.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/ssd/last.pth' \ 23 | --mark 0 \ 24 | --merge_option merge 25 | -------------------------------------------------------------------------------- /scripts/ood/others/udg/cifar100_train_udg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/udg/cifar100_train_udg.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | -w SG-IDC1-10-51-2-${node} \ 14 | python -m pdb -c continue main.py \ 15 | --config configs/datasets/cifar100/cifar100.yml \ 16 | configs/datasets/cifar100/cifar100_oe.yml \ 17 | configs/networks/udg_net.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/pipelines/train/baseline.yml \ 20 | configs/pipelines/train/train_udg.yml \ 21 | --dataset.train.dataset_class UDGDataset \ 22 | --dataset.oe.dataset_class UDGDataset \ 23 | --network.backbone.name resnet18_32x32 \ 24 | --network.pretrained False \ 25 | --seed 0 26 | -------------------------------------------------------------------------------- /scripts/ood/others/udg/cifar10_train_udg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/udg/cifar10_train_udg.sh 3 | 4 | GPU=1 5 | CPU=1 6 | node=73 7 | jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | python -m pdb -c continue main.py \ 14 | --config configs/datasets/cifar10/cifar10.yml \ 15 | configs/datasets/cifar10/cifar10_oe.yml \ 16 | configs/networks/udg_net.yml \ 17 | configs/preprocessors/base_preprocessor.yml \ 18 | configs/pipelines/train/baseline.yml \ 19 | configs/pipelines/train/train_udg.yml \ 20 | --dataset.train.dataset_class UDGDataset \ 21 | --dataset.oe.dataset_class UDGDataset \ 22 | --network.backbone.name resnet18_32x32 \ 23 | --network.pretrained False \ 24 | --seed 0 25 | -------------------------------------------------------------------------------- /scripts/ood/others/udg/imagenet200_test_udg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/udg/imagenet200_test_udg.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_oe_udg_udg_e90_lr0.1_default \ 15 | --postprocessor msp \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_oe_udg_udg_e90_lr0.1_default \ 22 | --postprocessor msp \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/udg/imagenet200_train_udg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/udg/imagenet200_train_udg.sh 3 | 4 | # UDG trainer cannot work with multiple GPUs currently 5 | python main.py \ 6 | --config configs/datasets/imagenet200/imagenet200.yml \ 7 | configs/datasets/imagenet200/imagenet200_oe.yml \ 8 | configs/networks/udg_net.yml \ 9 | configs/pipelines/train/baseline.yml \ 10 | configs/pipelines/train/train_udg.yml \ 11 | configs/preprocessors/base_preprocessor.yml \ 12 | --dataset.train.dataset_class UDGDataset \ 13 | --dataset.oe.dataset_class UDGDataset \ 14 | --network.backbone.name resnet18_224x224 \ 15 | --network.pretrained False \ 16 | --optimizer.num_epochs 90 \ 17 | --dataset.train.batch_size 256 \ 18 | --dataset.oe.batch_size 512 \ 19 | --num_gpus 1 --num_workers 16 \ 20 | --merge_option merge \ 21 | --seed 0 22 | -------------------------------------------------------------------------------- /scripts/ood/others/vos/cifar100_train_vos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/vos/cifar100_train_vos.sh 3 | 4 | PYTHONPATH='.':$PYTHONPATH \ 5 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 6 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 7 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 8 | python main.py \ 9 | --config configs/datasets/cifar100/cifar100.yml \ 10 | configs/networks/resnet18_32x32.yml \ 11 | configs/pipelines/train/train_vos.yml \ 12 | configs/preprocessors/base_preprocessor.yml \ 13 | configs/postprocessors/ebo.yml \ 14 | --num_workers 8 \ 15 | --optimizer.num_epochs 100 \ 16 | --merge_option merge \ 17 | --seed 0 18 | -------------------------------------------------------------------------------- /scripts/ood/others/vos/cifar10_train_vos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/vos/cifar10_train_vos.sh 3 | 4 | PYTHONPATH='.':$PYTHONPATH \ 5 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 6 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 7 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 8 | python main.py \ 9 | --config configs/datasets/cifar10/cifar10.yml \ 10 | configs/networks/resnet18_32x32.yml \ 11 | configs/pipelines/train/train_vos.yml \ 12 | configs/preprocessors/base_preprocessor.yml \ 13 | configs/postprocessors/ebo.yml \ 14 | --num_workers 8 \ 15 | --optimizer.num_epochs 100 \ 16 | --merge_option merge \ 17 | --seed 0 18 | -------------------------------------------------------------------------------- /scripts/ood/others/vos/imagenet200_test_vos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/vos/imagenet200_test_vos.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_vos_e90_lr0.1_default \ 15 | --postprocessor ebo \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_vos_e90_lr0.1_default \ 22 | --postprocessor ebo \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/others/vos/imagenet200_train_vos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/vos/imagenet200_train_vos.sh 3 | 4 | python main.py \ 5 | --config configs/datasets/imagenet200/imagenet200.yml \ 6 | configs/networks/resnet18_224x224.yml \ 7 | configs/pipelines/train/train_vos.yml \ 8 | configs/preprocessors/base_preprocessor.yml \ 9 | configs/postprocessors/ebo.yml \ 10 | --optimizer.num_epochs 90 \ 11 | --dataset.train.batch_size 128 \ 12 | --num_gpus 2 --num_workers 16 \ 13 | --merge_option merge \ 14 | --seed 0 15 | -------------------------------------------------------------------------------- /scripts/ood/others/vos/imagenet_train_vos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/vos/imagenet_train_vos.sh 3 | 4 | # we observed CUDA OOM error on Quadro RTX 6000 24GB GPUs 5 | python main.py \ 6 | --config configs/datasets/imagenet/imagenet.yml \ 7 | configs/networks/resnet50.yml \ 8 | configs/pipelines/train/train_vos.yml \ 9 | configs/preprocessors/base_preprocessor.yml \ 10 | configs/postprocessors/ebo.yml \ 11 | --network.pretrained True \ 12 | --network.checkpoint ./results/pretrained_weights/resnet50_imagenet1k_v1.pth \ 13 | --feature_dim 2048 \ 14 | --optimizer.lr 0.001 \ 15 | --optimizer.num_epochs 30 \ 16 | --dataset.train.batch_size 128 \ 17 | --num_gpus 2 --num_workers 16 \ 18 | --merge_option merge \ 19 | --seed ${SEED} 20 | -------------------------------------------------------------------------------- /scripts/ood/rankfeat/imagenet200_test_ood_rankfeat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rankfeat/imagenet200_test_ood_rankfeat.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor rankfeat \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor rankfeat \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/react/imagenet200_test_ood_react.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/react/imagenet200_test_ood_react.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor react \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor react \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/react/mnist_test_ood_react.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/react/mnist_test_ood_react.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=36 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | #srun -p dsta --mpi=pmi2 --gres=gpu:${GPU} -n1 \ 11 | #--cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | #--kill-on-bad-exit=1 --job-name=${jobname} -w SG-IDC1-10-51-2-${node} \ 13 | python main.py \ 14 | --config configs/datasets/mnist/mnist.yml \ 15 | configs/datasets/mnist/mnist_ood.yml \ 16 | configs/networks/react_net.yml \ 17 | configs/pipelines/test/test_ood.yml \ 18 | configs/preprocessors/base_preprocessor.yml \ 19 | configs/postprocessors/react.yml \ 20 | --network.pretrained False \ 21 | --network.backbone.name lenet \ 22 | --network.backbone.pretrained True \ 23 | --network.backbone.checkpoint 'results/checkpoints/mnist_lenet_acc99.30.ckpt' \ 24 | --num_workers 8 \ 25 | --mark 0 26 | -------------------------------------------------------------------------------- /scripts/ood/rmds/imagenet200_test_ood_rmds.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/rmds/imagenet200_test_ood_rmds.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor rmds \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor rmds \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/she/imagenet200_test_ood_she.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/she/imagenet200_test_ood_she.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor she \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor she \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/vim/imagenet200_test_ood_vim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/vim/imagenet200_test_ood_vim.sh 3 | 4 | ############################################ 5 | # alternatively, we recommend using the 6 | # new unified, easy-to-use evaluator with 7 | # the example script scripts/eval_ood.py 8 | # especially if you want to get results from 9 | # multiple runs 10 | 11 | # ood 12 | python scripts/eval_ood.py \ 13 | --id-data imagenet200 \ 14 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 15 | --postprocessor vim \ 16 | --save-score --save-csv #--fsood 17 | 18 | # full-spectrum ood 19 | python scripts/eval_ood.py \ 20 | --id-data imagenet200 \ 21 | --root ./results/imagenet200_resnet18_224x224_base_e90_lr0.1_default \ 22 | --postprocessor vim \ 23 | --save-score --save-csv --fsood 24 | -------------------------------------------------------------------------------- /scripts/ood/vim/mnist_test_osr_vim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sh scripts/ood/vim/mnist_test_osr_vim.sh 3 | 4 | # GPU=1 5 | # CPU=1 6 | # node=73 7 | # jobname=openood 8 | 9 | PYTHONPATH='.':$PYTHONPATH \ 10 | # srun -p mediasuper -x SZ-IDC1-10-112-2-17 --gres=gpu:${GPU} \ 11 | # --cpus-per-task=${CPU} --ntasks-per-node=${GPU} \ 12 | # --kill-on-bad-exit=1 --job-name=${jobname} \ 13 | 14 | python main.py \ 15 | --config configs/datasets/osr_mnist6/mnist6_seed1.yml \ 16 | configs/datasets/osr_mnist6/mnist6_seed1_ood.yml \ 17 | configs/networks/lenet.yml \ 18 | configs/pipelines/test/test_osr.yml \ 19 | configs/preprocessors/base_preprocessor.yml \ 20 | configs/postprocessors/vim.yml \ 21 | --num_workers 8 \ 22 | --network.checkpoint 'results/checkpoints/osr/mnist6_seed1.ckpt' \ 23 | --mark 0 \ 24 | --postprocessor.postprocessor_args.dim 42 25 | -------------------------------------------------------------------------------- /scripts/split_train.sh: -------------------------------------------------------------------------------- 1 | NUM=$1 2 | 3 | # we split 1000 training images for sanity check 4 | python imglist_generator.py --dataset cifar10 --split_num $NUM --seed 1; 5 | python imglist_generator.py --dataset cifar100 --split_num $NUM --seed 1; 6 | python imglist_generator.py --dataset imagenet200 --split_num $NUM --seed 1; 7 | python imglist_generator.py --dataset imagenet --split_num $NUM --seed 1 -------------------------------------------------------------------------------- /tools/sweep/hyperparam.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BierOne/ood_coverage/b00278098a8f4c629d785161c48605a5f837d563/tools/sweep/hyperparam.py --------------------------------------------------------------------------------