0
0
Computer Visionml~10 mins

Random erasing 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 RandomErasing transform from torchvision.

Computer Vision
from torchvision.transforms import [1]
Drag options to blanks, or click blank then click option'
ANormalize
BRandomErasing
CResize
DToTensor
Attempts:
3 left
💡 Hint
Common Mistakes
Importing unrelated transforms like Resize or Normalize.
Forgetting to import RandomErasing before using it.
2fill in blank
medium

Complete the code to create a RandomErasing transform with a probability of 0.5.

Computer Vision
random_erase = RandomErasing(p=[1])
Drag options to blanks, or click blank then click option'
A0.5
B0.0
C1.0
D2.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a probability greater than 1 or less than 0.
Setting probability to 0 means no erasing happens.
3fill in blank
hard

Fix the error in applying RandomErasing to a tensor image named img.

Computer Vision
erased_img = random_erase([1])
Drag options to blanks, or click blank then click option'
Aimg.numpy()
Bimg.shape
Cimg
Dimg.tolist()
Attempts:
3 left
💡 Hint
Common Mistakes
Passing numpy arrays or lists instead of tensor images.
Passing the shape or other attributes instead of the image tensor.
4fill in blank
hard

Fill both blanks to create a RandomErasing transform with scale between 0.02 and 0.33.

Computer Vision
random_erase = RandomErasing(p=0.5, scale=([1], [2]))
Drag options to blanks, or click blank then click option'
A0.02
B0.5
C0.33
D1.0
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the scale values or using values outside 0-1.
Using the probability value instead of scale values.
5fill in blank
hard

Fill all three blanks to create a RandomErasing transform with probability 0.7, ratio between 0.3 and 3.3, and value 0.

Computer Vision
random_erase = RandomErasing(p=[1], ratio=([2], [3]), value=0)
Drag options to blanks, or click blank then click option'
A0.5
B0.7
C0.3
D3.3
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect probability values outside 0-1.
Swapping ratio values or using invalid ranges.