From 92c56e470f4aaa96e698c6d5c7aef4687965facc Mon Sep 17 00:00:00 2001 From: kkshmz Date: Mon, 21 Oct 2019 17:46:08 +0900 Subject: [PATCH] change scipy to PIL as scipy.io.imwrite is deprecated in 0.19 and current version started to normalize all images so that min(data) become black and max(data) become white, making need for more code, etc. not cool. --- util/visualizer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/visualizer.py b/util/visualizer.py index 584ac45d..87f2fde2 100755 --- a/util/visualizer.py +++ b/util/visualizer.py @@ -4,7 +4,7 @@ import time from . import util from . import html -import scipy.misc +from PIL import Image try: from StringIO import StringIO # Python 2.7 except ImportError: @@ -43,7 +43,7 @@ def display_current_results(self, visuals, epoch, step): s = StringIO() except: s = BytesIO() - scipy.misc.toimage(image_numpy).save(s, format="jpeg") + Image.fromarray(image_numpy).save(s, format="jpeg") # Create an Image object img_sum = self.tf.Summary.Image(encoded_image_string=s.getvalue(), height=image_numpy.shape[0], width=image_numpy.shape[1]) # Create a Summary value