Complete the code to apply a horizontal flip to the image using torchvision transforms.
transform = torchvision.transforms.Compose([torchvision.transforms.[1]()])The RandomHorizontalFlip transform flips the image horizontally, which is a common augmentation technique.
Complete the code to apply a random rotation of up to 30 degrees to the image.
transform = torchvision.transforms.RandomRotation([1])The argument 30 means the image will be randomly rotated between -30 and +30 degrees.
Fix the error in the code to correctly apply color jitter with brightness change.
transform = torchvision.transforms.ColorJitter(brightness=[1])The brightness parameter expects a float like 0.5 to control brightness jitter.
Fill both blanks to create a transform that resizes images to 128x128 and then converts them to tensors.
transform = torchvision.transforms.Compose([torchvision.transforms.Resize([1]), torchvision.transforms.[2]()])
Resize expects a size tuple like (128, 128). To convert images to tensors, use ToTensor.
Fill all three blanks to create a transform pipeline that randomly crops 100x100 patches, applies horizontal flip, and normalizes with mean 0.5 and std 0.5.
transform = torchvision.transforms.Compose([
torchvision.transforms.RandomCrop([1]),
torchvision.transforms.[2](),
torchvision.transforms.Normalize(mean=[[3]], std=[0.5])
])RandomCrop needs the crop size tuple (100, 100). The horizontal flip transform is RandomHorizontalFlip. The mean for normalization is 0.5.