b591a7aecce5b8de42a0dd7bba62780675d34fce,utils/datasets.py,ImageFolder,__getitem__,#ImageFolder#,39

Before Change


    def __getitem__(self, index):
        img_path = self.files[index % len(self.files)]
        // Extract image
        img = lycon.load(img_path)
        img, _ = pad_to_square(img, 127)
        // Resize
        img = lycon.resize(img, height=self.img_size, width=self.img_size, interpolation=lycon.Interpolation.NEAREST)
        // Channels-first
        img = np.transpose(img, (2, 0, 1))
        // As pytorch tensor
        img = torch.from_numpy(img).float() / 255.0

        return img_path, img

    def __len__(self):

After Change


        // Pad to square resolution
        img, _ = pad_to_square(img, 0)
        // Resize
        img = resize(img.unsqueeze(0), self.img_size).squeeze(0)

        return img_path, img
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: eriklindernoren/PyTorch-YOLOv3
Commit Name: b591a7aecce5b8de42a0dd7bba62780675d34fce
Time: 2019-04-30
Author: eriklindernoren@live.se
File Name: utils/datasets.py
Class Name: ImageFolder
Method Name: __getitem__


Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 4586366c1018257dd448d62f1fc7534e3f5a4338
Time: 2017-11-23
Author: ikostrikov@gmail.com
File Name: enjoy.py
Class Name:
Method Name:


Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: b25cc3a7e6a560c1fd47f36a43296f62eaaace36
Time: 2019-12-07
Author: jadore801120@gmail.com
File Name: transformer/Translator.py
Class Name: Translator
Method Name: __init__