Now we will see how to implement DCGAN in TensorFlow. We will learn how to use DCGAN with images from the Canadian Institute For Advanced Research (CIFAR)-10 dataset. CIFAR-10 consists of 60,000 images from 10 different classes that include airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships, and trucks. We will examine how we can use DCGAN to generate such images.
First, import the required libraries:
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
tf.logging.set_verbosity(tf.logging.ERROR)
from keras.datasets import cifar10
import matplotlib.pyplot as plt
%matplotlib inline
from IPython import display
from scipy.misc import toimage