Model Pipeline - Data augmentation
Data augmentation is a technique to create more training data by making small changes to existing images. This helps the model learn better by seeing many versions of the same image.
Jump into concepts and practice - no test required
Data augmentation is a technique to create more training data by making small changes to existing images. This helps the model learn better by seeing many versions of the same image.
Loss
1.2 |****
0.9 |***
0.7 |**
0.55|*
0.45|
+------------
Epochs 1 to 5| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 1.2 | 0.45 | Model starts learning with high loss and low accuracy |
| 2 | 0.9 | 0.60 | Loss decreases and accuracy improves as model learns |
| 3 | 0.7 | 0.72 | Model continues to improve with augmented data |
| 4 | 0.55 | 0.80 | Loss lowers and accuracy rises steadily |
| 5 | 0.45 | 0.85 | Model shows good learning progress with augmentation |
transform = transforms.Compose([
transforms.RandomRotation(30),
transforms.ToTensor()
])
image = Image.open('sample.jpg')
tensor_image = transform(image)
print(tensor_image.shape)transform = transforms.Compose([
transforms.RandomHorizontalFlip(prob=0.5),
transforms.RandomRotation(degrees=45),
transforms.ToTensor()
])Options: A) RandomHorizontalFlip(p=0.5) + RandomRotation(15) + ColorJitter(brightness=0.2) B) RandomResizedCrop(size=224) + Grayscale(num_output_channels=1) C) RandomVerticalFlip(p=1.0) + RandomRotation(90) + ToTensor() D) Resize(128) + RandomCrop(64) + RandomHorizontalFlip(p=0.5)