Git Product home page Git Product logo

sepmeta's Introduction

SepMeta

The PyTorch implementation of "Self-paced Meta-learning" (SepMeta). The curriculum in SepMeta is effectively integrated as a regularization term into the objective so as to the meta-learner can measure the hardness of tasks adaptively (or dynamically), according to what the model has already learned (i.e., the computed task-level losses). avatar

Prerequisites

  • Python 3.5
  • PyTorch >= 1.2
  • TorchVision >= 0.2
  • tqdm

Dataset Preparation

mini-ImageNet

  • Training set: 64 classes (600 images per class)
  • Val set: 16 classes
  • Test set: 20 classes

tiered-ImageNet

  • Training set: 351 classes (600 images per class)
  • Val set: 97 classes
  • Test set: 160 classes

After downloading the dataset, please create a new folder named "images" under the folder "miniimagenet" or "tieredimagenet", and put all images in this folder. The provided data loader will read images from the "images" folder by default. Of course, it is also OK to change the read path. For example, for the miniimagenet dataset, please change the line 10 of "./dataloader/mini_imagenet.py" as the path of the downloaded images.

Meta-training

Meta-training using SepMeta

SepMeta is an end-to-end method, you can dirrectly perform the following script to train and test a specific meta-learner.

python train_fsl.py --model_class ProtoNet --backbone_class Res12 --dataset MiniImageNet --max_epoch 100 --episodes_per_epoch 300 --temperature 40 --shot 1 --eval_shot 1 --step_size 20 --lr 0.001 --percent 0.1 --inc 0.005 --gpu 6

Meta-test

You can using the following script to test your trained model using tasks sampled from test set.

python test_fsl.py --shot 5 --eval_shot 5 --num_test_episodes 3000 --test_model .your_trained_model_path --gpu 5

Acknowledgement

Our implementations use the source code from the following repository:

Contact

If you have any questions about this implementation, please do not hesitate to contact with me.

sepmeta's People

Contributors

nobody-777 avatar jimzai 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.