/pytorch-MNIST-CelebA-cGAN-cDCGAN

Pytorch implementation of conditional Generative Adversarial Networks (cGAN) and conditional Deep Convolutional Generative Adversarial Networks (cDCGAN) for MNIST dataset

Primary LanguagePython

pytorch-MNIST-CelebA-cGAN-cDCGAN

Pytorch implementation of conditional Generative Adversarial Networks (cGAN) [1] and conditional Generative Adversarial Networks (cDCGAN) for MNIST [2] and CelebA [3] datasets.

Implementation details

  • cGAN

GAN

  • cDCGAN

Loss

Resutls

MNIST

  • Generate using fixed noise (fixed_z_)
cGAN cDCGAN
  • MNIST vs Generated images
MNIST cGAN after 50 epochs cDCGAN after 20 epochs
  • Learning Time
    • MNIST cGAN - Avg. per epoch: 9.13 sec; Total 50 epochs: 937.06 sec
    • MNIST cDCGAN - Avg. per epoch: 47.16 sec; Total 20 epochs: 1024.26 sec

CelebA

  • Generate using fixed noise (fixed_z_; odd line - female (y: 0) & even line - male (y: 1); each two lines have the same style (1-2) & (3-4).)
cDCGAN cDCGAN crop
  • CelebA vs Generated images
CelebA cDCGAN after 20 epochs cDCGAN crop after 30 epochs
  • CelebA cDCGAN morphing (noise interpolation)
cDCGAN cDCGAN crop
  • Learning Time
    • CelebA cDCGAN - Avg. per epoch: 826.69 sec; total 20 epochs ptime: 16564.10 sec

##图像纠偏 最常见的文本纠偏算法有两种,分别是

1.基于FFT变换以后频率域梯度 2.基于离散点求最小外接轮廓 这两种方法各有千秋,相对来说,第二种方法得到的结果更加准确,第一种基于离散傅立叶变换求振幅的方法有时候各种阈值选择在实际项目中会有很大问题。

Development Environment

  • Ubuntu 16.04 LTS
  • NVIDIA GTX 1080 ti
  • cuda 9.0
  • Python 3.6.2
  • certifi (2016.2.28)
  • cffi (1.10.0)
  • cycler (0.10.0)
  • imageio (2.4.1)
  • kiwisolver (1.0.1)
  • matplotlib (3.0.2)
  • mkl-fft (1.0.6)
  • mkl-random (1.0.1)
  • numpy (1.15.4)
  • olefile (0.44)
  • opencv-python (3.4.5.20)
  • Pillow (4.2.1)
  • pip (9.0.1)
  • pycparser (2.18)
  • pyparsing (2.3.0)
  • python-dateutil (2.7.5)
  • setuptools (36.4.0)
  • six (1.10.0)
  • torch (1.0.0)
  • torchvision (0.2.1)
  • wheel (0.29.0)
  • wincertstore (0.2)

Reference

[1] Mirza, Mehdi, and Simon Osindero. "Conditional generative adversarial nets." arXiv preprint arXiv:1411.1784 (2014).

(Full paper: https://arxiv.org/pdf/1411.1784.pdf)

[2] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. "Gradient-based learning applied to document recognition." Proceedings of the IEEE, 86(11):2278-2324, November 1998.

[3] Liu, Ziwei, et al. "Deep learning face attributes in the wild." Proceedings of the IEEE International Conference on Computer Vision. 2015.