Random Erasing is a data augmentation technique where a random rectangle area in an image is erased (filled with random values or a constant) during training to help the model learn better and avoid overfitting.
Click to reveal answer
beginner
Why do we use Random Erasing during training?
We use Random Erasing to make the model more robust by forcing it to focus on different parts of the image, not just the most obvious features. This helps the model generalize better to new images.
Click to reveal answer
intermediate
How does Random Erasing differ from other augmentations like flipping or rotation?
Unlike flipping or rotation which change the whole image orientation, Random Erasing removes or hides a small part of the image randomly, simulating occlusion or missing parts to improve model resilience.
Click to reveal answer
intermediate
What parameters control the Random Erasing process?
Key parameters include the size range of the erased area, the aspect ratio of the erased rectangle, and the probability of applying erasing to each image during training.
Click to reveal answer
beginner
Can Random Erasing be used during model testing or only training? Why?
Random Erasing is used only during training to improve learning. During testing, images should remain unchanged to fairly evaluate the model's performance on real data.
Click to reveal answer
What is the main goal of Random Erasing in training?
ATo flip the image horizontally
BTo increase image brightness
CTo hide parts of the image randomly to improve model robustness
DTo crop the image to a smaller size
✗ Incorrect
Random Erasing hides random parts of the image to help the model learn to recognize objects even if parts are missing.
Which of these is NOT a parameter of Random Erasing?
AProbability of erasing
BNumber of image channels
CColor of erased area
DSize of erased area
✗ Incorrect
Number of image channels is a property of the image, not a parameter controlling Random Erasing.
When should Random Erasing be applied?
AOnly during training
BOnly during testing
CDuring both training and testing
DNever
✗ Incorrect
Random Erasing is a training augmentation technique and should not be applied during testing.
Random Erasing helps the model to:
AIncrease image resolution
BIgnore all image features
CFocus only on the center of the image
DGeneralize better by learning from incomplete images
✗ Incorrect
By erasing parts randomly, the model learns to recognize objects even when parts are missing.
Which augmentation is most similar in purpose to Random Erasing?
ACutout
BImage flipping
CColor jittering
DRotation
✗ Incorrect
Cutout also removes parts of the image randomly, similar to Random Erasing.
Explain what Random Erasing is and why it helps in training computer vision models.
Think about how hiding parts of an image can help a model learn better.
You got /4 concepts.
Describe the key parameters that control how Random Erasing works.
Consider what controls how often and how big the erased parts are.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of random erasing in computer vision training?
easy
A. To hide random parts of images to improve model robustness
B. To increase image resolution during training
C. To convert images to grayscale
D. To add noise to the entire image
Solution
Step 1: Understand random erasing concept
Random erasing hides random parts of images during training to simulate missing or blocked areas.
Step 2: Identify the main goal
This helps the model learn to recognize objects even if parts are missing, improving robustness.
Final Answer:
To hide random parts of images to improve model robustness -> Option A
Quick Check:
Random erasing = hiding parts for robustness [OK]
Hint: Random erasing hides parts, not changes resolution or color [OK]
Common Mistakes:
Confusing random erasing with image resizing
Thinking it adds noise to the whole image
Believing it converts images to grayscale
2. Which of the following is the correct way to apply random erasing using PyTorch's torchvision transforms?
easy
A. transforms.RandomErase(p=0.5, scale=(0.02, 0.33), ratio=(0.3, 3.3))
B. transforms.RandomErased(p=0.5, scale=(0.02, 0.33), ratio=(0.3, 3.3))
C. transforms.RandomErasing(p=0.5, scale=(0.02, 0.33), ratio=(0.3, 3.3))
D. transforms.RandomEraseArea(p=0.5, scale=(0.02, 0.33), ratio=(0.3, 3.3))
Solution
Step 1: Recall PyTorch transform name
The correct class name is RandomErasing in torchvision.transforms.
Step 2: Check method parameters
Parameters like p, scale, and ratio are valid for RandomErasing.
Final Answer:
transforms.RandomErasing(p=0.5, scale=(0.02, 0.33), ratio=(0.3, 3.3)) -> Option C
Quick Check:
Correct class name and parameters = transforms.RandomErasing(p=0.5, scale=(0.02, 0.33), ratio=(0.3, 3.3)) [OK]
Hint: Remember exact class name: RandomErasing (no spaces or misspellings) [OK]
Common Mistakes:
Misspelling the class name as RandomErase or RandomErased
Using incorrect parameter names
Confusing with other augmentation transforms
3. Consider this PyTorch code snippet applying random erasing:
D. RandomErasing expects a tensor, not a PIL image
Solution
Step 1: Check input type for RandomErasing
RandomErasing in torchvision expects a tensor input, not a PIL image.
Step 2: Identify missing transform step
Missing transforms.ToTensor() before RandomErasing causes type error.
Final Answer:
RandomErasing expects a tensor, not a PIL image -> Option D
Quick Check:
RandomErasing input = tensor, not PIL [OK]
Hint: Always convert PIL image to tensor before RandomErasing [OK]
Common Mistakes:
Passing PIL images directly to RandomErasing
Assuming p must be 1.0 to work
Thinking RandomErasing only works on grayscale
5. You want to improve your image classifier's robustness by combining random erasing with another augmentation. Which combination below is best practice?
hard
A. Use random erasing after converting images to tensors and normalize them
B. Apply random erasing before resizing images to fixed size
C. Apply random erasing on raw PIL images without any other transforms
D. Use random erasing only during testing, not training
Solution
Step 1: Understand transform order
Random erasing requires tensor input, so it must come after ToTensor().
Step 2: Combine with normalization
Normalization after tensor conversion is standard; random erasing fits well after these steps during training.
Step 3: Avoid applying random erasing before resizing or during testing
Applying before resizing can cause errors; random erasing is a training augmentation only.
Final Answer:
Use random erasing after converting images to tensors and normalize them -> Option A
Quick Check:
Random erasing after ToTensor and normalize = best practice [OK]
Hint: Random erasing after ToTensor and normalize during training [OK]
Common Mistakes:
Applying random erasing on raw PIL images
Using random erasing during testing phase
Applying random erasing before resizing images
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.