Skip to content

Commit bd321ad

Browse files
authored
Update README.md
1 parent 9a4155b commit bd321ad

File tree

1 file changed

+36
-43
lines changed

1 file changed

+36
-43
lines changed

README.md

+36-43
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
11
# Few-Shot Learning via Embedding Adaptation with Set-to-Set Functions
2-
The code repository for "[Few-Shot Learning via Embedding Adaptation with Set-to-Set Functions](https://arxiv.org/abs/1812.03664)" (Accepted by CVPR 2020) in PyTorch.
2+
The code repository for "[Few-Shot Learning via Embedding Adaptation with Set-to-Set Functions](https://arxiv.org/abs/1812.03664)" (Accepted by CVPR 2020) in PyTorch. If you use any content of this repo for your work, please cite the following bib entry:
33

4-
## Few-Shot Embedding Adaptation with Transformer
4+
@inproceedings{ye2020fewshot,
5+
author = {Han-Jia Ye and
6+
Hexiang Hu and
7+
De-Chuan Zhan and
8+
Fei Sha},
9+
title = {Few-Shot Learning via Embedding Adaptation with Set-to-Set Functions},
10+
booktitle = {Computer Vision and Pattern Recognition (CVPR)},
11+
year = {2020}
12+
}
513

6-
Learning with limited data is a key challenge for visual recognition. Many few-shot learning methods address this challenge by learning an instance embedding function from seen classes and apply the function to instances from unseen classes with limited labels. This style of transfer learning is task-agnostic: the embedding function is not learned optimally discriminative with respect to the unseen classes, where discerning among them leads to the target task. In this paper, we propose a novel approach to adapt the instance embeddings to the target classification task with a #set-to-set# function, yielding embeddings that are task-specific and are discriminative. We empirically investigated various instantiations of such set-to-set functions and observed the Transformer is most effective --- as it naturally satisfies key properties of our desired model. We denote this model as FEAT (few-shot embedding adaptation w/ Transformer) and validate it on both the standard few-shot classification benchmark and four extended few-shot learning settings with essential use cases, i.e., cross-domain, transductive, generalized few-shot learning, and low-shot learning. It archived consistent improvements over baseline models as well as previous methods and established the new state-of-the-art results on two benchmarks.
14+
## Few-Shot Embedding Adaptation with Set-to-Set Functions
715

8-
![Few-Shot Learning via Transformer](imgs/teaser.PNG)
16+
We propose a novel model-based approach to adapt the instance embeddings to the target classification task with a #set-to-set# function, yielding embeddings that are task-specific and are discriminative. We empirically investigated various instantiations of such set-to-set functions and observed the Transformer is most effective --- as it naturally satisfies key properties of our desired model. We denote our method as Few-shot Embedding Adaptation with Transformer (FEAT).
917

1018
![architecture compare](imgs/architecture.png)
1119

20+
## Results
21+
22+
Results on the MiniImageNet with ResNet-12 backbone:
23+
| Setups | 1-Shot 5-Way | 5-Shot 5-Way | Link to Weights |
24+
|:--------:|:------------:|:------------:|:-----------------:|
25+
| ProtoNet | 62.39 | 80.53 | [Coming Soon]() |
26+
| BILSTM | 63.90 | 80.63 | [Coming Soon]() |
27+
| DEEPSETS | 64.14 | 80.93 | [Coming Soon]() |
28+
| GCN | 64.50 | 81.65 | [Coming Soon]() |
29+
| FEAT | **66.78** | **82.05** | [Coming Soon]() |
30+
31+
Results on the TieredImageNet with ResNet-12 backbone:
32+
| Setups | 1-Shot 5-Way | 5-Shot 5-Way | Link to Weights |
33+
|:--------:|:------------:|:------------:|:-----------------:|
34+
| ProtoNet | 68.23 | 84.03 | [Coming Soon]() |
35+
| BILSTM | 68.14 | 84.23 | [Coming Soon]() |
36+
| DEEPSETS | 68.59 | 84.36 | [Coming Soon]() |
37+
| GCN | 68.20 | 84.64 | [Coming Soon]() |
38+
| FEAT | **70.80** | **84.79** | [Coming Soon]() |
39+
1240
### Prerequisites
1341

1442
The following packages are required to run the scripts:
@@ -49,7 +77,7 @@ Please use **train_fsl.py** and follow the instructions below. FEAT meta-learns
4977
#### Arguments
5078
The train_fsl.py takes the following command line options (details are in the `model/utils.py`):
5179

52-
## Task Related Arguments ##
80+
**Task Related Arguments**
5381
- `dataset`: Option for the dataset (`MiniImageNet`, `TieredImageNet`, or `CUB`), default to `MiniImageNet`
5482

5583
- `way`: The number of classes in a few-shot task during meta-training, default to `5`
@@ -64,7 +92,7 @@ The train_fsl.py takes the following command line options (details are in the `m
6492

6593
- `eval_query`: Number of instances in each class to evaluate the performance during meta-test, default to `15`
6694

67-
## Optimization Related Arguments ##
95+
**Optimization Related Arguments**
6896
- `max_epoch`: The maximum number of training epochs, default to `200`
6997

7098
- `episodes_per_epoch`: The number of tasks sampled in each epoch, default to `100`
@@ -89,7 +117,7 @@ The train_fsl.py takes the following command line options (details are in the `m
89117

90118
- `weight_decay`: The weight_decay value for SGD optimizer, default to `0.0005`
91119

92-
## Model Related Arguments ##
120+
**Model Related Arguments**
93121
- `model_class`: The model to use during meta-learning. We provide implementations for baselines (`MatchNet` and `ProtoNet`), set-to-set functions (`BILSTM`, `DeepSet`, `GCN`, and our `FEAT`). We also include an instance-specific embedding adaptation approach `FEAT`, which is discussed in the old version of the paper. Default to `FEAT`
94122

95123
- `use_euclidean`: Use the euclidean distance or the cosine similarity to compute pairwise distances. We use the euclidean distance in the paper. Default to `False`
@@ -102,7 +130,7 @@ The train_fsl.py takes the following command line options (details are in the `m
102130

103131
- `temperature2`: Temperature over the logits in the regularizer, we divide logits with this value. This is specially designed for the contrastive regularizer. Default to `1`
104132

105-
## Other Arguments ##
133+
**Other Arguments**
106134
- `orig_imsize`: Whether to resize the images before loading the data into the memory. `-1` means we do not resize the images and do not read all images into the memory. Default to `-1`
107135

108136
- `multi_gpu`: Whether to use multiple gpus during meta-training, default to `False`
@@ -134,41 +162,6 @@ to train the 1-shot/5-shot 5-way FEAT model with ResNet-12 backbone on TieredIma
134162
$ python train_fsl.py --max_epoch 200 --model_class FEAT --backbone_class Res12 --dataset TieredImageNet --way 5 --eval_way 5 --shot 1 --eval_shot 1 --query 15 --eval_query 15 --balance 0.1 --temperature 64 --temperature2 64 --lr 0.0002 --lr_mul 10 --lr_scheduler step --step_size 20 --gamma 0.5 --gpu 0 --init_weights ./saves/initialization/tieredimagenet/Res12-pre.pth --eval_interval 1 --use_euclidean
135163
$ python train_fsl.py --max_epoch 200 --model_class FEAT --backbone_class Res12 --dataset TieredImageNet --way 5 --eval_way 5 --shot 5 --eval_shot 5 --query 15 --eval_query 15 --balance 0.1 --temperature 32 --temperature2 64 --lr 0.0002 --lr_mul 10 --lr_scheduler step --step_size 40 --gamma 0.5 --gpu 0 --init_weights ./saves/initialization/tieredimagenet/Res12-pre.pth --eval_interval 1 --use_euclidean
136164

137-
#### Results
138-
139-
Results on the MiniImageNet:
140-
| Setups | 1-Shot 5-Way | 1-Shot 5-Way | 5-Shot 5-Way | 5-Shot 5-Way |
141-
|:--------:|:------------:|:------------:|:------------:|:------------:|
142-
| Backbone | ConvNet | ResNet | ConvNet | ResNet |
143-
| ProtoNet | 52.61 | 62.39 | 71.33 | 80.53 |
144-
| BILSTM | 52.13 | 63.90 | 69.15 | 80.63 |
145-
| DEEPSETS | 54.41 | 64.14 | 70.96 | 80.93 |
146-
| GCN | 53.25 | 64.50 | 70.59 | 81.65 |
147-
| FEAT | 55.15 | 66.78 | 71.61 | 82.05 |
148-
149-
Results on the TieredImageNet with ResNet-12 backbone:
150-
| Setups | 1-Shot 5-Way | 5-Shot 5-Way |
151-
|:--------:|:------------:|:------------:|
152-
| ProtoNet | 68.23 | 84.03 |
153-
| BILSTM | 68.14 | 84.23 |
154-
| DEEPSETS | 68.59 | 84.36 |
155-
| GCN | 68.20 | 84.64 |
156-
| FEAT | 70.80 | 84.79 |
157-
158-
## .bib citation
159-
If this repo helps in your work, please cite the following paper:
160-
161-
@inproceedings{ye2020fewshot,
162-
author = {Han-Jia Ye and
163-
Hexiang Hu and
164-
De-Chuan Zhan and
165-
Fei Sha},
166-
title = {Few-Shot Learning via Embedding Adaptation with Set-to-Set Functions},
167-
booktitle = {Computer Vision and Pattern Recognition (CVPR)},
168-
year = {2020}
169-
}
170-
171-
172165
## Acknowledgment
173166
We thank the following repos providing helpful components/functions in our work.
174167
- [ProtoNet](https://github.com/cyvius96/prototypical-network-pytorch)

0 commit comments

Comments
 (0)