Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MeTal #99

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,6 @@ dmypy.json
.idea/
.vscode/
results/

# Datasets
datasets/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Wenbin Li, Ziyi Wang, Xuesong Yang, Chuanqi Dong, Pinzhuo Tian, Tiexin Qin, Jing
+ [MTL (CVPR 2019)](https://arxiv.org/abs/1812.02391)
+ [ANIL (ICLR 2020)](https://arxiv.org/abs/1909.09157)
+ [BOIL (ICLR 2021)](https://arxiv.org/abs/2008.08882)
+ [MeTal (arXiv 2021)](https://arxiv.org/abs/2110.03909)

### Metric-learning based methods
+ [ProtoNet (NeurIPS 2017)](https://arxiv.org/abs/1703.05175)
+ [RelationNet (CVPR 2018)](https://arxiv.org/abs/1711.06025)
Expand Down
7 changes: 7 additions & 0 deletions config/classifiers/METAL.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
classifier:
name: MAML
kwargs:
inner_param:
lr: 1e-2
iter: 5
feat_dim: 1600
9 changes: 9 additions & 0 deletions config/getting_started.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
includes:
- headers/data.yaml
- headers/device.yaml
- headers/losses.yaml
- headers/misc.yaml
- headers/model.yaml
- headers/optimizer.yaml
- classifiers/Proto.yaml
- backbones/Conv64FLeakyReLU.yaml
4 changes: 2 additions & 2 deletions config/headers/data.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
data_root: /data/fewshot/miniImageNet--ravi
data_root: datasets/miniImageNet--ravi
image_size: 84
use_memory: False
augment: True
augment_times: 1
augment_times_query: 1
workers: 8 # number of workers for dataloader in all threads
workers: 1 # number of workers for dataloader in all threads
dataloader_num: 1
2 changes: 1 addition & 1 deletion config/maml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ episode_size: 2
train_episode: 2000
test_episode: 600

device_ids: 5
device_ids: 0
n_gpu: 1
epoch: 100

Expand Down
86 changes: 86 additions & 0 deletions config/metal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
includes:
- headers/data.yaml
- headers/device.yaml
- headers/misc.yaml
- headers/model.yaml
- headers/optimizer.yaml

way_num: 5
shot_num: 1
query_num: 15

episode_size: 2
train_episode: 2000
test_episode: 600

device_ids: 0
n_gpu: 1
epoch: 100

optimizer:
name: Adam
kwargs:
lr: 0.001
other: ~

backbone:
name: Conv64F
kwargs:
is_flatten: True
is_feature: False
leaky_relu: False
negative_slope: 0.2
last_pool: True

classifier:
name: METAL
kwargs:
inner_param:
lr: 1e-2
train_iter: 5
test_iter: 10
feat_dim: 1600


#backbone:
# name: resnet12
# kwargs: ~
#
#classifier:
# name: METAL
# kwargs:
# inner_param:
# lr: 1e-2
# train_iter: 5
# test_iter: 10 #must same as train_iter
# feat_dim: 640


# backbone:
# name: resnet18
# kwargs: ~

# classifier:
# name: METAL
# kwargs:
# inner_param:
# lr: 1e-2
# train_iter: 5
# test_iter: 10 #must same as train_iter
# feat_dim: 512


# backbone:
# name: WRN
# kwargs:
# depth: 28
# widen_factor: 10

# classifier:
# name: METAL
# kwargs:
# inner_param:
# lr: 1e-2
# train_iter: 5
# test_iter: 10
# feat_dim: 640
2 changes: 1 addition & 1 deletion config/proto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ includes:


device_ids: 0,1
n_gpu: 2
n_gpu: 1
way_num: 5
shot_num: 1
query_num: 15
Expand Down
3 changes: 1 addition & 2 deletions config/renet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ classifier:
temperature: 0.2
temperature_attn: 5.0
name: RENet
data_root: /data/fewshot/miniImageNet--ravi
deterministic: true
device_ids: 3
device_ids: 0
episode_size: 1
epoch: 100
image_size: 84
Expand Down
63 changes: 0 additions & 63 deletions config/skd.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions config/versa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ includes:
deterministic: False

way_num: 5
shot_num: 5
shot_num: 1
query_num: 15
test_way: 5 # use ~ -> test_* = *_num
test_shot: 5
test_shot: 1
test_query: 15

episode_size: 1
Expand Down
1 change: 1 addition & 0 deletions core/model/meta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
from .leo import LEO
from .mtl import MTL
from .boil import BOIL
from .metal import METAL
Loading