For your handwritten solutions, please scan or take a picture of them. Alternatively, you can write them in markdown if you prefer.
Only .ipynb files will be graded for your code.
Compress all the files into a single .zip file.
Do not submit a printed version of your code, as it will not be graded.
In this problem, our objective is to develop a model capable of reconstructing dog images through a convolutional autoencoder architecture.
(1) Load the dog dataset.
import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from google.colab import drive
drive.mount('/content/drive')
## your code here
#
dog_dataset =
(2) Design and train a convolutional autoencoder architecture.
## your code here
#
(3) Select five random images and create plots to display both the original and reconstructed images.
## your code here
#
(4) Load data of a white dog and a black dog.
Download images of black_dog.png and white_dog.png.
Resize each image to (64, 64, 3) and rescale the image pixels to a range of 0 to 1 by dividing them by 255.
## your code here
#
(5) Walk in the latent space
Show the average pixel image of the black dog and white dog images in the original space.
Show the decoded image after averaging the encoded representations of a white dog and a black dog in the latent space.
## your code here
#
(6) Explain the reason for the difference between the two images in terms of the latent space.
## your code here
#
We studied the Fully Convolutional Network (FCN) model with the VGG16 network in class. In this problem, you will implement your FCN model using the VGG19 network as the encoder part of the model.
To achieve this, we will utilize a pre-trained VGG network in Problem 2 and then proceed with the FCN model in Problem 3.
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import cv2
(1) Load the provided dataset and display its shape.
## your code here
#
train_imgs =
train_seg =
test_imgs =
n_train = train_imgs.shape[0]
n_test = test_imgs.shape[0]
print ("The number of training images : {}, shape : {}".format(n_train, train_imgs.shape))
print ("The number of testing images : {}, shape : {}".format(n_test, test_imgs.shape))
(2) Visualize a randomly selected image from the training dataset.
## your code here
#
(3) Load the VGG19 network and display its model structure.
## your code here
#
Now that we have the pre-trained weights and biases from Problem 2, we will utilize them in this problem.
(1) Define your FCN model by incorporating the weights and biases from Problem 2.
## your code here
#
model.summary()
(2) Train the model. Highly recommand to use GPU or CoLab. (Train on CPU may take more than half an hour.)
## your code here
#
(4) Test your model by selecting a random test image, segmenting it using your trained FCN model, and then plotting the segmentation and the test image together.
## your code here
#
(5) Now that we can segment images, let's proceed to segment the provided highway image.
## your code here
#
## your code here
#
(6) As you can see, the trained image and image in problem 3-(5) exhibit distinct shapes. Is it possible to feed different shaped images to the same FCN model without reshaping it? If yes, explain why it is possible.
## your code here
#