This is the code used for two domain adaptation papers.
The `domain_separation` directory contains code for the "Domain Separation
Networks" paper by Bousmalis K., Trigeorgis G., et al. which was presented at
NIPS 2016. The paper can be found here: https://arxiv.org/abs/1608.06019.
## Introduction
The `pixel_domain_adaptation` directory contains the code used for the
This code is the code used for the "Domain Separation Networks" paper
"Unsupervised Pixel-Level Domain Adaptation with Generative Adversarial
by Bousmalis K., Trigeorgis G., et al. which was presented at NIPS 2016. The
Networks" paper by Bousmalis K., et al. (presented at CVPR 2017). The paper can
paper can be found here: https://arxiv.org/abs/1608.06019.
be found here: https://arxiv.org/abs/1612.05424. PixelDA aims to perform domain
adaptation by transfering the visual style of the target domain (which has few
or no labels) to a source domain (which has many labels). This is accomplished
using a Generative Adversarial Network (GAN).
## Contact
## Contact
This code was open-sourced by [Konstantinos Bousmalis](https://github.com/bousmalis)(konstantinos@google.com).
The domain separation code was open-sourced
by [Konstantinos Bousmalis](https://github.com/bousmalis)
(konstantinos@google.com), while the pixel level domain adaptation code was
open-sourced by [David Dohan](https://github.com/dmrd)(ddohan@google.com).
## Installation
## Installation
You will need to have the following installed on your machine before trying out the DSN code.
You will need to have the following installed on your machine before trying out the DSN code.
...
@@ -16,26 +26,70 @@ You will need to have the following installed on your machine before trying out
...
@@ -16,26 +26,70 @@ You will need to have the following installed on your machine before trying out
* Bazel: https://bazel.build/
* Bazel: https://bazel.build/
## Important Note
## Important Note
Although we are making the code available, you are only able to use the MNIST
We are working to open source the pose estimation dataset. For now, the MNIST to
provider for now. We will soon provide a script to download and convert MNIST-M
MNIST-M dataset is available. Check back here in a few weeks or wait for a
as well. Check back here in a few weeks or wait for a relevant announcement from
relevant announcement from [@bousmalis](https://twitter.com/bousmalis).
[@bousmalis](https://twitter.com/bousmalis).
## Running the code for adapting MNIST to MNIST-M
## Initial setup
In order to run the MNIST to MNIST-M experiments with DANNs and/or DANNs with
In order to run the MNIST to MNIST-M experiments, you will need to set the
domain separation (DSNs) you will need to set the directory you used to download
data directory:
MNIST and MNIST-M:
```
```
$ export DSN_DATA_DIR=/your/dir
$ export DSN_DATA_DIR=/your/dir
```
```
Add models and models/slim to your `$PYTHONPATH`:
Add models and models/slim to your `$PYTHONPATH` (assumes $PWD is /models):
```
```
$ export PYTHONPATH=$PYTHONPATH:$PWD:$PWD/slim
$ export PYTHONPATH=$PYTHONPATH:$PWD:$PWD/slim
```
```
## Getting the datasets
You can fetch the MNIST data by running
```
$ bazel run slim:download_and_convert_data -- --dataset_dir $DSN_DATA_DIR --dataset_name=mnist
```
The MNIST-M dataset is available online [here](http://bit.ly/2nrlUAJ). Once it is downloaded and extracted into your data directory, create TFRecord files by running:
```
$ bazel run domain_adaptation/datasets:download_and_convert_mnist_m -- --dataset_dir $DSN_DATA_DIR
```
# Running PixelDA from MNIST to MNIST-M
You can run PixelDA as follows (using Tensorboard to examine the results):