This repository is the official implementation of "BOIL: Towards Representation Change for Few-shot Learning" Our implementations are relied on Torchmeta.
We run our code in the following environment using Anaconda.
- Python >= 3.5
- Pytorch == 1.4
- torchvision == 0.5
If you use Pytorch version above 1.5 (which is the latest version at this moment) and torchvision above 0.6, you may encounter problem. In that case, you are encouraged to change to the version in our environment.
To install requirements:
pip install -r requirements.txt
If you want to train 4conv network in the paper, run this command:
./run_4conv.sh
If you want to train ResNet-12 in the paper, run this command:
./run_resnet.sh
If you want to see and change the arguments of training code, run this command:
python3 main.py --help
To evaluate the model(s) and see the results, please refer to the analysis.ipynb
All results were reproduced by our group and reported as the average and standard deviation of the accuracies over 5x1000 tasks.
The values in parenthesis are the number of shots.
Domain | General Domain | Specific Domain | ||
Dataset | miniImageNet | tieredImageNet | CUB | Cars |
MAML(1) | ||||
BOIL(1) | ||||
MAML(5) | ||||
BOIL(5) |
Adaptation | General to general | General to Specific | ||
Meta-train | tieredImageNet | miniImageNet | miniImageNet | miniImageNet |
Meta-test | miniImageNet | tieredImageNet | CUB | Cars |
MAML(1) | ||||
BOIL(1) | ||||
MAML(5) | ||||
BOIL(5) |
Adaptation | Specific to general | Specific to Specific | ||
Meta-train | CUB | CUB | Cars | CUB |
Meta-test | miniImageNet | tieredImageNet | CUB | Cars |
MAML(1) | ||||
BOIL(1) | ||||
MAML(5) | ||||
BOIL(5) |
Meta-train | miniImageNet | CUB | ||||
Meta-test | miniImageNet | tieredImageNet | CUB | CUB | miniImageNet | Cars |
MAML w/ lsc | ||||||
MAML w/o lsc | ||||||
BOIL w/ lsc | ||||||
BOIL w/o lsc |