Generate fashion images using Generative Adversarial Networks


In this code pattern, look at a simple JSON representation of defining a Generative Adversarial Network (GAN) model, and implementing a Deep Convolutional GAN (DCGAN) model to generate fashion images without writing a single line of code.


Deep learning models used to perform classification tasks are upper bounded by the number of images available in the training data. Data augmentation is often used to synthetically generate more data, which looks similar to the original data. Generative Adversarial Networks are state-of-the-art models that are used to generate synthetic, realistic images.

Fashion MNIST is a 10-class classification data set that is a drop-in replacement for the MNIST digit classification data set. Many deep learning models are trained for performing classification on the Fashion MNIST data set. The performance of these classifiers could be improved if the training data set could be augmented with more images. A Deep Convolutional GAN (DCGAN) model is a GAN for generating high-quality fashion MNIST images.

This is an open source project bundled with the following tools that you can use to design and implement custom GAN models:

  • Specify the architecture of a GAN model by using a simple JSON structure, without the need for writing a single line of code
  • Customize all of the parameters of different GAN components through the JSON structure
  • Train the designed GAN model on any custom data (such as a fashion data set) to start generating new images


Supplement NWN Watson Studio

  1. The user creates a JSON config file that defines the architecture choices of the GAN model to be trained.
  2. The user sends the JSON config file through a REST API call to a Python-Flask server in IBM Cloud.
  3. The Flask API decodes the JSON config file in real time and creates a GAN model definition.
  4. The Flask API then converts the GAN model definition into an error-free PyTorch code.
  5. The GAN model in PyTorch is then trained using the given input fashion image data set.
  6. The trained model generates new fashion images that are not in the input data set but look similar to them.
  7. The newly generated images can be collected from the Python runtime in IBM Cloud.


Find the detailed steps for this pattern in the README file. The steps show you how to:

  1. Create an account with IBM Cloud.
  2. Install the IBM Cloud CLI.
  3. Log in to your IBM Cloud account using CLI.
  4. Set up the IBM Cloud Target Org and Space.
  5. Clone the GitHub repository.
  6. Create a GAN configuration file.
  7. Edit the manifest file and ProcFile.
  8. Push the app to a new Python runtime in IBM Cloud.