Пример #1
0
 def conformity_transform(self):
     return transforms.Compose([
         ExpandRGBChannels(),
         transforms.ToPILImage(),
         transforms.Resize((32, 32)),
         transforms.ToTensor(),
     ])
Пример #2
0
 def conformity_transform(self):
     target = self.image_size[0]
     if self.source_data.shrink_channels:
         return transforms.Compose([
             ExpandRGBChannels(),
             transforms.ToPILImage(),
             transforms.Grayscale(),
             transforms.Resize((target, target)),
             transforms.ToTensor()
         ])
     else:
         return transforms.Compose([
             ExpandRGBChannels(),
             transforms.ToPILImage(),
             transforms.Resize((target, target)),
             transforms.ToTensor(),
         ])
Пример #3
0
 def conformity_transform(self):
     target = 96
     if self.downsample is not None:
         target = self.downsample
     out_transform = transforms.Compose([ExpandRGBChannels(),
                                transforms.ToPILImage(),
                                transforms.Resize((target, target)),
                                transforms.ToTensor(),
                                ])
     return out_transform
Пример #4
0
 def conformity_transform(self):
     target = 224
     if self.downsample is not None:
         target = self.downsample
     if self.shrink_channels:
         return transforms.Compose([
             ExpandRGBChannels(),
             transforms.ToPILImage(),
             transforms.Grayscale(),
             transforms.Resize((target, target)),
             transforms.ToTensor()
         ])
     else:
         return transforms.Compose([
             ExpandRGBChannels(),
             transforms.ToPILImage(),
             transforms.Resize((target, target)),
             transforms.ToTensor(),
             #transforms.Lambda(lambda x: x.repeat(3, 1, 1)),
         ])
Пример #5
0
    def __init__(self, source_data, downsample):
        super(PCAMResize, self).__init__()
        self.name = source_data.name
        if source_data.shrink_channels:
            transform_list = [
                ExpandRGBChannels(),
                transforms.ToPILImage(),
                transforms.Grayscale(),
                transforms.Resize((downsample, downsample)),
                transforms.ToTensor(),
            ]
        else:
            transform_list = [
                ExpandRGBChannels(),
                transforms.ToPILImage(),
                transforms.Resize((downsample, downsample)),
                transforms.ToTensor(),
            ]

        self.transform = transforms.Compose(transform_list)
        self.image_size = (downsample, downsample)
        self.source_data = source_data
Пример #6
0
 def conformity_transform(self):
     target = 224
     if self.downsample is not None:
         target = self.downsample
     if self.expand_channels:
         return transforms.Compose([
             ExpandRGBChannels(),
             transforms.ToPILImage(),
             transforms.Resize((target, target)),
             transforms.ToTensor()
         ])
     else:
         return transforms.Compose([
             transforms.ToPILImage(),
             transforms.Grayscale(),
             transforms.Resize((target, target)),
             transforms.ToTensor()
         ])