in data_utils/functions_bis.py [0:0]
def return_augmentations_types(args):
if args.tvalues is None:
args.tvalues = [1,1]
normalize = transforms.Normalize(
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
)
scale_magnitudes = np.linspace(1,6,15)
interpolation = transforms.RandomResizedCrop(224).interpolation
augmentations = {}
print(args.scale_mag, 1./scale_magnitudes[args.scale_mag]**2)
interpolation = transforms.RandomResizedCrop(224).interpolation
augmentations["C"] = transforms.Compose(
[
transforms.RandomResizedCrop(
224
), # resize is not needed since the crop will be in function of the size and ratio of the image
transforms.ToTensor(),
normalize,
]
)
augmentations["Cvary"] = transforms.Compose(
[
transforms.Resize(256), # ensures that the minimal size is 256
transforms.CenterCrop(224),
RandomSizeResizedCenterCrop(
224,
scale=(1./scale_magnitudes[args.scale_mag]**2,1.),
ratio=(1.,1.), interpolation=interpolation
),
transforms.ToTensor(),
normalize,
]
)
augmentations["None"] = transforms.Compose(
[
transforms.Resize(256), # ensures that the minimal size is 256
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize,
]
)
return augmentations