Git Product home page Git Product logo

idiap / tsoftmax Goto Github PK

View Code? Open in Web Editor NEW
2.0 6.0 3.0 33 KB

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

Home Page: https://arxiv.org/abs/2006.05389

License: GNU General Public License v3.0

Shell 17.43% Python 82.57%
out-of-distribution-detection classification t-distribution neural-networks

tsoftmax's Introduction

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

tsoftmax's People

Contributors

nantonel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tsoftmax's Issues

Using t-softmax with a pre-trained network

Not really an issue, but this is a short description of a branch with some new experiments.
These are in the branch tnet and avoid training NN classifiers from scratch. See readme in that branch for more details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.