0
0
Computer Visionml~10 mins

Augmentation policy search (AutoAugment) 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 import the AutoAugment policy from torchvision.

Computer Vision
from torchvision.transforms import [1]
Drag options to blanks, or click blank then click option'
ANormalize
BAutoAugment
CRandomCrop
DToTensor
Attempts:
3 left
💡 Hint
Common Mistakes
Importing unrelated transforms like RandomCrop or Normalize instead of AutoAugment.
2fill in blank
medium

Complete the code to create an AutoAugment transform with the CIFAR10 policy.

Computer Vision
transform = AutoAugment(policy=[1])
Drag options to blanks, or click blank then click option'
AAutoAugmentPolicy.CIFAR10
BAutoAugmentPolicy.IMAGENET
CAutoAugmentPolicy.SVHN
DAutoAugmentPolicy.MNIST
Attempts:
3 left
💡 Hint
Common Mistakes
Using the ImageNet or SVHN policies which are not suitable for CIFAR10 images.
3fill in blank
hard

Fix the error in applying AutoAugment transform to the dataset.

Computer Vision
dataset = datasets.CIFAR10(root='./data', train=True, download=True, transform=[1])
Drag options to blanks, or click blank then click option'
AAutoAugment()
Btransform()
CAutoAugment
Dtransform
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the class name without parentheses, causing a type error.
4fill in blank
hard

Fill both blanks to create a composed transform with AutoAugment and normalization.

Computer Vision
transform = transforms.Compose([
    AutoAugment(policy=[1]),
    transforms.Normalize(mean=[2], std=[0.247, 0.243, 0.261])
])
Drag options to blanks, or click blank then click option'
AAutoAugmentPolicy.CIFAR10
B[0.4914, 0.4822, 0.4465]
C[0.5, 0.5, 0.5]
DAutoAugmentPolicy.IMAGENET
Attempts:
3 left
💡 Hint
Common Mistakes
Using ImageNet policy or wrong mean values for normalization.
5fill in blank
hard

Fill all three blanks to define a training loop that applies AutoAugment and computes accuracy.

Computer Vision
for images, labels in dataloader:
    images = images.to(device)
    labels = labels.to(device)
    outputs = model([1])
    loss = criterion(outputs, labels)
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    _, predicted = outputs.[2](1)
    correct += (predicted == labels).[3]().item()
Drag options to blanks, or click blank then click option'
Aimages
Bmax
Csum
Dargmax
Attempts:
3 left
💡 Hint
Common Mistakes
Passing labels to the model instead of images.
Using argmax instead of max which returns both values and indices.
Using count() instead of sum() to count correct predictions.