61228f3243eaee39cba31a9abd2afc6ead9612a8,implementations/discogan/datasets.py,ImageDataset,__getitem__,#ImageDataset#Any#,15
Before Change
img_pair = self.transform(Image.open(self.files[index % len(self.files)]))
_, h, w = img_pair.shape
half_w = int(w/2)
item_A = img_pair[:, :, :half_w]
item_B = img_pair[:, :, half_w:]
After Change
img = Image.open(self.files[index % len(self.files)])
w, h = img.size
img_A = img.crop((0, 0, w/2, h))
img_B = img.crop((w/2, 0, w, h))
if np.random.random() < 0.5:
img_A = Image.fromarray(np.array(img_A)[:, ::-1, :], "RGB")
img_B = Image.fromarray(np.array(img_B)[:, ::-1, :], "RGB")
img_A = self.transform(img_A)
img_B = self.transform(img_B)
return {"A": img_A, "B": img_B}
def __len__(self):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 27
Instances
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 61228f3243eaee39cba31a9abd2afc6ead9612a8
Time: 2018-05-04
Author: eriklindernoren@gmail.com
File Name: implementations/discogan/datasets.py
Class Name: ImageDataset
Method Name: __getitem__
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 61228f3243eaee39cba31a9abd2afc6ead9612a8
Time: 2018-05-04
Author: eriklindernoren@gmail.com
File Name: implementations/discogan/datasets.py
Class Name: ImageDataset
Method Name: __getitem__
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 61228f3243eaee39cba31a9abd2afc6ead9612a8
Time: 2018-05-04
Author: eriklindernoren@gmail.com
File Name: implementations/bicyclegan/datasets.py
Class Name: ImageDataset
Method Name: __getitem__
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 9e3ac57d2a0480ded339841dda18b13e2645987f
Time: 2018-05-12
Author: eriklindernoren@gmail.com
File Name: implementations/dualgan/datasets.py
Class Name: ImageDataset
Method Name: __getitem__
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 61228f3243eaee39cba31a9abd2afc6ead9612a8
Time: 2018-05-04
Author: eriklindernoren@gmail.com
File Name: implementations/pix2pix/datasets.py
Class Name: ImageDataset
Method Name: __getitem__