def plot_data(self, step, handle=None): if handle is None: handle = self.validation_handle plot_subdir = self.plot_dir + str(step) + "/" checkFolders([self.plot_dir, plot_subdir]) fd = { self.dataset_handle: handle, self.z: np.zeros([self.batch_size, self.z_dim]), self.training: False, self.kl_wt: self.kl_weight } in_data, msoln, pred = self.sess.run( [self.data, self.masked_soln, self.masked_pred], feed_dict=fd) data, mesh, soln = in_data for n in range(0, self.batch_size): soln_name = 'soln_' + str(n) + '.npy' data_name = 'data_' + str(n) + '.npy' mesh_name = 'mesh_' + str(n) + '.npy' msoln_name = 'msoln_' + str(n) + '.npy' pred_name = 'pred_' + str(n) + '.npy' np.save(os.path.join(plot_subdir, soln_name), soln[n, :, :, 0]) np.save(os.path.join(plot_subdir, data_name), data[n, :, :, 0]) np.save(os.path.join(plot_subdir, mesh_name), mesh[n, :, :, 0]) np.save(os.path.join(plot_subdir, msoln_name), msoln[n, :, :, 0]) np.save(os.path.join(plot_subdir, pred_name), pred[n, :, :, 0])
def plot_predictions(self, step): plot_subdir = self.plot_dir + str(step) + "/" checkFolders([self.plot_dir, plot_subdir]) resized_imgs = self.predict(random_samples=True) for n in range(0, self.batch_size): plot_name = 'plot_' + str(n) + '.png' plt.imsave(os.path.join(plot_subdir, plot_name), resized_imgs[n,:,:,0], cmap='gray')
def plot_comparisons(self, step): plot_subdir = self.plot_dir + str(step) + "/" checkFolders([self.plot_dir, plot_subdir]) soln, pred = self.predict() for n in range(0, self.batch_size): soln_name = 'soln_' + str(n) + '.npy'; pred_name = 'pred_' + str(n) + '.npy' np.save(os.path.join(plot_subdir, soln_name), soln[n,:,:,0]) np.save(os.path.join(plot_subdir, pred_name), pred[n,:,:,0])
def plot_comparisons(self, step): plot_subdir = self.plot_dir + str(step) + "/" checkFolders([self.plot_dir, plot_subdir]) resized_data, resized_pred = self.predict() for n in range(0, self.batch_size): data_name = 'data_' + str(n) + '.png'; pred_name = 'pred_' + str(n) + '.png' plt.imsave(os.path.join(plot_subdir, data_name), resized_data[n,:,:,0], cmap='gray') plt.imsave(os.path.join(plot_subdir, pred_name), resized_pred[n,:,:,0], cmap='gray')