Skip to content
/ tsoftmax Public

Reproducible code for the paper “A t-distribution based operator for enhancing out of distribution robustness of neural network classifiers"

License

Notifications You must be signed in to change notification settings

idiap/tsoftmax

Repository files navigation

t-softmax pytorch reproducibility code

This repository contains the code to reproduce the results of the paper:

Niccolò Antonello, Philip N. Garner "A t-distribution based operator for enhancing out of distribution robustness of neural network classifiers," IEEE Signal Processing Letters, 2020

The code is based on the Pytorch machine learning library. If you want to use t-softmax in your classifiers/neural networks you can find the modules in src/tsoftmax.py.

Installation

We use conda to create a reproducible environment. Run:

conda env create -f conda_env.yml

to install the dependencies.

Activate the environment using conda activate tsoftmax

In path.sh change PYPATH to the bin directory of the environment you just built e.g.:

PYPATH="/path_to_conda/miniconda3/envs/tsoftmax/bin"

and to the LSUN dataset:

LSUNPATH="/path_to_lsun/"

Experiments on Fashion-MNIST and k-MNIST

Training

To train a fmnist classifier run:

bash run_bw.sh fmnist

To train a kmnist classifier run:

bash run_bw.sh kmnist

This will train different models and save them in the folder models.

Getting confidences

Run evaluation scripts by running:

bash run_eval_bw.sh

Visualizing results

Finally you can view the results by running the following script:

python plot_fom.py --arch convnet --data fmnist 

and

python plot_fom.py --arch convnet --data kmnist 

Experiments on CIFAR10

For the CIFAR10 experiments, the procedure is similar:

  • Training: run.sh (Note: training each model can be time-demanding. You might want to comment some lines on this script and run it in parallel using different machines)
  • Confidence measures: run_eval.sh
  • Visualizing results: python plot_fom.py --arch densenet --data cifar10

About

Reproducible code for the paper “A t-distribution based operator for enhancing out of distribution robustness of neural network classifiers"

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published