AutoAugment
is the new stable feature that is introduced in torchvison 0.9.0.
Currently there seems no docs about AutoAugment
yet, and I can only get some information from the release blog.
However, I have some confusions, especially about the recommend usage for CIFAR10 and ImageNet. What’s the correct way to use AutoAugment
for CIFAR10 and ImageNet?
ImageNet
For ImageNet, my previous conventional transform is
if mode == 'train':
transform = transforms.Compose([
transforms.RandomResizedCrop((224, 224)),
transforms.RandomHorizontalFlip(),
transforms.ToTensor()])
else:
transform = transforms.Compose([
transforms.Resize((256, 256)),
transforms.CenterCrop((224, 224)),
transforms.ToTensor()])
I assume the example in the blog is the recommend transform for ImageNet, but it doesn’t seem to resize(random crop) the shape to 224.
transform=transforms.Compose([
transforms.Resize(256),
transforms.AutoAugment(),
transforms.ToTensor()])
So I doubt whether it is necessary to add one more RandomCrop (or a single center crop)
transform=transforms.Compose([
transforms.Resize(256),
transforms.AutoAugment(),
transforms.RandomResizedCrop((224, 224)), # transforms.CenterCrop((224, 224)),
transforms.ToTensor()])
CIFAR10
For CIFAR10, my previous conventional transform is
if mode == 'train':
transform = transforms.Compose([
transforms.RandomCrop((32, 32), padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor()])
else:
transform = transforms.ToTensor()
I doubt when we use AutoAugment, do we need to add the 4-pad and conduct RandomCrop.