Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
return top - top % 2, left - left % 2