i =1pyplot.figure(figsize=(10, 10))for image in x_train:if i >5:break pyplot.subplot(1, 5, i) pyplot.imshow(image) pyplot.axis("off") i +=1pyplot.show()
i =1pyplot.figure(figsize=(10, 10))for image in x_train:if i >5:break pyplot.subplot(1, 5, i) pyplot.imshow(image) pyplot.axis("off") i +=1pyplot.show()
encoded_input = Input(shape=(encoding_dim,))decoder_l1 = autoencoder.layers[-4]decoder_l2 = autoencoder.layers[-3]decoder_l3 = autoencoder.layers[-2]decoder_l4 = autoencoder.layers[-1]# as if I am multiplying the last layer with the code layer to get the last outputdecoder = Model( encoded_input, decoder_l4(decoder_l3(decoder_l2(decoder_l1(encoded_input)))))
n =15pyplot.figure(figsize=(20, 4))for i inrange(n): ax = pyplot.subplot(2, n, i +1) pyplot.imshow(x_test_flattened[i].reshape(32, 32, 3)) pyplot.gray() ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) ax = pyplot.subplot(2, n, i +1+ n) pyplot.imshow(decoded_images[i].reshape(32, 32, 3)) pyplot.gray() ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False)pyplot.show()
Code
n =15pyplot.figure(figsize=(20, 4))for i inrange(n): ax = pyplot.subplot(3, n, i +1) pyplot.imshow(x_test_flattened[i].reshape(32, 32, 3)) pyplot.gray() ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) ax = pyplot.subplot(3, n, i +1+ n) pyplot.imshow(encoded_images[i].reshape(10, 10)) pyplot.gray() ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) ax = pyplot.subplot(3, n, i +1+2* n) pyplot.imshow(decoded_images[i].reshape(32, 32, 3)) pyplot.gray() ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False)pyplot.show()