ICP 13 - AsharGit/Python-ICP GitHub Wiki

a. Description about the ICP

In this ICP we have 4 tasks and a bonus question

  1. Add an extra layer in our autoencoder
  2. Do a prediction on test data and visualize a sample image and it's reconstructed image
  3. Do the same task on a noise autoencoder
  4. Plot model accuracy and loss Bonus: Visualize the compressed middle layer

b. Objective

The objective of this ICP is to understand the use of autoencoders and to visualize how compression and reconstruction affects images.

c. Design/ implementation(include screenshots with explanations)

The first task of this ICP is to add an extra layer

We have to include a layer for encoding and decoding

We use the same encoding dimensions for each

Next task in the ICP is to do a prediction on the model

We use prediction on x_test and use the first image in the set for our visualization

We reshape the images into 28x28 dimension

The original image in our data set

The reconstructed image after decoding

As a bonus question we are asked to visualize the compressed middle layer

We map input_img as the input and encoding as the output layer using our model

Do a prediction on the sample image and visualize as a 16x2 image

The compressed middle layer between input_img and encoding

Our third task asks us to plot accuracy and loss on our model

We again use matplotlib to set up our plot graphic

Accuracy of the autoencoder

Loss of the autoencoder

Final task in this ICP asks us to apply the same properties to the noise autoencoder

We apply the same code as before and visualize the original first

Then we visualize the reconstruction with noise autoencoding

We do a accuracy and loss plot for this model as well

Accuracy of the noise autoencoder

Loss of the noise autoencoder

d. Video link

https://youtu.be/zFBJicTGVuQ

e. Conclusion

i. What you have learned from the ICP

This ICP gave me a really good understanding of how encoding works, I knew a little bit about it but visualizing how it works really helped solidify the concept.

ii. What the challenge you have faced

I ran into some problems with plotting the visualization of the reconstructed image with the given optimizer in the code while fitting. The loss I had on my model was about 0.70 and never went lower. I switched to adam from adadelta and that seemed to fix the problem.

I also had some problems finding a way to visualize the middle layer but I was eventually able to figure it out.