AI 논문리뷰 - Vision

Research Paper Review : CLIP

study_love 2025. 11. 26. 17:56

 이 게시물에서는 CLIP에 대해서 설명해보도록 하겠다. 

https://arxiv.org/abs/2103.00020

 

Learning Transferable Visual Models From Natural Language Supervision

State-of-the-art computer vision systems are trained to predict a fixed set of predetermined object categories. This restricted form of supervision limits their generality and usability since additional labeled data is needed to specify any other visual co

arxiv.org

 CLIP이 하고자 하는 것은 Image와 Text가 서로 Align되는 Image와 Text의 embedding을 뽑는 것이다. 훈련된 Image Encoder와 Text Encoder는 추후 여러 task에 initial Encoder를 제공할 수 있다. 실제로 여러 task에 CLIP에서 훈련된 Encoder가 쓰인다. 

  훈련 방법에 대해서 소개하면, web에서 (text,image) pair를 많이 모은다. 이때 text는 image의 scene을 describe한다. 그리고 훈련 할 때에는 만약 text와 image가 positive pair라면, image encoder를 통과한 image의 embedding과 text encoder를 통과한 text의 embedding의 cosine similarity가 높도록 훈련시킨다. 또 만약 text와 image가 다른 pair에서 추출되었다면(negative pair) cosine similarity가 작도록 훈련시킨다. 조금 더 디테일 하게 말하면 N개의 pair를 한 batch로 뽑은 후에, N개의 pair내에서 발생할 수 있는 모든 negative pair와 positive pair를 만들어서 훈련을 시킨다. positive pair만 가지고 훈련을 시키면 모델이 모든 image와 text의 embedding을 똑같이 만들어버리는 collapse가 일어나기 때문에 많은 negative pair를 확보하는게 중요하고, 그래서 CLIP류의 모델을 훈련시킬 때는 batch size를 작게하면 안된다. 

 

 훈련을 끝나고 나서 그림 (2)과 같이 zero-shot classification task를 풀었더니 기존의 task-specific data에서 훈련한 모델들보다 SOTA성능을 찍었다고 했다. 방대한 데이터의 힘을 보여주는 예시이다. zero shot classification task는 다음과 같은 process로 풀었다고 했다. 

  1. Let’s say you have an image and some candidate classes.
  2. Then you can generate a sentence “a photo of {candidate classes}”
  3. Then you can just get the class who have maximum similarity between photo embedding and class sentence.

 하지만 CLIP은 훈련할 때 image와 text전체 단위로 loss를 걸고, Caption이 Image의 fine-grained한 detail을 보통 설명하지 않는 데이터를 쓰기 때문에, fine-grained한 detail에 대해서는 embedding vector가 잘 반영하지 못하는 단점이 있다.