We will be using numpy, matplotlib, keras, tensorflow and the tqdm package in this exercise. Here, Tensorflow is used as the backend for Keras. You can install these packages with pip. For the MNIST data, we will be using the dataset available in the Keras module with a simple import.
import numpy as np
import random
import matplotlib.pyplot as plt
%matplotlib inline
from tqdm import tqdm
from keras.layers import Input, Conv2D
from keras.layers import AveragePooling2D, BatchNormalization
from keras.layers import UpSampling2D, Flatten, Activation
from keras.models import Model, Sequential
from keras.layers.core import Dense, Dropout
from keras.layers.advanced_activations import LeakyReLU
from keras.optimizers import Adam
from keras import backend as k
from keras.datasets import mnist
It is important that you set seed for reproducibility.
# set seed for reproducibility
seed_val = 9000
np.random.seed(seed_val)
random.seed(seed_val)