Awesome
Associative Alignment for Few-shot Image Classification
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.
Train
- Hyper-parameters and training details are specified in <code>args_parser.py</code>, where you can switch between methods such as softMax, cosMax or arcMax. We tested associative alignment using arcMax.
- Run meta-learning from <code>transferLearning.py</code> to capture and test the best model in ./results/models.
- Run transfer learning from <code>transferLearning.py</code> to save and test the best model in ./results/models. This is required to move on to the next associative alignment stage.
- Run <code>associative_alignment.py</code> to perform our associative alignment using the best model found in (2) and the pre-defined setup in (1).
Datasets
- 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 <code>args_parser.py</code>.
Dependencies
- numpy
- Pytorch 1.0.1+
- torchvision 0.2.1+
- PIL
The project webpage
Please visit the project webpage for more information.
Citation
</code><pre> @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} } </code></pre>