Skip to content

Code for the NIPS 2017 Paper "Prototypical Networks for Few-shot Learning"

License

Notifications You must be signed in to change notification settings

MTynes/prototypical-networks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prototypical Networks for Few-shot Learning

This is a modified version of work by jakesnell, which permits the use of a custom dataset. It has been tested using Google Colab with and without GPU.

The original code implements the NeurIPS paper Prototypical Networks for Few-shot Learning.

As with the original code, citations should be as follows:

@inproceedings{snell2017prototypical,
  title={Prototypical Networks for Few-shot Learning},
  author={Snell, Jake and Swersky, Kevin and Zemel, Richard},
  booktitle={Advances in Neural Information Processing Systems},
  year={2017}
 }

The code expects the directory with all images and the directory containing the label files (train.txt, val.txt, test.txt, or train_val.txt) to be passed to it.

Usage example, with GPU

images_directory = '/content/eeg/all_images'
lr = 0.0001
epochs = 10000
patience = 300 # number of iterations to wait after last improvement in validation loss before terminating execution
! python scripts/train/few_shot/run_train_custom_dataset.py --data.data_path {images_directory} --data.labels_path {images_directory} --train.learning_rate {lr} --train.epochs {epochs} --train.patience{patience} --data.cuda 

About

Code for the NIPS 2017 Paper "Prototypical Networks for Few-shot Learning"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published