Complete the code to apply a horizontal flip to an image using torchvision transforms.
transform = torchvision.transforms.Compose([torchvision.transforms.[1]()])The RandomHorizontalFlip transform flips images horizontally, creating new variations and thus multiplying training data.
Complete the code to create augmented data by rotating images randomly within 30 degrees.
transform = torchvision.transforms.Compose([torchvision.transforms.RandomRotation([1])])RandomRotation with 30 degrees rotates images randomly between -30 and +30 degrees, increasing data variety.
Fix the error in the code to correctly apply color jitter augmentation.
transform = torchvision.transforms.ColorJitter(brightness=[1])The brightness parameter expects a float number, not a string or list. So 0.5 is correct.
Fill both blanks to create a dictionary comprehension that maps each image filename to its augmented version using a horizontal flip.
augmented_images = {filename: transform([1]) for filename, [2] in images.items()}The dictionary comprehension uses img as the input to transform and img as the variable for image data in the loop.
Fill all three blanks to create a dictionary comprehension that filters images with width greater than 100 and applies a rotation augmentation.
augmented = {name: transform([1]) for name, [2] in dataset.items() if [3].width > 100}The comprehension uses img as input to transform, img as loop variable, and checks img.width for filtering.