def plot_16_original_and_recon(self, img_original): n = img_original.shape[1] m = int(np.sqrt(n)) img_shape = (m, m) fig = utils.plot_16_images_2d_and_return(img_original, img_shape=img_shape) plt.show(fig) img_recon = self.recon(img_original) fig = utils.plot_16_images_2d_and_return(img_recon, img_shape=img_shape) plt.show(fig)
def plot_16_loading_vectors(self): z = np.zeros(shape=(16, self.dim_z)) for i in range(16): if i < self.dim_z: z[i, i] = 1 feed_dict = {self.z: z} images = self.sess.run(self.x_recon, feed_dict=feed_dict) n = images.shape[1] m = int(np.sqrt(n)) img_shape = (m, m) fig = utils.plot_16_images_2d_and_return(images, img_shape=img_shape) plt.show(fig)
def plot_16_generated(self, figure_index=0): if not os.path.exists(self.figure_save_dir): os.makedirs(self.figure_save_dir) z = np.random.normal(0., 1., size=(16, self.dim_z)) feed_dict = {self.z: z} images = self.sess.run(self.x_recon, feed_dict=feed_dict) n = images.shape[1] m = int(np.sqrt(n)) img_shape = (m, m) fig = utils.plot_16_images_2d_and_return(images, img_shape=img_shape) fig.savefig(self.figure_save_dir + '/{}.png'.format(figure_index), bbox_inches='tight') plt.close(fig)