Fine-Tuning Strategy
Phase 1: Train head only (5 epochs)
model = EfficientNet.from_pretrained('efficientnet-b4')
for param in model.parameters():
param.requires_grad = False
# Unfreeze classifier
for param in model._fc.parameters():
param.requires_grad = True
Phase 2: Unfreeze top blocks (10 epochs)
for param in model._blocks[-20:].parameters():
param.requires_grad = True
Phase 3: Full fine-tune with low LR (10 epochs)
optimizer = AdamW(model.parameters(), lr=1e-5)
Label Smoothing
criterion = nn.CrossEntropyLoss(label_smoothing=0.1)
Reduces overconfidence — typically +1-2% accuracy on small datasets.