This project is for the paper "Ensemble-Based Out-of-Distribution Detection" in MDPI Electronics. Some codes are from ODIN and Mahalanobis-based OOD Detection.
- Python 3.7
- Pytorch 1.5 (GPU version is recomended)
- scipy
- scikit-learn
- numpy
We provide several expeiments of ood detection using various combinations of datasets.
- 1-Channel image datasets: MNIST, and FashionMNIST
- 3-Channel image datasets: CIFAR-10, CIFAR-100, SVHN, Tiny ImageNet, and LSUN,
The datasets, excluding Tiny ImageNet and LSUN, are automatically downloaded from our code using the PyTorch library. To download Tiny ImageNet and LSUN datasets, we use following links from ODIN.
Please download and place them to ./data/
.
The models, excluding ResNet34 on 3-Channel image, are trained in our code(network_trainer_1C.ipynb, and network_trainer_3C.ipynb) To download the trained ResNet34 on 3-Channel image, we provide following links.
- Trained Model Weights: ResNet on CIFAR-10, ResNet on CIFAR-100, ResNet on SVHN
- Trained Model: ResNet on CIFAR-10, ResNet on CIFAR-100, ResNet on SVHN
Please download and place them to ./trained_models/
.
- Run all code in network_trainer_1C.ipynb, and network_trainer_3C.ipynb.
- You can see all trained models in
./trained_models/
.
Out-of-distribution Detection (Baseline, ODIN, Mahalanobis-based Method, DML-based Method, Ensemble-based Method (ours))
- Run all code in MAIN_1c.ipynb and MAIN_3c.ipynb
- All results will be printed in the each cell of Main_1c and Main_3c notebook