From 4310e6684816493ca36d7a4a524911f6de12106a Mon Sep 17 00:00:00 2001 From: James Betker Date: Wed, 16 Dec 2020 09:41:59 -0700 Subject: [PATCH] Fix bug in 'corrupt_before_downsize=true' --- codes/data/base_unsupervised_image_dataset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codes/data/base_unsupervised_image_dataset.py b/codes/data/base_unsupervised_image_dataset.py index 53d2ca9c..499dc258 100644 --- a/codes/data/base_unsupervised_image_dataset.py +++ b/codes/data/base_unsupervised_image_dataset.py @@ -4,6 +4,7 @@ from data.image_corruptor import ImageCorruptor from data.chunk_with_reference import ChunkWithReference import os import cv2 +import numpy as np # Class whose purpose is to hold as much logic as can possibly be shared between datasets that operate on raw image # data and nothing else (which also have a very specific directory structure being used, as dictated by @@ -101,7 +102,7 @@ class BaseUnsupervisedImageDataset(data.Dataset): h, w, _ = hs[0].shape ls, lrs, lms, lcs = [], [], [], [] if self.corrupt_before_downsize and not self.for_eval: - hs = self.corruptor.corrupt_images(hs) + hs = self.corruptor.corrupt_images(np.copy(hs)) for hq, hq_ref, hq_mask, hq_center in zip(hs, hrefs, hmasks, hcenters): if self.for_eval: ls.append(hq)