Commit 9c6eb092 authored by Yuxin Wu's avatar Yuxin Wu

update gan notes

parent 34da9a1f
...@@ -60,7 +60,7 @@ The components are designed to be independent. You can use Model or DataFlow in ...@@ -60,7 +60,7 @@ The components are designed to be independent. You can use Model or DataFlow in
pip install --user -r requirements.txt pip install --user -r requirements.txt
pip install --user -r opt-requirements.txt (some optional dependencies, you can install later if needed) pip install --user -r opt-requirements.txt (some optional dependencies, you can install later if needed)
``` ```
+ Enable `import tensorpack`: + Enable `import tensorpack` (or use `greadlink` from `coreutils` brew package if you're on OSX):
``` ```
export PYTHONPATH=$PYTHONPATH:`readlink -f path/to/tensorpack` export PYTHONPATH=$PYTHONPATH:`readlink -f path/to/tensorpack`
``` ```
......
...@@ -42,6 +42,11 @@ class RandomZData(DataFlow): ...@@ -42,6 +42,11 @@ class RandomZData(DataFlow):
yield [np.random.uniform(-1, 1, size=self.shape)] yield [np.random.uniform(-1, 1, size=self.shape)]
def build_GAN_losses(vecpos, vecneg): def build_GAN_losses(vecpos, vecneg):
"""
:param vecpos, vecneg: output of the discriminator (logits) for real
and fake images.
:return: (loss of G, loss of D)
"""
sigmpos = tf.sigmoid(vecpos) sigmpos = tf.sigmoid(vecpos)
sigmneg = tf.sigmoid(vecneg) sigmneg = tf.sigmoid(vecneg)
tf.summary.histogram('sigmoid-pos', sigmpos) tf.summary.histogram('sigmoid-pos', sigmpos)
......
...@@ -8,7 +8,7 @@ Reproduce the following GAN-related papers: ...@@ -8,7 +8,7 @@ Reproduce the following GAN-related papers:
+ InfoGAN: Interpretable Representation Learning by Information Maximizing GAN. [paper](https://arxiv.org/abs/1606.03657) + InfoGAN: Interpretable Representation Learning by Information Maximizing GAN. [paper](https://arxiv.org/abs/1606.03657)
See the docstring in each script for detailed usage. Detailed usage is in the docstring of each script.
## DCGAN-CelebA.py ## DCGAN-CelebA.py
...@@ -26,12 +26,16 @@ Play with the [pretrained model](https://drive.google.com/drive/folders/0B9IPQTv ...@@ -26,12 +26,16 @@ Play with the [pretrained model](https://drive.google.com/drive/folders/0B9IPQTv
## Image2Image.py ## Image2Image.py
Reproduce Image-to-Image following the setup in [pix2pix](https://github.com/phillipi/pix2pix). Image-to-Image following the setup in [pix2pix](https://github.com/phillipi/pix2pix).
It requires the datasets released by the original authors. It requires the datasets released by the original authors.
With the cityscapes dataset, it learns to generate semantic segmentation map of urban scene:
![im2im](demo/im2im-cityscapes.jpg)
## InfoGAN-mnist.py ## InfoGAN-mnist.py
Reproduce a mnist experiement in InfoGAN. Reproduce one mnist experiement in InfoGAN.
By assuming 10 latent variables corresponding to a categorical distribution and maximizing mutual information, By assuming 10 latent variables corresponding to a categorical distribution and maximizing mutual information,
the network learns to map the 10 variables to 10 digits in a completely unsupervised way. the network learns to map the 10 variables to 10 digits in a completely unsupervised way.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment