Home

Awesome

<p align="center"><img width="40%" src="./imgs/pytorch.png"></p>

LP-BNN CIFAR-10, CIFAR-100 official implementation using PyTorch BatchEnsemble CIFAR-10, CIFAR-100 unofficial implementation using PyTorch

Please if you use this code please cite the following papers:

Requirements

see the requirement of CIFAR code In addition to this requirement our code needs a big GPU to have a big batch. Our code where tested and implemented on a V100 tesla GPU thanks to Jeanzay cluster. Please proceed to the installation of Cuda, and Pytorch to as explained on PyTorch web page to be able to use our code.

How to TRAIN the Deep Neural Network with LP-BNN

After you have cloned the repository, you can train each dataset of either cifar10, cifar100 by running the script below. To have better results we advise you to perform several trainings(minimum 3).

 python main_LPBNN.py --dataset [cifar10/cifar100] --dirsave_out LPBNN_C10_T0
 python main_LPBNN.py --dataset [cifar10/cifar100] --dirsave_out LPBNN_C10_T1
 python main_LPBNN.py --dataset [cifar10/cifar100] --dirsave_out LPBNN_C10_T2

How to train the Deep Neural Network with LP-BNN BatchEnsemble

After you have cloned the repository, you can train each dataset of either cifar10, cifar100 by running the script below. To have better results we advise you to perform several trainings(minimum 3).

 python main_BatchEnsemble.py --dataset [cifar10/cifar100] --dirsave_out BE_C10_T0
 python main_BatchEnsemble.py --dataset [cifar10/cifar100] --dirsave_out BE_C10_T1
 python main_BatchEnsemble.py --dataset [cifar10/cifar100] --dirsave_out BE_C10_T2

How to evaluate the code

here are the comand line to test for CIFAR10. For CIFAR100 please adapt the code

 python  evaluate_uncertainty.py --algo 'BE' --dataset cifar10 --dirsave_out './checkpoint/cifar10/BE_C10_T'
 python  evaluate_uncertainty.py --algo 'LPBNN' --dataset cifar10 --dirsave_out './checkpoint/cifar10/LPBNN_C10_T'

Implementation Details

Hyper-parameterCIFAR-10CIFAR-100
Ensemble size J44
initial learning rate0.10.1
batch size128128
lr decay ratio0.10.1
lr decay epochs80, 160, 20080, 160, 200
cutoutTrueTrue
SyncEnsemble BNFalseFalse
Size of the latent space $3232

CIFAR-10 Results

alt tag

Below is the result of the test set accuracy for CIFAR-10 dataset training.

Accuracy is the average of 3 runs

networkAccuracy (%)AUCAUPRFPR-95-TPRECE (%)cA(%)cE (%)
BatchEnsemble96.480.95400.97310.1320.016747.440.2909
LP-BNN94.760.96700.98120.1040.014869.920.2421

If you are interrested about the corrupted accuraccy and corrupted expected calibration error please download the dataset from CIFAR-10-C