Normalization 이 deep network 를 trainable 하게 만든 것
Normalization layer 가 activation 을 re-center 와 re-scale 해서 training 안정화. 세 흔한 variant — 그리고 교환 가능 X; 작업 shape 으로 골라:
- BatchNorm2d — 각 channel 에 대해 batch 전체에 걸쳐 normalize. CNN 에 표준. stats 잘 estimate 위해 합리적으로 큰 batch (보통 16+) 필요.
train()vseval()행동 switch: training 은 batch stats, eval 은 running mean / running var (buffer) 사용. - LayerNorm — feature dim 에 걸쳐 sample 별 normalize. Transformer 에 표준 — batch size 무관하고 inference 행동 안정.
- GroupNorm — channel 을 group 으로 split 해서 각 group 안에서 normalize. batch size 어느 거나 (1 도) 작동. object detection (COCO, GPU 당 batch=2 흔함) 와 일부 vision Transformer 에 사용.
왜 BatchNorm 어디나 X?
BatchNorm 이 batch 안 sample 사이 정보 leak (각 sample 의 normalization 이 다른 것에 의존), 일부 setup (RNN step, multi-task, batch coupling 원치 않는 contrastive learning) 에 나쁨. 작은 batch 와 single sample 의 inference time 에도 fragile. LayerNorm 이 이 모든 거 회피 — Transformer 가 그걸로 settle 한 이유.
Pooling
MaxPool2d 가 각 window 의 max, AvgPool2d 가 평균. AdaptiveAvgPool2d(out_size) 가 modern hero — 요청된 output 생산하는 옳은 window size 알아냄. CNN backbone 끝에 AdaptiveAvgPool2d(1) 둬서 input image size 무관하게 single feature vector.