Code Monkey home page Code Monkey logo

dtn's Introduction

Diversity Transfer Network for Few-Shot Learning

Pytorch implementation for "Diversity Transfer Network for Few-Shot Learning" (deep backbone, on miniImageNet).

We also provide our trainded models.

Citations

If you find DTN useful in your research, please consider citing:

@inproceedings{chen2020diversity,
  title={Diversity Transfer Network for Few-Shot Learning.},
  author={Chen, Mengting and Fang, Yuxin and Wang, Xinggang and Luo, Heng and Geng, Yifeng and Zhang, Xinyu and Huang, Chang and Liu, Wenyu and Wang, Bo},
  booktitle={AAAI},
  pages={10559--10566},
  year={2020}
}

Introduction

Few-shot learning is a challenging task that aims at training a classifier for unseen classes with only a few training examples. The main difficulty of few-shot learning lies in the lack of intra-class diversity within insufficient training samples.

To alleviate this problem, we propose a novel generative framework, Diversity Transfer Network (DTN), that learns to transfer latent diversities from known categories and composite them with support features to generate diverse samples for novel categories in feature space. The learning problem of the sample generation (i.e., diversity transfer) is solved via minimizing an effective meta-classification loss in a single-stage network, instead of the generative loss in previous works.

Besides, an organized auxiliary task co-training(OAT) over known categories is proposed to stabilize the meta-training process of DTN.

alt text

Dataset Preprocessing & Evaluate our trained model on miniImageNet

Download the dataset from this link, put the images folder in ./miniImageNet/.

Run:

bash make.sh

We provide our trainded models for practitioners to reproduce our results listed in Table 3 of the DTN paper. alt text

Train your DTN on miniImageNet

python main_DTN.py --checkpoint 'your_checkpoint'

Evaluate your DTN on miniImageNet

# 5-way 5-shot
python main_DTN.py --N-way 5 --N-shot 5 --evaluate 1 --resume 'your_checkpoint/checkpoint.pth.tar'
# 5-way 1-shot
python main_DTN.py --N-way 5 --N-shot 1 --evaluate 1 --resume 'your_checkpoint/checkpoint.pth.tar'

License

DTN is released under the MIT license. See LICENSE for additional details.

Acknowledgment

Horizon Robotics

Thanks to the Third Party Libs

Pytorch

dtn's People

Contributors

yuxin-cv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dtn's Issues

I have some issues

Hi @Yuxin-CV
DTN is an inspired work and it's a very good idea. But I have some issues that hopefully will be replied. The experiment setting is not clearly explained in the paper. In your code, I find that your model is trained on the train_val joint splits, not only using the train splits as shown in common protocol. Not as described in the paper that "The hyper-parameters are optimized on the validation set". I also find that your model uses the 224x224 as the input, not 84x84. I don't know if you didn't mention this in your paper deliberately? I think your comparison is unfair. When I corrected the above two points and retried the experiment, I find that the accuracy was very poor. Can you give me some good advice?
Looking forward to your reply!

GeneratorNet forward pass

The forward pass of the GeneratorNet network and Net network (the feature extractor) multiply A_rebuild with self.s which is set to 10 and then passes it to the classifier.

Can you explain what this is? Why can't we pass it directly to the FC layer for classification?

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.