AI, Deep Learning Basics/Basic

[AI602] 2. Self-supervised Learning

Self-supervised learning is an unsupervised learning strategy to learn transferable representations by solving data-generated tasks (pretext tasks). It also learns a good representation without supervision, and implements other tasks. The model is evaluated by stacking a task-specific layer.

결국에는, SSL은 어떤 objective를 해결하기 위해서 1. pretext task에는 기존의 dataset에서 반대의 representation을 만들어서 적용하는 방식. 이후에, 2. 그 Representation에 additional layer를 추가해서 transfer해서 원하는 task를 해결한다. 이는 데이터의 라벨에 기대지 않고, representation 자체를 학습하기 위한 Unsupervised learning의 한 분야라고 볼 수 있다.

그렇다면 관건은 Dataset 자체의 representation을 알기 위해서
어떤 방식의 학습 방법이 그 dataset을 파악하는데 도움이 될까?
 

현재까지 크게 두가지 흐름으로 나뉜다. 

(1) Pretext task를 통한 학습

이미지의 representation 를 학습하기 위한 여러가지 pretext task가 존재한다.

  • Context prediction: 이미지 버전의 Puzzle 조각 하나 위치 찾기
  • Image Inpainting: 이미지 버전의 Fill in the blank
  • Jigsaw puzzles: 이미지 버전의 puzzle 다 맞추기) Jigsaw puzzle can teach the network that an object is made of parts and what these parts are.
  • Image rotations: 이미지 버전의 rotation 맞추기) Rotation을 알아야 context를 안다고 이야기할 수 있다.

(2) Contrastive learning

이후, contrastive learning이 도래했다. Contrastive learning은 이미지들 유사한/반대인 예시를 만들고 (i.e. positive sample과 negative sample)을  둘을 가려내는 작업을 통해 representation을 학습하는 방식이다.

  • Non-Parametric Instance Discrimination: 모든 이미지와의 차이점을 학습하기
  • Momentum Contrast (MoCo): Contrastive learning 중 dictionary look-up의 Contrastive learning을 수행한다. 궁금한 것 (Query)과 후보들 (Key) 중에 positive pair 간의 유사도는 높이고 negative pair 간의 유사도는 낮추는 방향으로 모델을 학습하는 방법으로 진행. 일정 크기의 dictionary를 정의하여 sample들의 key값을 저장해두고, query와 matching되는 값을 positive key(같은 이미지에서 생성된 key들)로, 나머지를 negative key(다른 이미지에서 생성된 key들)로 분류하여 추출하였다.
  • SimCLR: MoCo와 다른 점은 어떤 것을 비교했다는 것이다. 기존의 존재하는 이미지들에 추가적인 처리 (ex. cropping, gaussian noise, rotation, filtering) 를 통해 비교를 하는 방식으로 처리가 되었다.  Data augmentation의 contrastive learning을 했다는 점에서 함의가 있다.
  • BYOL: 위의 방식은 positive sample과 negative sample 모두 집중한다. 이는 많은 batch size를 요구해서 computationally inefficient하다. BYOL은 positive sample에만 집중하여, batch size의 크기에 구애를 덜 받으면서, supervised learning과 성능이 비슷함을 자랑한다. negative sample을 왜 고려 안하는지 확인해야 함, network에서 negative sample을 고려하게 되는지, similarity를 비교하게 되면 어떻게 이미지가 학습이 되는지 생각해봐야 함. 여기 이후부터는 대충 봄.
  • DiNO: Self-distillation with a teach with stop gradient.

 

My thoughts.

  • 현재 Self-supervised learning은 contrastive learning 방식을 통해서 representation을 행하는 방식이 유행이다.
  • VAE도 그렇고 여기서도 representation학습하는 방식에 대해서 생각을 하는데, 둘 다 같은 방향을 추구하는 것일까.
  • SSL + Robotics 어떻게 적용될 수 있을까.
    • Representation을 학습하기 위한 한 방식으로 적용될 텐데 어떤 representation을 학습하냐에 따라 다를 것 같다. 

'AI, Deep Learning Basics > Basic' 카테고리의 다른 글

Training on GPU, CPU  (0) 2022.11.05
(작성중) [AI602] 3. Bayesian Deep Learning  (0) 2022.10.01
[AI602] 1. Vision Transformer  (0) 2022.09.11
[AI602] AdvancedML Introduction  (0) 2022.09.11
[Logger] wandb 사용법  (0) 2022.05.05