This code provides an initial version for the implementation of the SCIENTIA SINICA Informationis paper "Generalized representation of local relationships for few-shot incremental learning". The projects are still under construction. Paper Link
《局部关系泛化表征的小样本增量学习》,中国科学,信息科学,2022,已接收, 论文链接。代码示例如下。
PyTorch>=1.1, tqdm, torchvsion.
- Download the benchmark dataset and unzip them in your customized path. CUB-200-2011 links For miniImageNet dataset from other sharing links in CEC, Click links to download.
- Modify the lines in train.py from 3~5 links
- unzip or tar these datasets
Step 1. cd the /pretrain file
Step 2.1 For mini_imagenet
$python train.py -project base -dataset mini_imagenet -base_mode 'ft_cos' -new_mode 'avg_cos' -gamma 0.1 -lr_base 0.1 -lr_new 0.1 -decay 0.0005 -epochs_base 100 -schedule Milestone -milestones 40 70 -gpu 0,1 -temperature 16
Step 2.2 For CUB dataset
$python train.py -project base -dataset cub200 -base_mode 'ft_cos' -new_mode 'avg_cos' -gamma 0.1 -lr_base 0.002 -lr_new 0.1 -decay 0.0005 -epochs_base 100 -schedule Milestone -milestones 40 70 -gpu 0,1 -temperature 16
Step 3. cd the /meta-learning file
Step 4.1 For mini_imagenet dataset
$python train.py -project frn -dataset mini_imagenet -base_mode 'ft_cos' -new_mode 'avg_cos' -gamma 0.1 -lr_base 0.001 -lr_new 0.0001 -decay 0.0005 -epochs_base 103 -epochs_new 10 -schedule Milestone -milestones 40 70 -temperature 16 -gpu '0,1' -episode_way 20 -episode_shot 10 -model_dir "/yourpathhere.pth"
Step 4.2 For cub dataset
$python train.py -project frn -dataset cub200 -base_mode 'ft_cos' -new_mode 'avg_cos' -gamma 0.1 -lr_base 0.002 -lr_new 0.001 -decay 0.0005 -epochs_base 101 -schedule Milestone -milestones 40 60 80 -episode_way 20 -episode_shot 10 -gpu '0,1' -temperature 16 -model_dir "/yourpathhere.pth"
Type/Datasets | CUB-200-2011 | mini-ImageNet |
---|---|---|
Pretrained | Links | Links |
Meta-Learning | 61.81% | 49.02% |
- The performance may be fluctuated in different GPUs and PyTorch platforms. Pytorch versions higher than 1.7.1 are tested.
- Two K80 GPUs are used in our experiments.
-
The project is still ongoing, finding suitable platforms and GPU devices for complete stable results.
-
The project is re-constructed for better understanding, we release this version for a quick preview of our paper.
The code of the paper is freely available for non-commercial purposes. Permission is granted to use the code given that you agree:
-
That the code comes "AS IS", without express or implied warranty. The authors of the code do not accept any responsibility for errors or omissions.
-
That you include necessary references to the paper in any work that makes use of the code.
-
That you may not use the code or any derivative work for commercial purposes as, for example, licensing or selling the code, or using the code with a purpose to procure a commercial gain.
-
That you do not distribute this code or modified versions.
-
That all rights not expressly granted to you are reserved by the authors of the code.
Please remember to cite us if u find this useful :)
@inproceedings{zhao2022local,
title={局部关系泛化表征的小样本增量学习},
author={赵一凡, 李甲,田永鸿},
booktitle={中国科学:信息科学},
year={2022},
}
Our project references the codes in the following repos. Please refer to these codes for details.