From 51d6ed427d9dbd5851c4511ec3577ea2a10b83da Mon Sep 17 00:00:00 2001
From: Daniel Ecer <de-code@users.noreply.github.com>
Date: Wed, 2 Aug 2017 12:03:22 +0100
Subject: [PATCH] fixed combined image didn't include last layer

---
 sciencebeam_gym/trainer/models/pix2pix/pix2pix_model.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sciencebeam_gym/trainer/models/pix2pix/pix2pix_model.py b/sciencebeam_gym/trainer/models/pix2pix/pix2pix_model.py
index 4c14ef2..88d5934 100644
--- a/sciencebeam_gym/trainer/models/pix2pix/pix2pix_model.py
+++ b/sciencebeam_gym/trainer/models/pix2pix/pix2pix_model.py
@@ -162,6 +162,9 @@ def combine_image(batch_images, replace_black_with_white=False):
     combined_image = replace_black_with_white_color(combined_image)
   return combined_image
 
+def remove_last(a):
+  return a[:-1]
+
 def add_model_summary_images(
   tensors, dimension_colors, dimension_labels,
   use_separate_channels=False,
@@ -190,7 +193,11 @@ def add_model_summary_images(
         outputs,
         dimension_colors_with_unknown
       )
-      batch_images_excluding_unknown = batch_images[:-2] if has_unknown_class else batch_images
+      batch_images_excluding_unknown = (
+        remove_last(batch_images)
+        if has_unknown_class
+        else batch_images
+      )
       for i, (batch_image, dimension_label) in enumerate(zip(
         batch_images, dimension_labels_with_unknown)):
 
-- 
GitLab