{"nbformat": 4, "cells": [{"source": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Generative Adversarial Network (GAN)\n\nGenerative Adversarial Networks (GANs) are a class of algorithms used in unsupervised learning - you don't need labels for your dataset in order to train a GAN.\n\nThe GAN framework is composed of two neural networks: a Generator network and a Discriminator network.\n\nThe Generator's job is to take a set of random numbers and produce the data (such as images or text).\n\nThe Discriminator then takes in that data as well as samples of that data from a dataset and tries to determine if it is \"fake\" (created by the Generator network) or \"real\" (from the original dataset).\n\nDuring training, the two networks play a game against each other. The Generator tries to create realistic data, so that it can fool the Discriminator into thinking that the data it generated is from the original dataset. At the same time, the Discriminator tries to not be fooled - it learns to become better at determining if data is real or fake.\n\nSince the two networks are fighting in this game, they can be seen as as adversaries, which is where the term \"Generative Adversarial Network\" comes from.\n\n## Deep Convolutional Generative Adversarial Networks\n\nThis tutorial takes a look at Deep Convolutional Generative Adversarial Networks (DCGAN), which combines Convolutional Neural Networks (CNNs) and GANs.\n\nWe will create a DCGAN that is able to create images of handwritten digits from random numbers. The tutorial uses the neural net architecture and guidelines outlined in [this paper](https://arxiv.org/abs/1511.06434), and the MNIST dataset.\n\n## How to Use This Tutorial\nYou can use this tutorial by executing each snippet of python code in order as it appears in the tutorial.\n\n\n1. The first net is the \"Generator\" and creates images of handwritten digits from random numbers.\n2. The second net is the \"Discriminator\" and determines if the image created by the Generator is real (a realistic looking image of handwritten digits) or fake (an image that does not look like it is from the original dataset).\n\nApart from creating a DCGAN, you'll also learn:\n\n- How to manipulate and iterate through batches of image data that you can feed into your neural network.\n\n- How to create a custom MXNet data iterator that generates random numbers from a normal distribution.\n\n- How to create a custom training process in MXNet, using lower level functions from the MXNet Module API such as .bind() .forward() and .backward(). The training process for a DCGAN is more complex than many other neural networks, so we need to use these functions instead of using the higher level .fit() function.\n\n- How to visualize images as they are going through the training process\n\n## Prerequisites\n\nThis tutorial assumes you are familiar with the concepts of CNNs and have implemented one in MXNet. You should also be familiar with the concept of logistic regression. Having a basic understanding of MXNet data iterators helps, since we will create a custom data iterator to iterate though random numbers as inputs to the Generator network.\n\nThis example is designed to be trained on a single GPU. Training this network on CPU can be slow, so it's recommended that you use a GPU for training.\n\nTo complete this tutorial, you need:\n\n- MXNet\n- Python, and the following libraries for Python:\n - Numpy - for matrix math\n - OpenCV - for image manipulation\n - Matplotlib - to visualize the output\n\n## The Data\nWe need two pieces of data to train the DCGAN:\n 1. Images of handwritten digits from the MNIST dataset\n 2. Random numbers from a normal distribution\n\nThe Generator network will use the random numbers as the input to produce the images of handwritten digits, and the Discriminator network will use images of handwritten digits from the MNIST dataset to determine if images produced by the Generator are realistic.\n\nThe MNIST dataset contains 70,000 images of handwritten digits. Each image is 28x28 pixels in size. To create random numbers, we're going to create a custom MXNet data iterator, which will returns random numbers from a normal distribution as we need then.\n\n## Prepare the Data\n\n### 1. Preparing the MNSIT dataset\n\nLet us start by preparing the handwritten digits from the MNIST dataset.", "cell_type": "markdown", "metadata": {}}, {"source": "import mxnet as mx\nimport numpy as np\n\nmnist_train = mx.gluon.data.vision.datasets.MNIST(train=True)\nmnist_test = mx.gluon.data.vision.datasets.MNIST(train=False)", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "# The downloaded data is of type `Dataset` which are\n# Well suited to work with the new Gluon interface but less\n# With the older symbol API, used in this tutorial.\n# Therefore we convert them to numpy array first\nX = np.zeros((70000, 28, 28))\nfor i, (data, label) in enumerate(mnist_train):\n X[i] = data.asnumpy()[:,:,0]\nfor i, (data, label) in enumerate(mnist_test):\n X[len(mnist_train)+i] = data.asnumpy()[:,:,0]", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "Next, we will randomize the handwritten digits by using numpy to create random permutations on the dataset on the rows (images). Every image in the dataset is arranged into a 28x28 grid, where each cell in the grid represents 1 pixel of the image.", "cell_type": "markdown", "metadata": {}}, {"source": "#Use a seed so that we get the same random permutation each time\nnp.random.seed(1)\np = np.random.permutation(X.shape[0])\nX = X[p]", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "Since the DCGAN that we're creating takes in a 64x64 image as the input, we will use OpenCV to resize the each 28x28 image to 64x64 images:", "cell_type": "markdown", "metadata": {}}, {"source": "import cv2\nX = np.asarray([cv2.resize(x, (64,64)) for x in X])", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "Each pixel in the 64x64 image is represented by a number between 0-255, that represents the intensity of the pixel. However, we want to input numbers between -1 and 1 into the DCGAN, as suggested by the [research paper](https://arxiv.org/abs/1511.06434). To rescale the pixel values, we will divide it by (255/2). This changes the scale to 0-2. We then subtract by 1 to get them in the range of -1 to 1.", "cell_type": "markdown", "metadata": {}}, {"source": "X = X.astype(np.float32, copy=False)/(255.0/2) - 1.0", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "Ultimately, images are fed into the neural net through a 70000x3x64x64 array but they are currently in a 70000x64x64 array. We need to add 3 channels to the images. Typically, when we are working with the images, the 3 channels represent the red, green, and blue (RGB) components of each image. Since the MNIST dataset is grayscale, we only need 1 channel to represent the dataset. We will pad the other channels with 0's:", "cell_type": "markdown", "metadata": {}}, {"source": "X = X.reshape((70000, 1, 64, 64))\nX = np.tile(X, (1, 3, 1, 1))", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "Finally, we will put the images into MXNet's NDArrayIter, which will allow MXNet to easily iterate through the images during training. We will also split them up into batches of 64 images each. Every time we iterate, we will get a 4 dimensional array with size (64, 3, 64, 64), representing a batch of 64 images.", "cell_type": "markdown", "metadata": {}}, {"source": "import mxnet as mx\nbatch_size = 64\nimage_iter = mx.io.NDArrayIter(X, batch_size=batch_size)", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "### 2. Preparing Random Numbers\n\nWe need to input random numbers from a normal distribution to the Generator network, so we will create an MXNet DataIter that produces random numbers for each training batch. The DataIter is the base class of MXNet's Data Loading API. Below, we create a class called RandIter which is a subclass of DataIter. We use MXNet's built-in mx.random.normal function to return the random numbers from a normal distribution during the iteration.", "cell_type": "markdown", "metadata": {}}, {"source": "class RandIter(mx.io.DataIter):\n def __init__(self, batch_size, ndim):\n self.batch_size = batch_size\n self.ndim = ndim\n self.provide_data = [('rand', (batch_size, ndim, 1, 1))]\n self.provide_label = []\n\n def iter_next(self):\n return True\n\n def getdata(self):\n #Returns random numbers from a gaussian (normal) distribution\n #with mean=0 and standard deviation = 1\n return [mx.random.normal(0, 1.0, shape=(self.batch_size, self.ndim, 1, 1))]", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "When we initialize the RandIter, we need to provide two numbers: the batch size and how many random numbers we want in order to produce a single image from. This number is referred to as Z, and we will set this to 100. This value comes from the research paper on the topic. Every time we iterate and get a batch of random numbers, we will get a 4 dimensional array with shape: (batch_size, Z, 1, 1), which in the example is (64, 100, 1, 1).", "cell_type": "markdown", "metadata": {}}, {"source": "Z = 100\nrand_iter = RandIter(batch_size, Z)", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "## Create the Model\n\nThe model has two networks that we will train together - the Generator network and the Discriminator network.\n\n### The Generator\n\nLet us start off by defining the Generator network, which uses Deconvolution layers (also called as fractionally strided layers) to generate an image form random numbers :", "cell_type": "markdown", "metadata": {}}, {"source": "no_bias = True\nfix_gamma = True\nepsilon = 1e-5 + 1e-12\n\nrand = mx.sym.Variable('rand')\n\ng1 = mx.sym.Deconvolution(rand, name='g1', kernel=(4,4), num_filter=1024, no_bias=no_bias)\ngbn1 = mx.sym.BatchNorm(g1, name='gbn1', fix_gamma=fix_gamma, eps=epsilon)\ngact1 = mx.sym.Activation(gbn1, name='gact1', act_type='relu')\n\ng2 = mx.sym.Deconvolution(gact1, name='g2', kernel=(4,4), stride=(2,2), pad=(1,1), num_filter=512, no_bias=no_bias)\ngbn2 = mx.sym.BatchNorm(g2, name='gbn2', fix_gamma=fix_gamma, eps=epsilon)\ngact2 = mx.sym.Activation(gbn2, name='gact2', act_type='relu')\n\ng3 = mx.sym.Deconvolution(gact2, name='g3', kernel=(4,4), stride=(2,2), pad=(1,1), num_filter=256, no_bias=no_bias)\ngbn3 = mx.sym.BatchNorm(g3, name='gbn3', fix_gamma=fix_gamma, eps=epsilon)\ngact3 = mx.sym.Activation(gbn3, name='gact3', act_type='relu')\n\ng4 = mx.sym.Deconvolution(gact3, name='g4', kernel=(4,4), stride=(2,2), pad=(1,1), num_filter=128, no_bias=no_bias)\ngbn4 = mx.sym.BatchNorm(g4, name='gbn4', fix_gamma=fix_gamma, eps=epsilon)\ngact4 = mx.sym.Activation(gbn4, name='gact4', act_type='relu')\n\ng5 = mx.sym.Deconvolution(gact4, name='g5', kernel=(4,4), stride=(2,2), pad=(1,1), num_filter=3, no_bias=no_bias)\ngeneratorSymbol = mx.sym.Activation(g5, name='gact5', act_type='tanh')", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "The Generator image starts with random numbers that will be obtained from the RandIter we created earlier, so we created the rand variable for this input.\nWe then start creating the model starting with a Deconvolution layer (sometimes called 'fractionally strided layer'). We apply batch normalization and ReLU activation after the Deconvolution layer.\n\nWe repeat this process 4 times, applying a (2,2) stride and (1,1) pad at each Deconvolution layer, which doubles the size of the image at each layer. By creating these layers, the Generator network will have to learn to upsample the input vector of random numbers, Z at each layer, so that network output a final image. We also reduce by half the number of filters at each layer, reducing dimensionality at each layer. Ultimately, the output layer is a 64x64x3 layer, representing the size and channels of the image. We use tanh activation instead of relu on the last layer, as recommended by the research on DCGANs. The output of neurons in the final gout layer represent the pixels of generated image.\n\nNotice we used 3 parameters to help us create the model: no_bias, fixed_gamma, and epsilon. Neurons in the network won't have a bias added to them, this seems to work better in practice for the DCGAN. In the batch norm layer, we set fixed_gamma=True, which means gamma=1 for all of the batch norm layers. epsilon is a small number that gets added to the batch norm so that we don't end up dividing by zero. By default, CuDNN requires that this number is greater than 1e-5, so we add a small number to this value, ensuring this values stays small.\n\n### The Discriminator\n\nLet us now create the Discriminator network, which will take in images of handwritten digits from the MNIST dataset and images created by the Generator network:", "cell_type": "markdown", "metadata": {}}, {"source": "data = mx.sym.Variable('data')\n\nd1 = mx.sym.Convolution(data, name='d1', kernel=(4,4), stride=(2,2), pad=(1,1), num_filter=128, no_bias=no_bias)\ndact1 = mx.sym.LeakyReLU(d1, name='dact1', act_type='leaky', slope=0.2)\n\nd2 = mx.sym.Convolution(dact1, name='d2', kernel=(4,4), stride=(2,2), pad=(1,1), num_filter=256, no_bias=no_bias)\ndbn2 = mx.sym.BatchNorm(d2, name='dbn2', fix_gamma=fix_gamma, eps=epsilon)\ndact2 = mx.sym.LeakyReLU(dbn2, name='dact2', act_type='leaky', slope=0.2)\n\nd3 = mx.sym.Convolution(dact2, name='d3', kernel=(4,4), stride=(2,2), pad=(1,1), num_filter=512, no_bias=no_bias)\ndbn3 = mx.sym.BatchNorm(d3, name='dbn3', fix_gamma=fix_gamma, eps=epsilon)\ndact3 = mx.sym.LeakyReLU(dbn3, name='dact3', act_type='leaky', slope=0.2)\n\nd4 = mx.sym.Convolution(dact3, name='d4', kernel=(4,4), stride=(2,2), pad=(1,1), num_filter=1024, no_bias=no_bias)\ndbn4 = mx.sym.BatchNorm(d4, name='dbn4', fix_gamma=fix_gamma, eps=epsilon)\ndact4 = mx.sym.LeakyReLU(dbn4, name='dact4', act_type='leaky', slope=0.2)\n\nd5 = mx.sym.Convolution(dact4, name='d5', kernel=(4,4), num_filter=1, no_bias=no_bias)\nd5 = mx.sym.Flatten(d5)\n\nlabel = mx.sym.Variable('label')\ndiscriminatorSymbol = mx.sym.LogisticRegressionOutput(data=d5, label=label, name='dloss')", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "We start off by creating the data variable, which is used to hold the input images to the Discriminator.\n\nThe Discriminator then goes through a series of 5 convolutional layers, each with a 4x4 kernel, 2x2 stride, and 1x1 pad. These layers half the size of the image (which starts at 64x64) at each convolutional layer. The model also increases dimensionality at each layer by doubling the number of filters per convolutional layer, starting at 128 filters and ending at 1024 filters before we flatten the output.\n\nAt the final convolution, we flatten the neural net to get one number as the final output of Discriminator network. This number is the probability that the image is real, as determined by the Discriminator. We use logistic regression to determine this probability. When we pass in \"real\" images from the MNIST dataset, we can label these as 1 and we can label the \"fake\" images from the Generator net as 0 to perform logistic regression on the Discriminator network.\n\n### Prepare the models using the Module API\n\nSo far we have defined a MXNet Symbol for both the Generator and the Discriminator network. Before we can train the model, we need to bind these symbols using the Module API, which creates the computation graph for the models. It also allows us to decide how we want to initialize the model and what type of optimizer we want to use. Let us set up the Module for both the networks:", "cell_type": "markdown", "metadata": {}}, {"source": "#Hyper-parameters\nsigma = 0.02\nlr = 0.0002\nbeta1 = 0.5\n# Define the compute context, use GPU if available\nctx = mx.gpu() if mx.test_utils.list_gpus() else mx.cpu()\n\n#=============Generator Module=============\ngenerator = mx.mod.Module(symbol=generatorSymbol, data_names=('rand',), label_names=None, context=ctx)\ngenerator.bind(data_shapes=rand_iter.provide_data)\ngenerator.init_params(initializer=mx.init.Normal(sigma))\ngenerator.init_optimizer(\n optimizer='adam',\n optimizer_params={\n 'learning_rate': lr,\n 'beta1': beta1,\n })\nmods = [generator]\n\n# =============Discriminator Module=============\ndiscriminator = mx.mod.Module(symbol=discriminatorSymbol, data_names=('data',), label_names=('label',), context=ctx)\ndiscriminator.bind(data_shapes=image_iter.provide_data,\n label_shapes=[('label', (batch_size,))],\n inputs_need_grad=True)\ndiscriminator.init_params(initializer=mx.init.Normal(sigma))\ndiscriminator.init_optimizer(\n optimizer='adam',\n optimizer_params={\n 'learning_rate': lr,\n 'beta1': beta1,\n })\nmods.append(discriminator)", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "First, we create Modules for the networks and then bind the symbols that we've created in the previous steps to the modules.\nWe use rand_iter.provide_data as the data_shape to bind the Generator network. This means that as we iterate though batches of the data on the Generator Module, the RandIter will provide us with random numbers to feed the Module using it's provide_data function.\n\nSimilarly, we bind the Discriminator Module to image_iter.provide_data, which gives us images from MNIST from the NDArrayIter we had set up earlier, called image_iter.\n\nNotice that we are using the Normal Initialization, with the hyperparameter sigma=0.02. This means the weight initializations for the neurons in the networks will be random numbers from a Gaussian (normal) distribution with a mean of 0 and a standard deviation of 0.02.\n\nWe also use the Adam optimizer for gradient decent. We've set up two hyperparameters, lr and beta1 based on the values used in the DCGAN paper. We're using a single gpu, gpu(0) for training. Set the context to cpu() if you do not have a GPU on your machine.\n\n### Visualizing The Training\nBefore we train the model, let us set up some helper functions that will help visualize what the Generator is producing, compared to what the real image is:", "cell_type": "markdown", "metadata": {}}, {"source": "from matplotlib import pyplot as plt\n\n#Takes the images in the batch and arranges them in an array so that they can be\n#Plotted using matplotlib\ndef fill_buf(buf, num_images, img, shape):\n width = buf.shape[0]/shape[1]\n height = buf.shape[1]/shape[0]\n img_width = int(num_images%width)*shape[0]\n img_hight = int(num_images/height)*shape[1]\n buf[img_hight:img_hight+shape[1], img_width:img_width+shape[0], :] = img\n\n#Plots two images side by side using matplotlib\ndef visualize(fake, real):\n #64x3x64x64 to 64x64x64x3\n fake = fake.transpose((0, 2, 3, 1))\n #Pixel values from 0-255\n fake = np.clip((fake+1.0)*(255.0/2.0), 0, 255).astype(np.uint8)\n #Repeat for real image\n real = real.transpose((0, 2, 3, 1))\n real = np.clip((real+1.0)*(255.0/2.0), 0, 255).astype(np.uint8)\n\n #Create buffer array that will hold all the images in the batch\n #Fill the buffer so to arrange all images in the batch onto the buffer array\n n = np.ceil(np.sqrt(fake.shape[0]))\n fbuff = np.zeros((int(n*fake.shape[1]), int(n*fake.shape[2]), int(fake.shape[3])), dtype=np.uint8)\n for i, img in enumerate(fake):\n fill_buf(fbuff, i, img, fake.shape[1:3])\n rbuff = np.zeros((int(n*real.shape[1]), int(n*real.shape[2]), int(real.shape[3])), dtype=np.uint8)\n for i, img in enumerate(real):\n fill_buf(rbuff, i, img, real.shape[1:3])\n\n #Create a matplotlib figure with two subplots: one for the real and the other for the fake\n #fill each plot with the buffer array, which creates the image\n fig = plt.figure()\n ax1 = fig.add_subplot(2,2,1)\n ax1.imshow(fbuff)\n ax2 = fig.add_subplot(2,2,2)\n ax2.imshow(rbuff)\n plt.show()", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "## Fit the Model\nTraining the DCGAN is a complex process that requires multiple steps.\nTo fit the model, for every batch of data in the MNIST dataset:\n\n1. Use the Z vector, which contains the random numbers to do a forward pass through the Generator network. This outputs the \"fake\" image, since it is created from the Generator.\n\n2. Use the fake image as the input to do a forward and backward pass through the Discriminator network. We set the labels for logistic regression to 0 to represent that this is a fake image. This trains the Discriminator to learn what a fake image looks like. We save the gradient produced in backpropagation for the next step.\n\n3. Do a forward and backward pass through the Discriminator using a real image from the MNIST dataset. The label for logistic regression will now be 1 to represent the real images, so the Discriminator can learn to recognize a real image.\n\n4. Update the Discriminator by adding the result of the gradient generated during backpropagation on the fake image with the gradient from backpropagation on the real image.\n\n5. Now that the Discriminator has been updated for the this data batch, we still need to update the Generator. First, do a forward and backwards pass with the same data batch on the updated Discriminator, to produce a new gradient. Use the new gradient to do a backwards pass\n\nHere is the main training loop for the DCGAN:", "cell_type": "markdown", "metadata": {}}, {"source": "# =============train===============\nprint('Training...')\nfor epoch in range(1):\n image_iter.reset()\n for i, batch in enumerate(image_iter):\n #Get a batch of random numbers to generate an image from the generator\n rbatch = rand_iter.next()\n #Forward pass on training batch\n generator.forward(rbatch, is_train=True)\n #Output of training batch is the 64x64x3 image\n outG = generator.get_outputs()\n\n #Pass the generated (fake) image through the discriminator, and save the gradient\n #Label (for logistic regression) is an array of 0's since this image is fake\n label = mx.nd.zeros((batch_size,), ctx=ctx)\n #Forward pass on the output of the discriminator network\n discriminator.forward(mx.io.DataBatch(outG, [label]), is_train=True)\n #Do the backward pass and save the gradient\n discriminator.backward()\n gradD = [[grad.copyto(grad.context) for grad in grads] for grads in discriminator._exec_group.grad_arrays]\n\n #Pass a batch of real images from MNIST through the discriminator\n #Set the label to be an array of 1's because these are the real images\n label[:] = 1\n batch.label = [label]\n #Forward pass on a batch of MNIST images\n discriminator.forward(batch, is_train=True)\n #Do the backward pass and add the saved gradient from the fake images to the gradient\n #generated by this backwards pass on the real images\n discriminator.backward()\n for gradsr, gradsf in zip(discriminator._exec_group.grad_arrays, gradD):\n for gradr, gradf in zip(gradsr, gradsf):\n gradr += gradf\n #Update gradient on the discriminator\n discriminator.update()\n\n #Now that we've updated the discriminator, let's update the generator\n #First do a forward pass and backwards pass on the newly updated discriminator\n #With the current batch\n discriminator.forward(mx.io.DataBatch(outG, [label]), is_train=True)\n discriminator.backward()\n #Get the input gradient from the backwards pass on the discriminator,\n #and use it to do the backwards pass on the generator\n diffD = discriminator.get_input_grads()\n generator.backward(diffD)\n #Update the gradients on the generator\n generator.update()\n\n #Increment to the next batch, printing every 50 batches\n i += 1\n if i % 50 == 0:\n print('epoch:', epoch, 'iter:', i)\n print\n print(\" From generator: From MNIST:\")\n\n visualize(outG[0].asnumpy(), batch.data[0].asnumpy())", "cell_type": "code", "execution_count": null, "outputs": [], "metadata": {}}, {"source": "\nThis will train the GAN network and visualize the progress that we are making as the networks are trained. After every 25 iterations, we are calling the visualize function that we created earlier, which plots the intermediate results.\n\nThe plot on the left will represent what the Generator created (the fake image) in the most recent iteration. The plot on the right will represent the Original (real) image from the MNIST dataset that was inputted to the Discriminator on the same iteration.\n\nAs the training goes on, the Generator becomes better at generating realistic images. You can see this happening since the images on the left becomes closer to the original dataset with each iteration.\n\n## Summary\n\nWe have now successfully used Apache MXNet to train a Deep Convolutional Generative Adversarial Neural Networks (DCGAN) using the MNIST dataset.\n\nAs a result, we have created two neural nets: a Generator, which is able to create images of handwritten digits from random numbers, and a Discriminator, which is able to take an image and determine if it is an image of handwritten digits.\n\nAlong the way, we have learned how to do the image manipulation and visualization that is associated with the training of deep neural nets. We have also learned how to use MXNet's Module APIs to perform advanced model training functionality to fit the model.\n\n## Acknowledgements\n\nThis tutorial is based on [MXNet DCGAN codebase](https://github.com/apache/incubator-mxnet/blob/master/example/gluon/dc_gan/dcgan.py),\n[The original paper on GANs](https://arxiv.org/abs/1406.2661), as well as [this paper on deep convolutional GANs](https://arxiv.org/abs/1511.06434).\n\n\n", "cell_type": "markdown", "metadata": {}}], "metadata": {"display_name": "", "name": "", "language": "python"}, "nbformat_minor": 2}