diff --git a/data.py b/data.py index e0e9f06..a84e1ef 100644 --- a/data.py +++ b/data.py @@ -39,7 +39,7 @@ def next_crop(self, for_g, idx): """Return a crop according to the pre-determined list of indices. Noise is added to crops for D""" size = self.g_input_shape if for_g else self.d_input_shape top, left = self.get_top_left(size, for_g, idx) - crop_im = self.input_image[top:top + size, left:left + size, :] + crop_im = self.input_image[top:top + size, left:left + size, :].copy() if not for_g: # Add noise to the image for d crop_im += np.random.randn(*crop_im.shape) / 255.0 return im2tensor(crop_im) @@ -77,4 +77,4 @@ def get_top_left(self, size, for_g, idx): row, col = int(center / self.in_cols), center % self.in_cols top, left = min(max(0, row - size // 2), self.in_rows - size), min(max(0, col - size // 2), self.in_cols - size) # Choose even indices (to avoid misalignment with the loss map for_g) - return top - top % 2, left - left % 2 \ No newline at end of file + return top - top % 2, left - left % 2