The project
Importing the right libraries is where we start. Apart from tensorflow
, we will be using numpy
and math for computations, scipy
, matplolib
for images and graphics, and warnings
, random
, and distutils
for support in specific operations:
import numpy as np import tensorflow as tf import math import warnings import matplotlib.pyplot as plt from scipy.misc import imresize from random import shuffle from distutils.version import LooseVersion
Dataset class
Our first step is to provide the data. We will rely on datasets that have already been preprocessed, but our readers could use different kinds of images for their own GAN implementation. The idea is to keep separate a Dataset
class that will have the task of providing batches of normalized and reshaped images to the GANs class we will build later.
In the initialization, we will deal with both images and their labels (if available). Images are first reshaped (if their shape differs from the one defined when instantiating the class), then...