July 2019
Intermediate to advanced
512 pages
19h 39m
English
Just as we learned how to implement an autoencoder in the previous section, implementing a CAE is also the same, but the only difference is here we use convolutional layers in the encoder and decoder instead of a feedforward network. We will use the same MNIST dataset to reconstruct the images using CAE.
Import the libraries:
import warningswarnings.filterwarnings('ignore')#modellingfrom tensorflow.keras.models import Modelfrom tensorflow.keras.layers import Input, Dense, Conv2D, MaxPooling2D, UpSampling2Dfrom tensorflow.keras import backend as K#plottingimport matplotlib.pyplot as plt%matplotlib inline#datasetfrom keras.datasets import mnistimport numpy as np
Read and reshape the dataset:
(x_train, ...
Read now
Unlock full access