コード例 #1
0
 def _add_random_erasing(self):
     transform = transforms.random_erasing(
         self.config['random_erasing_prob'],
         self.config['random_erasing_area_ratio_range'],
         self.config['random_erasing_min_aspect_ratio'],
         self.config['random_erasing_max_attempt'])
     self._train_transforms.append(transform)
コード例 #2
0
 def _get_random_erasing_train_transform(self):
     transform = torchvision.transforms.Compose([
         transforms.normalize(self.mean, self.std),
         transforms.random_erasing(
             self.config['random_erasing_prob'],
             self.config['random_erasing_area_ratio_range'],
             self.config['random_erasing_min_aspect_ratio'],
             self.config['random_erasing_max_attempt']),
         transforms.to_tensor(),
     ])
     return transform
コード例 #3
0
 def _get_random_erasing_train_transform(self):
     transform = torchvision.transforms.Compose([
         torchvision.transforms.Resize((32,32)),
         torchvision.transforms.ColorJitter(0.1,0.1,0.1),
         # torchvision.transforms.RandomRotation(15),
         # RandomAffine(degrees=15,scale=(0.8,1.2),shear=15),
         torchvision.transforms.RandomCrop(32, padding=4),
         torchvision.transforms.RandomHorizontalFlip(),
         transforms.normalize(self.mean, self.std),
         transforms.random_erasing(
             self.config['random_erasing_prob'],
             self.config['random_erasing_area_ratio_range'],
             self.config['random_erasing_min_aspect_ratio'],
             self.config['random_erasing_max_attempt']),
         transforms.to_tensor(),
     ])
     return transform