This is an unofficial pytorch implementation of a paper, SelectiveNet: A Deep Neural Network with an Integrated Reject Option [Geifman+, ICML2019]. I'm really grateful to the original implementation in Keras by the authors, which is very useful.
You will need the following to run the codes:
- Python 3.6+
- Pytorch 1.2+
- TorchVision
Note that I run the code with Ubuntu 18, Pytorch 1.2.0, CUDA 10.1
Use scripts/train.py
to train the network. Example usage:
# Example usage
cd scripts
python train.py --dataset cifar10 --log_dir ../logs/train --coverage 0.7
Use scripts/test.py
to test the network. Example usage:
# Example usage (test single weight)
cd scripts
python test.py --dataset cifar10 --weight ${path_to_saved_weight} --coverage 0.7
# Example usage (test multiple weights)
cd scripts
python experiments/test_multi.py -t ${path_to_root_dir_of_saved_weights} -d cifar10
Use scripts/plot.py
to plot the result. Example usage:
# Example usage (plot test result)
cd scripts
python plot.py -t ${path_to_test.csv} -x coverage --plot_test
# Example usage (plot all training logs)
cd scripts
python experiments/plot_multi.py -t ${path_to_test.csv} -x step --plot_all