In the past, I thought transforms.RandomResizedCrop
is used for data augmentation because it will random scale the image and crop it, and then resize it to the demanded size. And the data augmentation part in my code is usually as follows:
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
train_transform = transforms.Compose([transforms.RandomHorizontalFlip(),
transforms.RandomResizedCrop(224),
transforms.ToTensor(),
normalize])
But I have just check the mannual and it says that
A crop of random size (default: of 0.08 to 1.0) of the original size
According to the comment, it may only get a very very small part of the original image after cropping considering that the scale range from 0.08 to 1.0. In that way, it will be harmful for training.
Do I misunderstand this function? Is it used for data augmentation?
And is it necessary to specifically assign the scale parameter as follows if I want to use it for data augmentation?
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
train_transform = transforms.Compose([transforms.RandomHorizontalFlip(),
transforms.RandomResizedCrop(224, scale=(0.7, 1.0),
transforms.ToTensor(),
normalize])
Any suggestion will be helpful.
Thank you!