Gabi Shalev ([email protected])
Gal Lev Shalev ([email protected])
Joseph Keshet ([email protected])
This repository provides a PyTorch implementation of the paper Redesigning the Classification Layer by Randomizing the Class Representation Vectors.
The repository allows training fixed and non-fixed dot-product models, and also fixed and non-fixed cosine-similarity maximization models on STL dataset (more datasets will be supported soon). ResNet-18 is set as the visual encoder component.
- Python 3.6
- PyTorch 1.0.0 +
$ git clone https://github.com/MLSpeech/FixedClassificationLayer.git
$ cd FixedClassificationLayer
- For training NON-FIXED dot-product run the following command:
python run_stl.py --data_dir <PATH TO DATA> --save_dir <PATH TO SAVE MODELS> --runname <NAME OF RUN>
- For training FIXED dot-product run the following command:
python run_stl.py --data_dir <PATH TO DATA> --save_dir <PATH TO SAVE MODELS> --runname <NAME OF RUN> --fixed
- For training NON-FIXED cosine-similarity run the following command:
python run_stl.py --data_dir <PATH TO DATA> --save_dir <PATH TO SAVE MODELS> --runname <NAME OF RUN> --cosine --s <S VALUE>
- For training FIXED cosine-similarity run the following command:
python run_stl.py --data_dir <PATH TO DATA> --save_dir <PATH TO SAVE MODELS> --runname <NAME OF RUN> --cosine --s <S VALUE> --fixed
If you find our work useful please cite:
@article{shalev2020redesigning,
title={Redesigning the classification layer by randomizing the class representation vectors},
author={Shalev, Gabi and Shalev, Gal-Lev and Keshet, Joseph},
journal={arXiv preprint arXiv:2011.08704},
year={2020}
}