1. Introduction
[Problem]: Online Class-Incremental Continual Learning
[Dataset]: Non-i.i.d streaming data (각 샘플은 한번만 보여짐)
[Approach]: Replay method
[Main Issue]:
- 제한된 replay buffer로 인한 오래된 클래스들과 최근 클래스들 사이의 imbalance
- 특히, softmax 분류기와 FC layer는 class imbalance에 심각하게 영향을 받음
- Recency Bias : 모델이 최근 클래스들에 편향되게 학습되는 경향이 있음
[Contribution]:
- Softmax classifier의 결점들을 해결하기 위해 NCM을 사용
- NCM의 정확도 향상을 위해 supervised contrastive learning을 experience replay-based training과 결합
2. Method
2.1. Softmax Classifier vs. NCM Classifier
Softmax classifier
Neural networks에서 cross-entropy loss와 함께 흔히 사용되는 Softmax classifier는 다음과 같은 결점들을 가진다.
- Architecture modification for new classes: 새로운 클래스가 들어오면 training을 멈추고 FC layer에 출력 노드 및 해당하는 connections을 추가해야한다.
- Decoupled representation and classification: 위와 같은 이유로 encoder와 분류 layer를 따로 학습시켜야 함
- Task-recency bias: 모델이 최근 클래스들에 편향되게 학습되는 경향이 있음
Nearest Class Mean (NCM) Classifier
Embeding network $f$가 training된 후, NCM은 1) 각 클래스의 평균 벡터 or prototype을 계산하고, 2) 새로운 샘플 $x$에 대해 그것의 임베딩을 모든 prototype들과 비교한뒤 가장 비슷한 것의 클래스로 할당한다:
$$\begin{equation} \mu_c = \frac{1}{n_c} \sum_i f(x_i) \cdot 1\{y_i=c\} \end{equation} \tag{1}$$
$$\begin{equation} y^\ast = \arg\min_{c=1,...,t} \| f(x) - \mu_c \| \end{equation} \tag{2}$$
여기서 $1\{y_i=c\}$는 $y_i = c$에 대한 indicator이다.
NCM의 이점
- 새로운 클래스가 더해질 때 FC layer의 추가 혹은 수정을 요구하지 않음
- Eq. (1)에서, 인코더의 변화에 따라 prototype도 알아서 변하므로 거리 계산만 하면 됨
- NCM 분류기는 FC layer를 포함하지 않으므로 task-recency bias가 덜함
2.2. Supervised Contrastive Replay
Supervised Contrastive Learning (SCL)
NCM의 정확도 향상을 위해, SCL을 적용 (같은 클래스는 가깝게, 다른 클래스는 멀게 보일 수 있도록 학습)
SCL은 세가지 메인 컴포넌트들로 구성된다.
- $Aug(\cdot)$은 데이터 샘플 $x$의 augmented view $\tilde{x}$를 생성, i.e., $\tilde{x}=Aug(x)$.
- Encoder network $Enc(\cdot)$은 $x$를 embedding $r$로 매핑, i.e., $r=Enc(x) \in \mathbb{R}^{D_E}$.
- Projection network $Proj(\cdot)$은 $r$을 projected vector $z$로 매핑, i.e., $z=Proj(r) \in \mathbb{R}^{D_P} $
b개의 샘플들을 가진 batch $B = \{x_k,y_k\}_{k=1,...,b}$가 주어지면, 2b개의 샘플을 가진 multiviewed batch $B_I=B\cup \tilde{B}$가 생성, 여기서 $\tilde{B} = \{ \tilde{x}_k=Aug(x_k), y_k \}_{k=1,...,b}$.
SCL loss는 다음과 같이 계산된다.
$$\begin{equation} \mathcal{L}_{\text{SCL}}(Z_I) = \sum_{i\in I} \frac{-1}{\vert P(i) \vert} \sum_{p\in P(i)} \log \frac{\text{exp}(z_i \cdot z_p / \tau)}{\sum_{j\in A(i)} \text{exp}(z_i \cdot z_j / \tau) } \end{equation} \tag{3}$$
여기서 $I$는 $B_I$의 indices set이고, $A(i)=I\setminus\{i\}$는 $B_I$에서 샘플 i를 제외한 모든 샘플의 indices set이다.
$P(i) \equiv \{ p \in A(i) : y_p=y_i \}$는 $A(i)$에서 샘플 i와 같은 labels을 가진 샘플들 (positives)의 집합이다.
$Z(i) = \{z_i\}_{i \in I} = \{ Proj(Enc(x_i)) \}_{i \in I}$이고, $\tau \in \mathbb{R}^+$는 temperature parameter이다.
→ positives과의 내적이 negative와의 것보다 크도록 학습된다.
Supervised Contrastive Replay (SCR)
- Training step: 1) data stream $\mathcal{S}$에서의 minibatch $B_n$과 memory buffer $\mathcal{M}$에서의 minibatch $B_{\mathcal{M}}$은 결합되고, augmented view를 생성한다. 2) input batch와 augmented view는 shared encoder와 projection head에 의해 인코딩되고 SCL에 의해 encoder와 projection은 업데이트된다. 3) $B_n$은 memory buffer $\mathcal{M}$로 업데이트 된다.
- Test step: 1) 모든 buffered 샘플들은 encoder에 의해 임베딩되고 prototypes을 계산하는데 사용된다. 2) 임베딩 공간에서 NCM 분류기가 수행된다.
Training 이후 메모리 버퍼 $\mathcal{M}$에서 데이터 임베딩들의 시각화는 다음과 같다.
Cross-entropy loss를 사용하는 기존 방법들과 달리 contrastive loss를 사용하는 방법이 클래스들을 더 잘 구별할 수 있는 임베딩 공간을 찾는다. → Distance metric learning
Run time이 그렇게 빠르지는 않다. (e.g. encoder network가 업데이트 될때마다 클래스 평균 다시 계산 하는 등)
→ 임베딩 공간의 효율적인 학습 전략이 필요할 듯 하다.
본 논문 링크: [Link]
'[논문 리뷰] > Continual Learning' 카테고리의 다른 글
[TPAMI 2013] Distance-Based Image Classification: Generalizing to New Classes at Near-Zero Cost (0) | 2022.03.24 |
---|