Giter Site home page Giter Site logo

few-shot-gnn's Introduction

Few-Shot Learning with Graph Neural Networks

Implementation of Few-Shot Learning with Graph Neural Networks 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. For more information on how to obtain the images check the original source Ravi and Larochelle - github

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 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}
}

few-shot-gnn's People

Contributors

vgsatorras avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.