Git Product home page Git Product logo

invariances's Introduction

Making Sense of CNNs: Interpreting Deep Representations & Their Invariances with Invertible Neural Networks

PyTorch code accompanying the ECCV 2020 paper

Making Sense of CNNs: Interpreting Deep Representations & Their Invariances with Invertible Neural Networks
Robin Rombach*, Patrick Esser*, Björn Ommer
* equal contribution

teaser
arXiv | BibTeX | Project Page

Table of Contents

Requirements

A suitable conda environment named invariances can be created and activated with:

conda env create -f environment.yaml
conda activate invariances

Optionally, you can then also conda install tensorflow-gpu=1.14 to speed up FID evaluations.

Demos

teaser

To get started you can directly dive into some demos. After installing the requirements as described above, simply run

streamlit run invariances/demo.py

Please note that checkpoints will be downloaded on demand, which can take a while. You can see the download progress displayed in the terminal running the streamlit command.

We provide demonstrations on

  • visualization of adversarial attacks
  • visualization of network representations and their invariances
  • revealing the texture bias of ImageNet-CNNs
  • visualizing invariances from a video (resulting in image to video translation)
  • image mixing via their network representations

Note that all of the provided demos can be run without a dataset, and you can add your own images into data/custom.

Training

Data

If not present on your disk, all required datasets (ImageNet, AnimalFaces and ImageNetAnimals) will be downloaded and prepared automatically. The data processing and loading rely on the autoencoders package and are described in more detail here.

Note: If you already have one or more of the datasets present, follow the instructions linked above to avoid downloading them again.

Invariances of Classifiers

ResNet

To recover invariances of an ResNet classifier trained on the AnimalFaces dataset, run

edflow -b configs/resnet/animalfaces/base.yaml configs/resnet/animalfaces/train/<layer>.yaml -t

where <layer> is one of input, maxpool, layer1, layer2, layer3, layer4, avgpool, fc, softmax. To enable logging to wandb, adjust configs/project.yaml and add it to above command:

edflow -b configs/resnet/animalfaces/base.yaml configs/resnet/animalfaces/train/<layer>.yaml configs/project.yaml -t

AlexNet

To reproduce the training procedure from the paper, run

edflow -b configs/alexnet/base_train.yaml configs/alexnet/train/<layer>.yaml -t

where <layer> is one of conv5, fc6, fc7, fc8, softmax. To enable logging to wandb, adjust configs/project.yaml and add it to above command:

edflow -b configs/alexnet/base_train.yaml configs/alexnet/train/<layer>.yaml configs/project.yaml -t

Evaluation

Evaluations run automatically after each epoch of training. To start an evaluation manually, run

edflow -p logs/<log_folder>/configs/<config>.yaml

and, optionally, add -c <path to checkpoint> to evaluate a specific checkpoint instead of the last one.

Pretrained Models

Pretrained models (e.g. autoencoders and classifiers) will be downloaded automatically on their first use in a demo, training or evaluation script.

BibTeX

@inproceedings{rombach2020invariances,
  title={Making Sense of CNNs: Interpreting Deep Representations \& Their Invariances with INNs},
  author={Rombach, Robin and Esser, Patrick and Ommer, Bj{\"o}rn},
  booktitle={Proceedings of the European Conference on Computer Vision},
  year={2020}
}

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.