Code Monkey home page Code Monkey logo

cmvae's Introduction

CMVAE: Causal Meta VAE For Unsupervised Meta-Learning

This is the Pytorch implementation for the CMVAE

Dependencies

This code is written in Python. Dependencies include

  • python >= 3.6
  • pytorch = 1.4 or 1.7
  • tqdm, wandb

Data

  • Download Omniglot data from here.
  • Download pretrained features for Mini-ImageNet from here.
  • Download pretrained features for CelebA from here.
  • (Optional) If you want to train SimCLR from scratch, download images for ImageNet from here amd CelebA here

data directory should be look like this:

data/

├── omiglot/
  ├── train.npy
  ├── val.npy
  └── test.npy
  
├── mimgnet/
  ├── train_features.npy
  ├── val_features.npy
  └── test_features.npy
 
├── celeba/
  ├── train_features.npy
  ├── val_features.npy
  └── test_features.npy
    
└── imgnet or celeba_imgs/ -> (optional) if you want to train SimCLR from scratch
  ├── images/
    ├── n0210891500001298.jpg  
    ├── n0287152500001298.jpg 
	       ...
    └── n0236282200001298.jpg 
  ├── train.csv
  ├── val.csv
  └── test.csv

Experiment

To reproduce Omniglot 5-way experiment for CMVAE, run the following code:

cd omniglot
python main.py --data-dir DATA DIRECTORY   --save-dir SAVE DIRECTORY  --way 5 --sample-size 200

To reproduce Omniglot 20-way experiment for CMVAE, run the following code:

cd omniglot
python main.py --data-dir DATA DIRECTORY   --save-dir SAVE DIRECTORY   --way 20 --sample-size 300

To reproduce Mini-ImageNet 5-way experiment for CMVAE, run the following code:

cd mimgnet
python main.py --data-dir DATA DIRECTORY   --save-dir SAVE DIRECTORY  

To reproduce CelebA 5-way experiment for CMVAE, run the following code:

cd celeba
python main.py --data-dir DATA DIRECTORY   --save-dir SAVE DIRECTORY  

(Optional) To reproduce SimCLR features for Mini-ImageNet, run the following code:

cd simclr
python main.py --data-dir DATA DIRECTORY  --save-dir SAVE DIRECTORY   --feature-save-dir FEATURE SAVE DIRECTORY  

Acknowledgments

Our work and code benefit from two existing works, which we are very grateful.
Meta-GMVAE
notears

cmvae's People

Contributors

guodongqi 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.