From 25124b8389f80d7a509b2d98ef69589cab597c9a Mon Sep 17 00:00:00 2001 From: SsnL Date: Thu, 6 Jul 2017 22:19:53 -0500 Subject: resize_or_crop and better display single image --- util/visualizer.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'util/visualizer.py') diff --git a/util/visualizer.py b/util/visualizer.py index 38b3bac..3733525 100644 --- a/util/visualizer.py +++ b/util/visualizer.py @@ -31,6 +31,11 @@ class Visualizer(): def display_current_results(self, visuals, epoch): if self.display_id > 0: # show images in the browser if self.display_single_pane_ncols > 0: + h, w = next(iter(visuals.values())).shape[:2] + table_css = """""" % (w, h) ncols = self.display_single_pane_ncols title = self.name label_html = '' @@ -45,17 +50,18 @@ class Visualizer(): if idx % ncols == 0: label_html += '%s' % label_html_row label_html_row = '' + white_image = np.ones_like(image_numpy.transpose([2, 0, 1]))*255 while idx % ncols != 0: - white_image = np.ones_like(image_numpy.transpose([2, 0, 1]))*255 images.append(white_image) label_html_row += '' idx += 1 if label_html_row != '': label_html += '%s' % label_html_row + # pane col = image row self.vis.images(images, nrow=ncols, win=self.display_id + 1, - opts=dict(title=title + ' images')) # pane col = image row - label_html = '%s