MCPcopy
hub / github.com/carpedm20/DCGAN-tensorflow

github.com/carpedm20/DCGAN-tensorflow @main sqlite

repository ↗ · DeepWiki ↗
110 symbols 249 edges 9 files 2 documented · 2%
README

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.

alt tag

  • 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

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

result

celebA

After 6th epoch:

result3

After 10th epoch:

result4

Asian face dataset

custom_result1

custom_result1

custom_result2

MNIST

MNIST codes are written by @PhoenixDai.

mnist_result1

mnist_result2

mnist_result3

More results can be found here and here.

Training details

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

d_loss

g_loss

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

d_hist

d__hist

Related works

Author

Taehoon Kim / @carpedm20

Core symbols most depended-on inside this repo

getopt
called by 18
web/js/convnet.js
conv_out_size_same
called by 16
model.py
deconv2d
called by 12
ops.py
linear
called by 9
ops.py
concat
called by 7
ops.py
lrelu
called by 7
ops.py
conv_cond_concat
called by 6
ops.py
conv2d
called by 6
ops.py

Shape

Function 94
Method 13
Class 2
Route 1

Languages

TypeScript51%
Python49%

Modules by API surface

web/js/convnet.js37 symbols
web/js/app.js19 symbols
utils.py17 symbols
model.py14 symbols
download.py11 symbols
ops.py9 symbols
web/app.py2 symbols
main.py1 symbols

For agents

$ claude mcp add DCGAN-tensorflow \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact