Official implementation of the paper "Topographic VAEs learn Equivariant Capsules"

Overview

Topographic Variational Autoencoder

Paper: https://arxiv.org/abs/2109.01394

Getting Started

Install requirements with Anaconda:

conda env create -f environment.yml

Activate the conda environment

conda activate tvae

Install the tvae package

Install the tvae package inside of your conda environment. This allows you to run experiments with the tvae command. At the root of the project directory run (using your environment's pip): pip3 install -e .

If you need help finding your environment's pip, try which python, which should point you to a directory such as .../anaconda3/envs/tvae/bin/ where it will be located.

(Optional) Setup Weights & Biases:

This repository uses Weight & Biases for experiment tracking. By deafult this is set to off. However, if you would like to use this (highly recommended!) functionality, all you have to do is set 'wandb_on': True in the experiment config, and set your account's project and entity names in the tvae/utils/logging.py file.

For more information on making a Weight & Biases account see (creating a weights and biases account) and the associated quickstart guide.

Running an experiment

To rerun the experiment from Figure 3, you can run:

  • tvae --name 'tvae_2d_mnist'

To rerun the experiments from Figure 4, you can run:

  • tvae --name 'tvae_Lpartial_mnist'
  • tvae --name 'tvae_Lpartial_dsprites'

To rerun the experiments from Tables 1, you can run:

  • tvae --name 'tvae_Lhalf_mnist'
  • tvae --name 'tvae_Lshort_mnist'
  • tvae --name 'bubbles_mnist'
  • tvae --name 'tvae_L0_mnist'
  • tvae --name 'nontvae_mnist'

To rerun the experiments from Tables 2, you can run:

  • tvae --name 'tvae_Lhalf_dsprites'
  • tvae --name 'tvae_Lpartial_dsprites'
  • tvae --name 'tvae_Lshort_dsprites'
  • tvae --name 'bubbles_dsprites'
  • tvae --name 'tvae_L0_dsprites'
  • tvae --name 'nontvae_dsprites'

To rerun the generalization experiment described in Section B.4 (resulting in Figures 1 and 6), you can run:

  • tvae --name 'tvae_Lpartial_mnist_generalization'

To rerun the experiments from Figures 22 and 23 (training on complex combined transformations), you can run:

  • tvae --name 'tvae_Lpartial_perspective_mnist'
  • tvae --name 'tvae_Lpartial_rotcolor_mnist'

Basics of the framework

  • All models are built using the TVAE module (see tvae/containers/tvae.py) which requires a z-encoder, a u-encoder, a decoder, and a 'grouper'. The grouper module defines the topographic structure of the latent space through a model (equivalent to W in the paper), and a padder which defines the boundary conditions.
  • All experiments can be found in tvae/experiments/, and begin with the model specification, followed by the experiment config where important values such as L (group_kernel) and K (n_off_diag) can be set.

Model Architecutre Options

  • 'n_caps': int, Number of independnt capsules
  • 'cap_dim': int, Size of each capsule
  • 'n_transforms': int, Length of the total transformation sequence (denoted S in the paper)
  • 'mu_init': int, Initalization value for mu parameter
  • 'n_off_diag': int, determines the spatial extent of the grouping within a single timestep (denoted K in the paper), n_off_diag=1 gives K=3, while n_off_diag=0 gives K=1.
  • 'group_kernel': tuple of int, defines the size of the kernel used by the grouper, exact definition and relationship to W varies for each experiment.

Training Options

  • 'wandb_on': bool, if True, use weights & biases logging
  • 'lr': float, learning rate
  • 'momentum': float, standard momentum used in SGD
  • 'max_epochs': int, total training epochs
  • 'eval_epochs': int, epochs between evaluation on the test (for MNIST)
  • 'batch_size': int, number of samples per batch
  • 'n_is_samples': int, number of importance samples when computing the log-likelihood on MNIST.
  • 'max_transform_len': int, (for dSprites) controls the subset of the dataset

Acknowledgements

The Robert Bosch GmbH is acknowledged for financial support.

You might also like...
Official implementation for NIPS'17 paper: PredRNN: Recurrent Neural Networks for Predictive Learning Using Spatiotemporal LSTMs.
Official implementation for NIPS'17 paper: PredRNN: Recurrent Neural Networks for Predictive Learning Using Spatiotemporal LSTMs.

PredRNN: A Recurrent Neural Network for Spatiotemporal Predictive Learning The predictive learning of spatiotemporal sequences aims to generate future

[PyTorch] Official implementation of CVPR2021 paper
[PyTorch] Official implementation of CVPR2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency". https://arxiv.org/abs/2103.05465

PointDSC repository PyTorch implementation of PointDSC for CVPR'2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency",

This is an official implementation of our CVPR 2021 paper "Bottom-Up Human Pose Estimation Via Disentangled Keypoint Regression" (https://arxiv.org/abs/2104.02300)

Bottom-Up Human Pose Estimation Via Disentangled Keypoint Regression Introduction In this paper, we are interested in the bottom-up paradigm of estima

The official pytorch implementation of our paper "Is Space-Time Attention All You Need for Video Understanding?"

TimeSformer This is an official pytorch implementation of Is Space-Time Attention All You Need for Video Understanding?. In this repository, we provid

PixelPick This is an official implementation of the paper
PixelPick This is an official implementation of the paper "All you need are a few pixels: semantic segmentation with PixelPick."

PixelPick This is an official implementation of the paper "All you need are a few pixels: semantic segmentation with PixelPick." [Project page] [Paper

Official implementation of GraphMask as presented in our paper Interpreting Graph Neural Networks for NLP With Differentiable Edge Masking.

GraphMask This repository contains an implementation of GraphMask, the interpretability technique for graph neural networks presented in our ICLR 2021

The official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averaging Approach

Graph Optimizer This repo contains the official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averagin

Official Pytorch Implementation of:
Official Pytorch Implementation of: "ImageNet-21K Pretraining for the Masses"(2021) paper

ImageNet-21K Pretraining for the Masses Paper | Pretrained models Official PyTorch Implementation Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, Lihi Zelni

The official PyTorch implementation of the paper: *Xili Dai, Xiaojun Yuan, Haigang Gong, Yi Ma.
The official PyTorch implementation of the paper: *Xili Dai, Xiaojun Yuan, Haigang Gong, Yi Ma. "Fully Convolutional Line Parsing." *.

F-Clip — Fully Convolutional Line Parsing This repository contains the official PyTorch implementation of the paper: *Xili Dai, Xiaojun Yuan, Haigang

Comments
  • Environment Versions

    Environment Versions

    Could you please share the versions for the requirements you used in the environment. Unfortunately the experiments do not work with the latest Kordia 0.6.3 version.

    opened by narnhold 1
  • Remove ** from file names and remove ' from commands

    Remove ** from file names and remove ' from commands

    When running tvae --name tvae_Lpartial_dsprites I got an error due to asterisk not being a valid file name character. OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\Users\admin\AppData\Local\Temp\2\tmp04_mzg52wandb-media\2n3e0t4i.png' -> 'c:\data\topographicvae-master\tvae\utils\wandb\run-20210921_085842-9scmcop8\files\media\images\Covariance_S**2_batch_5_b05a7d100c7773fd09bf.png'

    The readme had extra apostrophe's.

    opened by banditbandito 0
Owner
T. Andy Keller
PhD Student at UvA
T. Andy Keller
Official implementation of AAAI-21 paper "Label Confusion Learning to Enhance Text Classification Models"

Description: This is the official implementation of our AAAI-21 accepted paper Label Confusion Learning to Enhance Text Classification Models. The str

null 101 Nov 25, 2022
Official PyTorch implementation for paper Context Matters: Graph-based Self-supervised Representation Learning for Medical Images

Context Matters: Graph-based Self-supervised Representation Learning for Medical Images Official PyTorch implementation for paper Context Matters: Gra

null 49 Nov 23, 2022
Official implementation of the ICLR 2021 paper

You Only Need Adversarial Supervision for Semantic Image Synthesis Official PyTorch implementation of the ICLR 2021 paper "You Only Need Adversarial S

Bosch Research 272 Dec 28, 2022
Official implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis https://arxiv.org/abs/2011.13775

CIPS -- Official Pytorch Implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis Requirements pip install -r requi

Multimodal Lab @ Samsung AI Center Moscow 201 Dec 21, 2022
Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".

HiSD: Image-to-image Translation via Hierarchical Style Disentanglement Official pytorch implementation of paper "Image-to-image Translation

null 364 Dec 14, 2022
Official pytorch implementation of paper "Inception Convolution with Efficient Dilation Search" (CVPR 2021 Oral).

IC-Conv This repository is an official implementation of the paper Inception Convolution with Efficient Dilation Search. Getting Started Download Imag

Jie Liu 111 Dec 31, 2022
Official implementation of our paper "LLA: Loss-aware Label Assignment for Dense Pedestrian Detection" in Pytorch.

LLA: Loss-aware Label Assignment for Dense Pedestrian Detection This project provides an implementation for "LLA: Loss-aware Label Assignment for Dens

null 35 Dec 6, 2022
This project is the official implementation of our accepted ICLR 2021 paper BiPointNet: Binary Neural Network for Point Clouds.

BiPointNet: Binary Neural Network for Point Clouds Created by Haotong Qin, Zhongang Cai, Mingyuan Zhang, Yifu Ding, Haiyu Zhao, Shuai Yi, Xianglong Li

Haotong Qin 59 Dec 17, 2022
Official implementation of our CVPR2021 paper "OTA: Optimal Transport Assignment for Object Detection" in Pytorch.

OTA: Optimal Transport Assignment for Object Detection This project provides an implementation for our CVPR2021 paper "OTA: Optimal Transport Assignme

null 217 Jan 3, 2023
This is the official PyTorch implementation of the paper "TransFG: A Transformer Architecture for Fine-grained Recognition" (Ju He, Jie-Neng Chen, Shuai Liu, Adam Kortylewski, Cheng Yang, Yutong Bai, Changhu Wang, Alan Yuille).

TransFG: A Transformer Architecture for Fine-grained Recognition Official PyTorch code for the paper: TransFG: A Transformer Architecture for Fine-gra

Ju He 307 Jan 3, 2023