From 1ff0da21658a9027b1a83fa31ff89e9da6938780 Mon Sep 17 00:00:00 2001 From: Itai Caspi Date: Mon, 13 Nov 2017 12:22:32 +0200 Subject: [PATCH] bug fix - fixed an issue with gifs dumping and bumped up Pillow version to 4.3.0 --- logger.py | 5 ++--- requirements_coach.txt | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/logger.py b/logger.py index 8e85b37..11458a8 100644 --- a/logger.py +++ b/logger.py @@ -192,15 +192,14 @@ class Logger(BaseLogger): if self.start_time: self.create_signal_value('Wall-Clock Time', time.time() - self.start_time, time=episode) - def create_gif(self, images, fps=25, name="Gif"): + def create_gif(self, images, fps=10, name="Gif"): output_file = '{}_{}.gif'.format(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S'), name) output_dir = os.path.join(self.experiments_path, 'gifs') if not os.path.exists(output_dir): os.makedirs(output_dir) output_path = os.path.join(output_dir, output_file) - gif = Image.new('RGB', images[0].transpose(1, 0, 2).shape[:2]) pil_images = [Image.fromarray(image) for image in images] - gif.save(output_path, save_all=True, append_images=pil_images, duration=1.0 / fps, loop=0) + pil_images[0].save(output_path, save_all=True, append_images=pil_images[1:], duration=1.0 / fps, loop=0) global logger diff --git a/requirements_coach.txt b/requirements_coach.txt index e10f6eb..799820b 100644 --- a/requirements_coach.txt +++ b/requirements_coach.txt @@ -1,5 +1,5 @@ annoy==1.8.3 -Pillow==4.1.1 +Pillow==4.3.0 matplotlib==2.0.2 numpy==1.13.0 pandas==0.20.2