0
0
Computer Visionml~10 mins

Image augmentation transforms in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to apply a horizontal flip to the image using torchvision transforms.

Computer Vision
transform = torchvision.transforms.Compose([torchvision.transforms.[1]()])
Drag options to blanks, or click blank then click option'
ARandomHorizontalFlip
BRandomVerticalFlip
CColorJitter
DRandomRotation
Attempts:
3 left
💡 Hint
Common Mistakes
Using RandomVerticalFlip instead flips the image upside down.
Using ColorJitter changes colors, not flips.
RandomRotation rotates the image, not flips.
2fill in blank
medium

Complete the code to apply a random rotation of up to 30 degrees to the image.

Computer Vision
transform = torchvision.transforms.RandomRotation([1])
Drag options to blanks, or click blank then click option'
A15
B30
C45
D60
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 15 rotates less than asked.
Choosing 45 or 60 rotates more than asked.
3fill in blank
hard

Fix the error in the code to correctly apply color jitter with brightness change.

Computer Vision
transform = torchvision.transforms.ColorJitter(brightness=[1])
Drag options to blanks, or click blank then click option'
A'0.5'
B50
C0.5
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string '0.5' causes a type error.
Using 50 is too large and invalid.
Using True is not a valid brightness value.
4fill in blank
hard

Fill both blanks to create a transform that resizes images to 128x128 and then converts them to tensors.

Computer Vision
transform = torchvision.transforms.Compose([torchvision.transforms.Resize([1]), torchvision.transforms.[2]()])
Drag options to blanks, or click blank then click option'
A(128, 128)
BToTensor
CNormalize
DCenterCrop
Attempts:
3 left
💡 Hint
Common Mistakes
Using Normalize instead of ToTensor won't convert image format.
Using CenterCrop changes image size differently.
Passing a single int instead of tuple to Resize changes aspect ratio.
5fill in blank
hard

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.

Computer Vision
transform = torchvision.transforms.Compose([
    torchvision.transforms.RandomCrop([1]),
    torchvision.transforms.[2](),
    torchvision.transforms.Normalize(mean=[[3]], std=[0.5])
])
Drag options to blanks, or click blank then click option'
A(100, 100)
BRandomHorizontalFlip
C0.5
DRandomVerticalFlip
Attempts:
3 left
💡 Hint
Common Mistakes
Using RandomVerticalFlip flips vertically, not horizontally.
Using mean other than 0.5 changes normalization.
Passing single int instead of tuple to RandomCrop changes behavior.