Let's implement a deep convolutional autoencoder based on TensorFlow and the Olivetti faces dataset (which is relatively small, but offers a good level of expressivity). Let's start by loading the images and preparing the training set:
from sklearn.datasets import fetch_olivetti_facesfaces = fetch_olivetti_faces(shuffle=True, random_state=1000)X_train = faces['images']
The samples are 400, 64 × 64 grayscale images that we are going to resize to 32 × 32, in order to speed up computation and avoid memory issues (this operation will cause a slight loss of visual precision, and you can remove it if you have enough computational resources). We can now define the main constants (the number of epochs ( ...