DIVA: Domain Invariant Variational Autoencoder

Maximilian Ilse, Jakub M. Tomczak, Christos Louizos, Max Welling

Overview

Deep neural networks are notoriously brittle. They often achieve high accuracy by latching onto biases in their training data—like the specific lighting of a lab or the brand of a medical scanner—rather than learning the underlying concept. When these models are deployed in a new environment (a new "domain"), their performance often plummets because the biases they relied on have changed.

This is the challenge of domain generalization: how do we train a model on a set of known domains (e.g., five different hospitals) so that it works perfectly on a completely new, unseen domain (a sixth hospital)? This is particularly critical in fields like medical imaging, where data is scarce and expensive to label, but "domain labels" (like which hospital a scan came from) are often readily available.

To address this, researchers propose DIVA (Domain Invariant Variational Autoencoder), a generative model designed to solve the domain generalization problem by explicitly partitioning latent representations into three independent parts: class, domain, and object-specific features. By disentangling these factors, DIVA achieves state-of-the-art accuracy on unseen data distributions and uniquely leverages unlabeled data to further boost performance.

Methods: Partitioning the Latent Space

DIVA builds on the Variational Autoencoder (VAE) framework. The core idea is to force the model to "disentangle" the information it learns into three independent latent subspaces:

  1. $z_y$ (Class-specific): Captures information needed to identify the object (e.g., "this is a digit 7").
  2. $z_d$ (Domain-specific): Captures information about the environment (e.g., "this image is rotated 45 degrees").
  3. $z_x$ (Object-specific/Residual): Captures everything else, like line thickness or handwriting style.
Generative model of DIVA showing the partitioned latent spaces.

To ensure this separation actually happens, DIVA uses auxiliary classifiers during training. One classifier tries to predict the domain from $z_d$, and another tries to predict the class from $z_y$.

Because DIVA is a generative model, it can also handle semi-supervised learning. If you have images without class labels, the model can still use them to learn better domain and style representations, which indirectly helps the classification task.

Key Insights and Ideas

  • Independence as a Prior: By assuming the class, domain, and style are independent, the model is guided to ignore domain shifts when it's time to classify. If $z_y$ truly contains no information about the rotation ($z_d$), the classifier becomes "domain invariant."
  • Generative vs. Discriminative: Most domain generalization methods are purely discriminative (focused only on the label). By being generative, DIVA learns the underlying distribution of the data, which makes it much more robust and allows it to use unlabeled data—a huge advantage in real-world "small data" scenarios like medicine.
  • The Power of Unlabeled Data: The paper shows that even if you don't have labels for a new domain, just seeing the images allows the model to "understand" the new domain's characteristics, which significantly improves its ability to classify correctly.

Datasets and Key Results

The primary benchmark used to evaluate DIVA is Rotated MNIST. The task is to classify digits 0-9 across six different domains, represented by rotation angles (0°, 15°, 30°, 45°, 60°, and 75°). The model is trained on five of these rotations and tested on the sixth, which it has never seen before.

State-of-the-Art Performance

DIVA consistently outperformed existing methods like Domain Adversarial neural networks (DA) and other recent benchmarks (HEX, ADV). On the Rotated MNIST task, DIVA achieved an average accuracy of 97.2%, compared to 94.3%–95.8% for competing models.

Successful Disentanglement

Qualitative visualizations of the learned embeddings proved that the model successfully separated the features. The $z_y$ subspace clustered perfectly by digit class regardless of rotation, while the $z_d$ subspace clustered by rotation angle regardless of the digit. Meanwhile, $z_x$ successfully captured style elements like line thickness.

Latent space $z_y$ perfectly clustered by digit class, demonstrating successful disentanglement.

Semi-Supervised Boost

Adding unlabeled data further improved results. For example, when testing on the 0° domain, adding 9x more unlabeled data improved accuracy from 93.5% to 93.8%.

Limitations and Future Work

The authors acknowledge that while DIVA performs exceptionally well on Rotated MNIST, this is a relatively simple dataset. The "real test" will be applying DIVA to more complex, high-dimensional data like 3D medical scans or natural images with complex backgrounds. Future work involves evaluating DIVA on these more challenging datasets and exploring how the partitioning of latent spaces can be further refined for even more complex sources of variation.

Summary updated

BibTeX
@inproceedings{ilse2020diva,
  author = {Maximilian Ilse and Jakub M. Tomczak and Christos Louizos and Max Welling},
  title = {{DIVA: Domain Invariant Variational Autoencoder}},
  booktitle = {MIDL},
  year = {2020},
  url = {https://openreview.net/forum?id=dlh7VuaaZg},
}
Figure