中文版说明请点击这里
This repository contains the code for the paper:
Cooperative Bi-path Metric for Few-shot Learning
Zeyuan Wang, Yifan Zhao, Jia Li, Yonghong Tian
ACM Conference on Multimedia (ACM MM), 2020
-
python = 3.6
-
pytorch = 1.6
-
scikit-learn = 0.23
-
python-lmdb = 0.96
-
miniImageNet (in the form of
.pickle
):Link: https://github.com/gidariss/FewShotWithoutForgetting
-
tieredImageNet (in the form of
.jpg
):
- Change the variable
dataset_dir
in configuration file./torchFewShot/datasets/miniImageNet_load.py
to the correct path to miniImageNet. - Change the variable
dataset_dir
in configuration file./torchFewShot/datasets/tieredImageNet.py
to the correct path to tieredImageNet. - Change the variable
file
insave_base_proto.py.py
to the correct path to the train set file of miniImageNet.
train baseline++ on miniImageNet for 5-shot
python train.py mini --nExemplars 5
train baseline++ on miniImageNet for 1-shot
python train.py mini --nExemplars 1
train baseline++ on tieredImageNet for 5-shot
python train.py tiered --nExemplars 5
train baseline++ on tieredImageNet for 1-shot
python train.py tiered --nExemplars 1
save feature vectors of base classes of miniImageNet for 5-shot
python save_base_proto.py mini --nExemplars 5
save feature vectors of base classes of miniImageNet for 1-shot
python save_base_proto.py mini --nExemplars 1
test baseline++ on miniImageNet for 5-shot
python test.py mini --nExemplars 5
test baseline++ on miniImageNet for 1-shot
python test.py mini --nExemplars 1
test baseline++ on tieredImageNet for 5-shot
python test.py tiered --nExemplars 5
test baseline++ on tieredImageNet for 1-shot
python test.py tiered --nExemplars 1
test CBM on miniImageNet for 5-shot
python test.py CBM_5_shot
test CBM on miniImageNet for 1-shot
python test.py CBM_1_shot
test CBM_LLE on miniImageNet for 5-shot
python test.py CBM_LLE_5_shot
test CBM_LLE on miniImageNet for 1-shot
python test.py CBM_LLE_1_shot
If you use this code for your research, please cite our paper:
@inproceedings{DBLP:conf/mm/WangZ0020,
author = {Zeyuan Wang and
Yifan Zhao and
Jia Li and
Yonghong Tian},
editor = {Chang Wen Chen and
Rita Cucchiara and
Xian{-}Sheng Hua and
Guo{-}Jun Qi and
Elisa Ricci and
Zhengyou Zhang and
Roger Zimmermann},
title = {Cooperative Bi-path Metric for Few-shot Learning},
booktitle = {{MM} '20: The 28th {ACM} International Conference on Multimedia, Virtual
Event / Seattle, WA, USA, October 12-16, 2020},
pages = {1524--1532},
publisher = {{ACM}},
year = {2020},
url = {https://doi.org/10.1145/3394171.3413946},
doi = {10.1145/3394171.3413946},
timestamp = {Thu, 15 Oct 2020 16:32:08 +0200},
biburl = {https://dblp.org/rec/conf/mm/WangZ0020.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
This code is based on the implementations of Cross Attention Network for Few-shot Classification.
本代码仓库是对以下论文的实现:
Cooperative Bi-path Metric for Few-shot Learning
Zeyuan Wang, Yifan Zhao, Jia Li, Yonghong Tian
ACM Conference on Multimedia (ACM MM), 2020
-
python = 3.6
-
pytorch = 1.6
-
scikit-learn = 0.23
-
python-lmdb = 0.96
-
miniImageNet (以
.pickle
格式):地址: https://github.com/gidariss/FewShotWithoutForgetting
-
tieredImageNet (以
.jpg
格式):
- 改变文件
./torchFewShot/datasets/miniImageNet_load.py
中的变量dataset_dir
,指向miniImageNet。 - 改变文件
./torchFewShot/datasets/tieredImageNet.py
中的变量dataset_dir
,指向tieredImageNet。 - 改变文件
save_base_proto.py.py
中的变量file
,指向miniImageNet的训练集的pickle文件。
train baseline++ on miniImageNet for 5-shot
python train.py mini --nExemplars 5
train baseline++ on miniImageNet for 1-shot
python train.py mini --nExemplars 1
train baseline++ on tieredImageNet for 5-shot
python train.py tiered --nExemplars 5
train baseline++ on tieredImageNet for 1-shot
python train.py tiered --nExemplars 1
save feature vectors of base classes of miniImageNet for 5-shot
python save_base_proto.py mini --nExemplars 5
save feature vectors of base classes of miniImageNet for 1-shot
python save_base_proto.py mini --nExemplars 1
test baseline++ on miniImageNet for 5-shot
python test.py mini --nExemplars 5
test baseline++ on miniImageNet for 1-shot
python test.py mini --nExemplars 1
test baseline++ on tieredImageNet for 5-shot
python test.py tiered --nExemplars 5
test baseline++ on tieredImageNet for 1-shot
python test.py tiered --nExemplars 1
test CBM on miniImageNet for 5-shot
python test.py CBM_5_shot
test CBM on miniImageNet for 1-shot
python test.py CBM_1_shot
test CBM_LLE on miniImageNet for 5-shot
python test.py CBM_LLE_5_shot
test CBM_LLE on miniImageNet for 1-shot
python test.py CBM_LLE_1_shot
如果你使用了该代码,请以下列各式引用我们的论文:
@inproceedings{DBLP:conf/mm/WangZ0020,
author = {Zeyuan Wang and
Yifan Zhao and
Jia Li and
Yonghong Tian},
editor = {Chang Wen Chen and
Rita Cucchiara and
Xian{-}Sheng Hua and
Guo{-}Jun Qi and
Elisa Ricci and
Zhengyou Zhang and
Roger Zimmermann},
title = {Cooperative Bi-path Metric for Few-shot Learning},
booktitle = {{MM} '20: The 28th {ACM} International Conference on Multimedia, Virtual
Event / Seattle, WA, USA, October 12-16, 2020},
pages = {1524--1532},
publisher = {{ACM}},
year = {2020},
url = {https://doi.org/10.1145/3394171.3413946},
doi = {10.1145/3394171.3413946},
timestamp = {Thu, 15 Oct 2020 16:32:08 +0200},
biburl = {https://dblp.org/rec/conf/mm/WangZ0020.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
该代码主要基于 Cross Attention Network for Few-shot Classification 实现,在此对原作者的工作表示衷心的感谢!