Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

DCGAN-tensorflow

> 编程语言
Open source

A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"

7.2K stars0 likes3 views
WebsiteGitHub

About

A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"

DCGAN in Tensorflow

Tensorflow implementation of Deep Convolutional Generative Adversarial Networks which is a stabilize Generative Adversarial Networks. The referenced torch code can be found here.

  • Brandon Amos wrote an excellent blog post and image completion code based on this repo.
  • To avoid the fast convergence of D (discriminator) network, G (generator) network is updated twice for each D network update, which differs from original paper.

Online Demo

link

Prerequisites

  • Python 2.7 or Python 3.3+
  • Tensorflow 0.12.1
  • SciPy
  • pillow
  • tqdm
  • (Optional) moviepy (for visualization)
  • (Optional) Align&Cropped Images.zip : Large-scale CelebFaces Dataset

Usage

First, download dataset with:

$ python download.py mnist celebA

To train a model with downloaded dataset:

$ python main.py --dataset mnist --input_height=28 --output_height=28 --train
$ python main.py --dataset celebA --input_height=108 --train --crop

To test with an existing model:

$ python main.py --dataset mnist --input_height=28 --output_height=28
$ python main.py --dataset celebA --input_height=108 --crop

Or, you can use your own dataset (without central crop) by:

$ mkdir data/DATASET_NAME
... add images to data/DATASET_NAME ...
$ python main.py --dataset DATASET_NAME --train
$ python main.py --dataset DATASET_NAME
$ # example
$ python main.py --dataset=eyes --input_fname_pattern="*_cropped.png" --train

If your dataset is located in a different root directory:

$ python main.py --dataset DATASET_NAME --data_dir DATASET_ROOT_DIR --train
$ python main.py --dataset DATASET_NAME --data_dir DATASET_ROOT_DIR
$ # example
$ python main.py --dataset=eyes --data_dir ../datasets/ --input_fname_pattern="*_cropped.png" --train

Results

celebA

After 6th epoch:

After 10th epoch:

Asian face dataset

MNIST

MNIST codes are written by @PhoenixDai.

More results can be found here and here.

Training details

Details of the loss of Discriminator and Generator (with custom dataset not celebA).

Details of the histogram of true and fake result of discriminator (with custom dataset not celebA).

Related works

  • BEGAN-tensorflow
  • DiscoGAN-pytorch
  • simulated-unsupervised-tensorflow

Author

Taehoon Kim / @carpedm20

Issues· 188 open

View all issuesOpen on GitHub
  • #399

    TypeError: '_FlagValues' object is not iterable

    Updated Sep 20, 2024
  • #398

    InvalidArgumentError (see above for traceback): Nan in summary histogram for: HistogramSummary_2 [[Node: HistogramSummary_2 = HistogramSummary[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](HistogramSummary_2/tag, discriminator_1/Sigmoid)]]

    Updated Dec 18, 2023
  • #311

    The data img_align_celeba.zip is not zip file.

    Updated Feb 10, 2023
  • #397

    How to generate larger images?

    Updated Jan 6, 2023
  • #162

    ValueError: could not broadcast input array from shape (96,96,4) into shape (96,96)

    Updated Sep 11, 2022
  • #254

    IndexError: list index out of range with custom dataset

    Updated Jul 20, 2022
  • #324

    TypeError: 'NoneType' object is not subscriptable

    Updated Jul 6, 2022
  • #394

    NameError:name 'PIL' is not defined

    Updated Jun 15, 2022
  • #396

    TypeError: 'NoneType' object is not subscriptable

    Updated Jun 5, 2022
  • #102

    Got error using my own data

    Updated Feb 25, 2022

> Tags

JavaScriptdcgangangenerative-modeltensorflow

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 22, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言