1. Feature Extraction (특징 추출)
# 백본 완전 고정, 헤드만 학습
for param in model.features.parameters():
param.requires_grad = False
2. Fine-tuning (미세조정)
# 전체 모델 학습 (낮은 학습률)
optimizer = optim.Adam(model.parameters(), lr=1e-5)
3. Progressive Fine-tuning (점진적 미세조정)
# 단계별로 레이어 언프리즈
# 1단계: 헤드만 → 2단계: 마지막 몇 블록 → 3단계: 전체
4. Discriminative Learning Rates
# 레이어별로 다른 학습률 적용
optimizer = optim.Adam([
{'params': model.features.parameters(), 'lr': 1e-5},
{'params': model.classifier.parameters(), 'lr': 1e-3}
])
5. Knowledge Distillation (지식 증류)
# 큰 모델(teacher)의 지식을 MobileNet(student)에 전달
loss = student_loss + distillation_loss
6. Multi-task Learning (멀티태스크)
# 하나의 백본으로 여러 태스크 동시 학습
class MultiTaskMobileNet(nn.Module):
def __init__(self):
self.backbone = mobilenet_v2(pretrained=True).features
self.classifier1 = nn.Linear(1280, num_classes1) # 분류
self.classifier2 = nn.Linear(1280, num_classes2) # 감정인식
7. Pruning + Fine-tuning (가지치기)
# 불필요한 연결 제거 후 재학습
import torch.nn.utils.prune as prune
prune.global_unstructured(parameters_to_prune, pruning_method=prune.L1Unstructured, amount=0.3)
8. Quantization-aware Training (양자화 학습)
# 8bit 양자화를 고려한 학습
model = torch.quantization.prepare_qat(model)
9. Neural Architecture Search (NAS)
- 자동으로 최적 아키텍처 탐색
- MobileNet 블록을 베이스로 새로운 구조 생성
10. Domain Adaptation
# 도메인 간 차이를 줄이는 적대적 학습
domain_classifier = nn.Sequential(...)
11. Few-shot Learning
# 적은 데이터로 빠르게 적응
# Meta-learning, Prototypical Networks 등
12. Self-supervised Pre-training
# 라벨 없는 데이터로 먼저 학습
# SimCLR, BYOL 등의 방법
13. Ensemble Methods
- 여러 MobileNet 모델 조합
- 다양한 데이터 증강으로 학습된 모델들
14. Continual Learning (지속 학습)
- 기존 지식 유지하며 새로운 태스크 학습
- Catastrophic forgetting 방지
용도별 분류:
- 속도 중심: Pruning, Quantization
- 정확도 중심: Ensemble, Knowledge Distillation
- 데이터 부족: Few-shot, Self-supervised
- 다중 도메인: Multi-task, Domain Adaptation
- 지속적 업데이트: Continual Learning
상황과 목적에 따라 이런 다양한 방법들을 조합해서 사용하는 게 일반적이에요!