summaryrefslogtreecommitdiff
path: root/data/aligned_dataset.py
diff options
context:
space:
mode:
authorYour Name <you@example.com>2018-01-12 17:39:48 +0000
committerYour Name <you@example.com>2018-01-12 17:39:48 +0000
commitfab32096653573c0ecb8814fe4e3ca81cffc322d (patch)
tree1a646b4bb8e0fab1c0b7623430211af67a3cc5c6 /data/aligned_dataset.py
parent929454c133fb19c03264b00179dae25f458efd36 (diff)
Should normalize input and truth images separately
Diffstat (limited to 'data/aligned_dataset.py')
-rw-r--r--data/aligned_dataset.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/data/aligned_dataset.py b/data/aligned_dataset.py
index bccd6fc..08155c8 100644
--- a/data/aligned_dataset.py
+++ b/data/aligned_dataset.py
@@ -27,7 +27,7 @@ class AlignedDataset(BaseDataset):
AB_path = self.AB_paths[index]
AB = Image.open(AB_path).convert('RGB')
AB = AB.resize((self.opt.loadSize * 2, self.opt.loadSize), Image.BICUBIC)
- AB = self.transform(AB)
+ AB = transforms.ToTensor()(AB)
w_total = AB.size(2)
w = int(w_total / 2)
@@ -40,6 +40,9 @@ class AlignedDataset(BaseDataset):
B = AB[:, h_offset:h_offset + self.opt.fineSize,
w + w_offset:w + w_offset + self.opt.fineSize]
+ A = transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))(A)
+ B = transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))(B)
+
if self.opt.which_direction == 'BtoA':
input_nc = self.opt.output_nc
output_nc = self.opt.input_nc