{"id":18317333,"url":"https://github.com/compvis/iin","last_synced_at":"2025-07-08T19:06:53.940Z","repository":{"id":65983449,"uuid":"251446869","full_name":"CompVis/iin","owner":"CompVis","description":"A Disentangling Invertible Interpretation Network","archived":false,"fork":false,"pushed_at":"2021-05-12T08:08:12.000Z","size":19894,"stargazers_count":121,"open_issues_count":10,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-21T12:06:58.807Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://compvis.github.io/iin/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CompVis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-30T22:55:36.000Z","updated_at":"2025-01-09T23:55:17.000Z","dependencies_parsed_at":"2023-02-19T19:16:03.865Z","dependency_job_id":null,"html_url":"https://github.com/CompVis/iin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CompVis%2Fiin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CompVis%2Fiin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CompVis%2Fiin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CompVis%2Fiin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CompVis","download_url":"https://codeload.github.com/CompVis/iin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406080,"owners_count":20933803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T18:05:46.535Z","updated_at":"2025-04-05T21:32:16.490Z","avatar_url":"https://github.com/CompVis.png","language":"Python","readme":"# A Disentangling Invertible Interpretation Network for Explaining Latent Representations\n\nPyTorch code accompanying the [CVPR 2020](http://cvpr2020.thecvf.com/) paper\n\n[**A Disentangling Invertible Interpretation Network for Explaining Latent Representations**](https://compvis.github.io/iin/)\u003cbr/\u003e\n[Patrick Esser](https://github.com/pesser)\\*,\n[Robin Rombach](https://github.com/rromb)\\*,\n[Björn Ommer](https://hci.iwr.uni-heidelberg.de/Staff/bommer)\u003cbr/\u003e\n\\* equal contribution\n\n![teaser](assets/mnist.gif)\u003cbr/\u003e\n[arXiv](https://arxiv.org/abs/2004.13166) | [BibTeX](#bibtex) | [Project Page](https://compvis.github.io/iin/)\n\n\nTable of Contents\n=================\n\n* [Requirements](#requirements)\n* [Data](#data)\n* [Training](#training)\n   * [Autoencoders](#autoencoders)\n   * [Classifiers](#classifiers)\n   * [Invertible Interpretation Networks](#invertible-interpretation-networks)\n      * [Unsupervised](#unsupervised)\n      * [Supervised](#supervised)\n* [Evaluation](#evaluation)\n* [Pretrained Models](#pretrained-models)\n* [Results](#results)\n* [BibTeX](#bibtex)\n\n\n## Requirements\nA suitable [conda](https://conda.io/) environment named `iin` can be created\nand activated with:\n\n```\nconda env create -f environment.yaml\nconda activate iin\n```\n\nOptionally, you can then also `conda install tensorflow-gpu=1.14` to speed up\nFID evaluations.\n\n\n## Data\n`MNIST`, `FashionMNIST` and `CIFAR10` will be downloaded automatically the\nfirst time they are used and `CelebA` will prompt you to download it. The\ncontent of each dataset can be visualized with\n\n```\nedexplore --dataset iin.data.\u003cdataset\u003e\n```\n\nwhere `\u003cdataset\u003e` is one of `MNISTTrain`, `MNISTTest`, `FashionMNISTTrain`,\n`FashionMNISTTest`, `CIFAR10Train`, `CIFAR10Test`, `CelebATrain`, `CelebATest`,\n`FactorCelebATrain`, `FactorCelebATest`, `ColorfulMNISTTrain`,\n`ColorfulMNISTTest`, `SingleColorfulMNISTTrain`, `SingleColorfulMNISTTest`.\n\n\n## Training\n\n### Autoencoders\nTo train autoencoders, run\n\n```\nedflow -b configs/\u003cdataset\u003e_ae.yaml -t\n```\n\nwhere `\u003cdataset\u003e` is one of `mnist`, `fashionmnist`, `cifar`, `celeba`,\n`cmnist`. To enable logging to [wandb](https://wandb.ai), adjust\n`configs/project.yaml` and add it to above command:\n\n```\nedflow -b configs/\u003cdataset\u003e_ae.yaml configs/project.yaml -t\n```\n\n### Classifiers\nTo train a classifier on `ColorfulMNIST`, run\n\n```\nedflow -b configs/cmnist_clf.yaml -t\n```\n\nOnce you have a checkpoint, you can estimate factor dimensionalities using\n\n```\nedflow -b configs/cmnist_clf.yaml configs/cmnist_dimeval.yaml -c \u003cpath to .ckpt\u003e\n```\n\nFor the pretrained classifier, this gives\n\n```\n[INFO] [dim_callback]: estimated factor dimensionalities: [22, 11, 31]\n```\n\nand to compare this to an autoencoder, run\n\n```\nedflow -b configs/cmnist_ae.yaml configs/cmnist_dimeval.yaml -c \u003cpath to cmnist ae .ckpt\u003e\n```\n\nwhich gives\n\n```\n[INFO] [dim_callback]: estimated factor dimensionalities: [13, 17, 34]\n```\n\n### Invertible Interpretation Networks\n#### Unsupervised on AE\nTo train unsupervised invertible interpretation networks, run\n\n```\nedflow -b configs/\u003cdataset\u003e_iin.yaml [configs/project.yaml] -t\n```\n\nwhere `\u003cdataset\u003e` is one of `mnist`, `fashionmnist`, `cifar`, `celeba`. If,\ninstead of using one of the [pretrained models](#pretrained-models), you\ntrained an autoencoder yourself, adjust the `first_stage` config section\naccordingly.\n\n#### Supervised\nFor supervised, disentangling IINs, run\n\n```\nedflow -b configs/\u003cdataset\u003e_diin.yaml [configs/project.yaml] -t\n```\n\nwhere `\u003cdataset\u003e` is one of `cmnist` or `celeba`, or run\n\n```\nedflow -b configs/cmnist_clf_diin.yaml [configs/project.yaml] -t\n```\n\nto train a dIIN on top of a classifier, with factor dimensionalities as\nestimated above (dimensionalities of factors can be adjusted via the\n`Transformer/factor_config` configuration entry).\n\n\n## Evaluation\n\nEvaluations run automatically after each epoch of training. To start an\nevaluation manually, run\n\n```\nedflow -p logs/\u003clog_folder\u003e/configs/\u003cconfig\u003e.yaml\n```\n\nand, optionally, add `-c \u003cpath to checkpoint\u003e` to evaluate a specific\ncheckpoint instead of the last one.\n\n\n## Pretrained Models\nDownload [`logs.tar.gz`](https://heibox.uni-heidelberg.de/f/0c76b38bf4274448b8e9/)\n(~2.2 GB) and extract the pretrained models:\n\n```\ntar xzf logs.tar.gz\n```\n\n\n## Results\nUsing spectral normalization for the discriminator, this code slightly improves\nupon the values reported in Tab. 2 of the paper.\n\n| Dataset      | Checkpoint | FID    |\n|--------------|------------|--------|\n| MNIST        | 105600     | 5.252  |\n| FashionMNIST | 110400     | 9.663  |\n| CelebA       | 84643      | 19.839 |\n| CIFAR10      | 32000      | 38.697 |\n\nFull training logs can be found on [Weights \u0026\nBiases](https://app.wandb.ai/trex/iin/reportlist).\n\n\n## BibTeX\n\n```\n@inproceedings{esser2020invertible,\n  title={A Disentangling Invertible Interpretation Network for Explaining Latent Representations},\n  author={Esser, Patrick and Rombach, Robin and Ommer, Bj{\\\"o}rn},\n  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},\n  year={2020}\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompvis%2Fiin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompvis%2Fiin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompvis%2Fiin/lists"}