GithubHelp home page GithubHelp logo

sisung / learningtocompare_fsl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from floodsung/learningtocompare_fsl

0.0 2.0 0.0 8.39 MB

PyTorch code for CVPR 2018 paper: Learning to Compare: Relation Network for Few-Shot Learning (Few-Shot Learning part)

License: MIT License

Python 100.00%

learningtocompare_fsl's Introduction

LearningToCompare_FSL

PyTorch code for CVPR 2018 paper: Learning to Compare: Relation Network for Few-Shot Learning (Few-Shot Learning part)

For Zero-Shot Learning part, please visit here.

Requirements

Python 2.7

Pytorch 0.3

Data

For Omniglot experiments, I directly attach omniglot 28x28 resized images in the git, which is created based on omniglot and maml.

For mini-Imagenet experiments, please download mini-Imagenet and put it in ./datas/mini-Imagenet and run proc_image.py to preprocess generate train/val/test datasets. (This process method is based on maml).

Train

omniglot 5way 1 shot:

python omniglot_train_one_shot.py -w 5 -s 1 -b 19 

omniglot 5way 5 shot:

python omniglot_train_few_shot.py -w 5 -s 5 -b 15 

omniglot 20way 1 shot:

python omniglot_train_one_shot.py -w 20 -s 1 -b 10

omniglot 20way 5 shot:

python omniglot_train_few_shot.py -w 20 -s 5 -b 5

mini-Imagenet 5 way 1 shot:

python miniimagenet_train_one_shot.py -w 5 -s 1 -b 15

mini-Imagenet 5 way 5 shot:

python miniimagenet_train_few_shot.py -w 5 -s 5 -b 10

you can change -b parameter based on your GPU memory. Currently It will load my trained model, if you want to train from scratch, you can delete models by yourself.

Test

omniglot 5way 1 shot:

python omniglot_test_one_shot.py -w 5 -s 1

Other experiments' testings are similar.

Citing

If you use this code in your research, please use the following BibTeX entry.

@inproceedings{sung2018learning,
  title={Learning to Compare: Relation Network for Few-Shot Learning},
  author={Sung, Flood and Yang, Yongxin and Zhang, Li and Xiang, Tao and Torr, Philip HS and Hospedales, Timothy M},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  year={2018}
}

Reference

MAML

MAML-pytorch

learningtocompare_fsl's People

Contributors

floodsung avatar linkwoong avatar lzrobots avatar

Watchers

 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.