few-shot-gnn-master

所属分类:其他
开发工具:Python
文件大小:18KB
下载次数:9
上传日期:2019-08-18 15:41:04
上 传 者shu_
说明:  通过few_shot少量监督信息来训练图神经网络,达到分类的效果
(Training Graph Neural Network for Classification)

文件列表:
data (0, 2018-10-23)
data\__init__.py (85, 2018-10-23)
data\generator.py (5509, 2018-10-23)
data\mini_imagenet.py (8312, 2018-10-23)
data\omniglot.py (6244, 2018-10-23)
data\parser.py (596, 2018-10-23)
datasets (0, 2018-10-23)
datasets\compressed (0, 2018-10-23)
datasets\compressed\mini_imagenet (0, 2018-10-23)
datasets\compressed\omniglot (0, 2018-10-23)
main.py (9453, 2018-10-23)
models (0, 2018-10-23)
models\__init__.py (23, 2018-10-23)
models\gnn_iclr.py (13559, 2018-10-23)
models\models.py (7354, 2018-10-23)
test.py (2609, 2018-10-23)
utils (0, 2018-10-23)
utils\__init__.py (0, 2018-10-23)
utils\io_utils.py (231, 2018-10-23)

# Few-Shot Learning with Graph Neural Networks Implementation of [Few-Shot Learning with Graph Neural Networks](https://arxiv.org/pdf/1711.04043.pdf) on Python3, Pytorch 0.3.1 ## Mini-Imagenet ### Download the dataset Create **images.zip** file and copy it inside ```mini_imagenet``` directory: . ├── ... └── datasets └── compressed └── mini_imagenet └── images.zip The **images.zip** file must contain the splits and images in the following format: ── images.zip ├── test.csv ├── train.csv ├── val.csv └── images ├── n0153282900000006.jpg ├── ... └── n1313361300001299.jpg The splits *{test.csv, train.csv, val.csv}* can be downloaded from [Ravi and Larochelle - splits](https://github.com/twitter/meta-learning-lstm/tree/master/data/miniImagenet). For more information on how to obtain the images check the original source [Ravi and Larochelle - github](https://github.com/twitter/meta-learning-lstm) ### Training ``` # 5-Way 1-shot | Few-shot EXPNAME=minimagenet_N5_S1 python3 main.py --exp_name $EXPNAME --dataset mini_imagenet --test_N_way 5 --train_N_way 5 --train_N_shots 1 --test_N_shots 1 --batch_size 100 --dec_lr=15000 --iterations 80000 # 5-Way 5-shot | Few-shot EXPNAME=minimagenet_N5_S5 python3 main.py --exp_name $EXPNAME --dataset mini_imagenet --test_N_way 5 --train_N_way 5 --train_N_shots 5 --test_N_shots 5 --batch_size 40 --dec_lr=15000 --iterations 90000 # 5-Way 5-shot 20%-labeled | Semi-supervised EXPNAME=minimagenet_N5_S1_U4 python3 main.py --exp_name $EXPNAME --dataset mini_imagenet --test_N_way 5 --train_N_way 5 --train_N_shots 5 --test_N_shots 5 --unlabeled_extra 4 --batch_size 40 --dec_lr=15000 --iterations 100000 ``` ## Omniglot ### Download the dataset Download **images_background.zip** and **images_evaluation.zip** files from [brendenlake/omniglot](https://github.com/brendenlake/omniglot/tree/master/python) and copy it inside the ```omniglot``` directory: . ├── ... └── datasets └── compressed └── omniglot ├── images_background.zip └── images_evaluation.zip ### Training ``` # 5-Way 1-shot | Few-shot EXPNAME=omniglot_N5_S1_v2 python3 main.py --exp_name $EXPNAME --dataset omniglot --test_N_way 5 --train_N_way 5 --train_N_shots 1 --test_N_shots 1 --batch_size 300 --dec_lr=10000 --iterations 100000 # 5-Way 5-shot | Few-shot EXPNAME=omniglot_N5_S5 python3 main.py --exp_name $EXPNAME --dataset omniglot --test_N_way 5 --train_N_way 5 --train_N_shots 5 --test_N_shots 5 --batch_size 100 --dec_lr=10000 --iterations 80000 # 20-Way 1-shot | Few-shot EXPNAME=omniglot_N20_S1 python3 main.py --exp_name $EXPNAME --dataset omniglot --test_N_way 20 --train_N_way 20 --train_N_shots 1 --test_N_shots 1 --batch_size 100 --dec_lr=10000 --iterations 80000 # 5-Way 5-shot 20%-labeled | Semi-supervised EXPNAME=omniglot_N5_S1_U4 python3 main.py --exp_name $EXPNAME --dataset omniglot --test_N_way 5 --train_N_way 5 --train_N_shots 5 --test_N_shots 5 --unlabeled_extra 4 --batch_size 100 --dec_lr=10000 --iterations 80000 ``` ## Citation If you find this code useful you can cite us using the following bibTex: ``` @article{garcia2017few, title={Few-Shot Learning with Graph Neural Networks}, author={Garcia, Victor and Bruna, Joan}, journal={arXiv preprint arXiv:1711.04043}, year={2017} } ```

近期下载者

相关文件


收藏者