HJ-Yoo / BOIL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BOIL: Towards Representation Change for Few-shot Learning

This repository is the official implementation of "BOIL: Towards Representation Change for Few-shot Learning" Our implementations are relied on Torchmeta.

Requirements

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

Training

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

Evaluation

To evaluate the model(s) and see the results, please refer to the analysis.ipynb

Results

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.

1. 5-Way k-shot test accuracy (%) of 4conv network on various benchmark dataset.

Domain General Domain Specific Domain
Dataset miniImageNet tieredImageNet CUB Cars
MAML(1)
BOIL(1)
MAML(5)
BOIL(5)

2. 5-Way k-shot test accuracy (%) of 4conv network on cross-domain adaptation.

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)

3. 5-Way 5-shot test accuracy (%) of ResNet-12.

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

About


Languages

Language:Python 90.9%Language:Jupyter Notebook 7.9%Language:Shell 1.2%