I want to dividing pre-processing code of CNN

Hi, All.
This is a pre-processing code of CNN.

data_transforms = {

‘train’: transforms.Compose([

transforms.RandomResizedCrop(224),

transforms.RandomHorizontalFlip(),

transforms.ToTensor(),

transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])

]),

‘val’: transforms.Compose([

transforms.Resize(256),

transforms.CenterCrop(224),

transforms.ToTensor(),

transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])

]),

}

I want to change this code to divie code that convert all input images(512x256) to 256x256 images.(x2 augmentation effect)

How can I code?

Thanks.
Best,
@bemoregt.

transforms.Resize((256,256)) should work, if you want to resize them.

1 Like

I want to not resize but divide.

Thanks at any rate …

Could you please tell what you mean by divide.
If you are referring to dividing (512) into two parts of 256 and 256, then I guess random crop could work in this case but I am not sure if all the crops are exclusive of each other or not. If they are not, then you can increase the augmentation by more than 2* factor and of they are, then I guess it would be 2* augmentation.

1 Like