Skip to content

vrvrv/Anomaly-detection-using-SBM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anomaly detection using Score based generative model

Authors: Jinhwan Suk, Jihyeong Jung

Video, Slides

Get Started

git clone https://github.com/vrvrv/Anomaly-detection-using-SBM.git
cd Anomaly-detection-using-SBM

pip install -r requirements.txt

Download MvTec data

MVTec AD is a dataset for benchmarking anomaly detection methods with a focus on industrial inspection. It contains over 5000 high-resolution images divided into fifteen different object and texture categories.

wget https://www.mydrive.ch/shares/38536/3830184030e49fe74747669442f0f282/download/420938113-1629952094/mvtec_anomaly_detection.tar.xz
tar Jxvf mvtec_anomaly_detection.tar.xz

Train

You can find configuration files at configs/experiment/. Also, we provide pretrained weights from here. Please save the checkpoints at checkpoints/ directory.

In our code, wandb is the default logger. So, before running code, please sign up wandb.

Training score SDE

python train.py experiment=capsule_64

The above code starts training from the prescribed checkpoints. If you want to train the model from scratch, comment out the line resume_from_checkpoint: ... in YAML configuration file that you selected.

Test

python test.py experiment=capsule_64

This computes the likelihood and within-image conditional likelihood of test dataset.

References

Our codes are based on the following references.