Skip to content

Official implementation for masked contrastive learning for anomaly detection.(IJCAI-21)

Notifications You must be signed in to change notification settings

HyunsooCho77/MCL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCL on (CIFAR-10, CIFAR-100)

Official code for MCL. (Masked Contrastive Learning for Anomaly Detection IJCAI-2021) This code includes SEI eval on CIFAR-100. (AUROC around 94.) Some codes are from SimCLR-CIFAR10.

Dependencies

  • pytorch >=1.2
  • torchvision >=0.4.0
  • hydra >=0.11.3
  • tqdm >=4.45.0

Install Hydra

Hydra is a python framework to manage the hyperparameters during training and evaluation. Install with:

pip install hydra-core --upgrade

Usage

Dataset download and preprocess (4-way rotations augmented dataset with rotation label) python utils/data_preprocess.py

Train MCL: python mcl_main.py

Use the following prefix to train MCL with single GPU : CUDA_VISIBLE_DEVICES="GPU_number"

All the hyperparameters are available in mcl_config.yml, which could be overrided from the command line.

Evaluate trained model.

Download MCL trained model.

place trained model (epoch_800.pt) in following directory.

./logs/model_name(default : MCL)/ckpt/epoch_800.pt

To evaluate pretrained model, set evaluate flag to True and load_epoch to 800 in mcl_config.yml.

Then run python mcl_main.py.

Experimental results are stored in ./logs/model_name(default : MCL)/SEI performance_summary.txt file.

Notes

Current version of SEI is not optimized enough, thus it might be slow.

About

Official implementation for masked contrastive learning for anomaly detection.(IJCAI-21)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages