This repository contains the pytorch implementation of Associative Alignment for Few-shot Image Classification paper presentation. This paper proposes associative alignment with two strategies: 1) a metric-learning loss for minimizing the distance between related base samples and the centroid of novel instances in the feature space, and 2) a conditional adversarial alignment loss based on the Wasserstein distance.
- Hyper-parameters and training details are specified in
args_parser.py
, where you can switch between methods such as softMax, cosMax or arcMax. We tested associative alignment using arcMax. - Run meta-learning from
transferLearning.py
to capture and test the best model in ./results/models. - Run transfer learning from
transferLearning.py
to save and test the best model in ./results/models. This is required to move on to the next associative alignment stage. - Run
associative_alignment.py
to perform our associative alignment using the best model found in (2) and the pre-defined setup in (1).
- To speed up the detecting related base, we saved the base classes in 84x84 format. Therefore, we recommend to download the dataset here, and copy the dataset in the fs_benchmarks directory.
- Otherwise, if you have the dataset, specify the directory of your training set in
args_parser.py
.
- numpy
- Pytorch 1.0.1+
- torchvision 0.2.1+
- PIL
Please visit the project webpage for more information.
@inproceedings{afrasiyabi2020associative, title={Associative Alignment for Few-shot Image Classification}, author={Afrasiyabi, Arman and Lalonde, Jean-Fran{\c{c}}ois and Gagn{'e}, Christian}, booktitle={European Conference on Computer Vision}, pages={18--35}, year={2020}, organization={Springer} }