Skip to content

Implementation of a Deep Convolutional Generative Adversarial Network for CPU and GPU with Cuda

License

Notifications You must be signed in to change notification settings

obs145628/dcgan-cuda

Repository files navigation

CPU / GPU Implemention of a DCGAN in C++ / Cuda

Implementation of a DCGAN to generates faces, trained with the celebA dataset.

Requirements

For the CUDA version, you need:

  • GCC 8.0 or later
  • Cuda 9.2
  • At least 2.4GB of memory (GPU)

Build

You need to download the celebA dataset. (next section)

./bootstrap
cd _build
make

celebA dataset

You need to dowload the celebA dataset and to put it at ./celebA. Then run:

cd _build
python ../dcgan/preprocess.py

This command scales all the dataset, it might takes some time.

DCGAN

cd _build
RT_MODE=<mode> ./dcgan

Options:

  • --model : load a pretrained model if the file exists, and save the model during training
  • --train : train the network for several epochs
  • --generate : generate a sample of faces and save it to a jpg file

There is a pretrained model:

RT_MODE=GPU ./dcgan --generate visages.jpg --model ../models/pretained.tbin

Modes

To switch between the CPU/GPU execution, binaries must be run with:

RT_MODE=<mode> ./bin

Available modes:

  • CPU: monothreaded on CPU, default value
  • MCPU: multihreaded on CPU
  • GPU: cuda version

Testing

cd _build
make check

MNIST

Launch the MNIST classifier:

cd _build
RT_MODE=<mode> ./nn_mnist mnist.data

Basic network with dense layers, softmax cross entropy, and adam optimizer.

About

Implementation of a Deep Convolutional Generative Adversarial Network for CPU and GPU with Cuda

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •