Fix bug that target needs to be cropped with upsampled size

This commit is contained in:
Yin Li 2020-01-23 09:29:43 -05:00
parent 6938eea089
commit 6c030f1eb1

View File

@ -114,7 +114,8 @@ class FieldDataset(Dataset):
tgt_fields = [np.load(f) for f in self.tgt_files[idx]] tgt_fields = [np.load(f) for f in self.tgt_files[idx]]
in_fields = crop(in_fields, start, self.crop, self.pad, self.scale_factor) in_fields = crop(in_fields, start, self.crop, self.pad, self.scale_factor)
tgt_fields = crop(tgt_fields, start, self.crop, np.zeros_like(self.pad)) tgt_fields = crop(tgt_fields, start * self.scale_factor,
self.crop * self.scale_factor, np.zeros_like(self.pad))
in_fields = [torch.from_numpy(f).to(torch.float32) for f in in_fields] in_fields = [torch.from_numpy(f).to(torch.float32) for f in in_fields]
tgt_fields = [torch.from_numpy(f).to(torch.float32) for f in tgt_fields] tgt_fields = [torch.from_numpy(f).to(torch.float32) for f in tgt_fields]