Recall & Review
beginner
What is data augmentation in machine learning?
Data augmentation is a technique to increase the size and diversity of training data by making small changes to existing data, like flipping or rotating images. This helps models learn better and avoid overfitting.
Click to reveal answer
beginner
Name two common image data augmentation techniques.
Two common image data augmentation techniques are flipping (horizontal or vertical) and rotation by small angles. These create new images that help the model see different views of the same object.
Click to reveal answer
intermediate
How does data augmentation help prevent overfitting?
Data augmentation adds variety to training data, so the model doesn't memorize exact examples. This makes the model generalize better to new data, reducing overfitting.
Click to reveal answer
beginner
Show a simple PyTorch code snippet to apply random horizontal flip to images during training.
from torchvision import transforms
transform = transforms.Compose([
transforms.RandomHorizontalFlip(p=0.5),
transforms.ToTensor()
])
This code flips images horizontally with 50% chance before converting them to tensors.Click to reveal answer
intermediate
What is the difference between online and offline data augmentation?
Offline augmentation creates new data files before training, increasing dataset size on disk. Online augmentation applies random changes on the fly during training, saving storage and adding variety each epoch.
Click to reveal answer
Which of the following is NOT a typical data augmentation technique for images?
✗ Incorrect
Changing the image file format does not augment the image content or variety; it only changes how the image is stored.
Why do we use data augmentation in training machine learning models?
✗ Incorrect
Data augmentation increases the size and diversity of training data, helping models learn better.
In PyTorch, which module provides common data augmentation transforms?
✗ Incorrect
torchvision.transforms contains many useful image augmentation functions.
What does RandomHorizontalFlip(p=0.5) do during training?
✗ Incorrect
It flips each image horizontally with a probability of 0.5.
Which is a benefit of online data augmentation over offline augmentation?
✗ Incorrect
Online augmentation applies random changes during training, so data varies each epoch.
Explain what data augmentation is and why it is useful in training machine learning models.
Think about how changing images slightly can help a model learn better.
You got /4 concepts.
Describe how you would implement data augmentation in a PyTorch image classification project.
Focus on the code steps to add augmentation before feeding images to the model.
You got /4 concepts.