# Visualizing and Understanding Contrastive Learning

대조 학습의 시각화와 이해

Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · arXiv · 2022년 6월 20일

- **연구 문제** 대조 학습 모델은 두 입력의 유사도로 판단하므로 기존 단일 이미지 설명 방법만으로는 그 근거를 설명하기 어렵습니다.
- **연구 방법** 두 이미지의 활성화·그래디언트 상호작용, 증강 강도 평균, 쌍 가림을 설계하고 기존 지표를 동시 및 조건부 평가로 확장합니다.
- **주요 결과** SimCLRv2 실험에서 Averaged Transforms 변형은 여러 지표에서 최고 점수를 얻었고 Barlow Twins에서는 Interaction-CAM의 우위가 일부 지표에 한정됩니다.

## 대조 학습 모델을 설명하기 어려운 이유

대조 학습 모델은 한 장의 이미지가 아니라 두 입력이 함께 들어와 유사도 점수를 내는 구조입니다. 기존 이미지 분류용 설명 방법은 입력을 서로 독립적이라고 가정하므로, 두 이미지 사이의 상호작용을 반영하지 못합니다. 또한 대조 학습은 데이터 증강으로 얻은 변환에 대한 불변성을 학습하므로, 설명 방법은 이 불변성 요소도 고려해야 합니다. 저자들은 이러한 문제를 해결하기 위해 쌍 입력을 위한 시각 설명 방법을 설계하고, 기존 단일 이미지 지표를 쌍 설명 평가로 확장합니다.

![Figure 1: Contrastive models compare pairs of inputs and determine whether they are similar or not. Our work involves the development of methods to explain how…](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-ddcfe46f4a74eca4ae08e3521b40b7cd.png?thumb=512)

**Fig. 1** . Contrastive models compare pairs of inputs and determine whether they are similar or not. Our work involves the development of methods to explain how these models make decisions and how they learn to recognize similarities.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 1쪽에서 그림 영역을 추출했습니다.

## Interaction-CAM의 공동 활성화와 그래디언트 상호작용

Baseline-Grad-CAM은 각 이미지의 활성화 맵과 그래디언트를 따로 가중하므로 두 이미지 사이의 공동 관계를 담지 못합니다. Interaction-CAM은 두 활성화 벡터의 원소별 곱으로 만든 공동 활성화 항 J와, 두 이미지의 그래디언트 내적으로 계산한 그래디언트 상호작용 항 G를 함께 사용합니다. 이때 G는 채널 그래디언트 사이의 교차 상관 행렬에서 최댓값을 취하는 방식으로 계수를 얻습니다. 최종 중요도 지도는 이 두 항으로 가중한 활성화 맵의 합으로 만들어집니다.

![Figure 3: A 2D plot representing the interaction of activation vectors for augmented image pairs. The x-axis represents feature values from the first image’s a…](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-baa565b1e387937be083d17c3114ac0d.png?thumb=512)

**Fig. 3** . A 2D plot representing the interaction of activation vectors for augmented image pairs. The x-axis represents feature values from the first image’s activation vector and the y-axis represents those of the second image. The color bar indicates the magnitude of their interaction (their element-wise multiplication).

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

![Figure 8: Qualitative examples of the proposed Interaction-CAM compared to Baseline-Grad-CAM](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-db0bbd4ce01a35aa7dc2e946f9a7831e.png?thumb=512)

**Fig. 8** . Qualitative examples of the proposed Interaction-CAM compared to Baseline-Grad-CAM.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

## Averaged Transforms의 증강 강도 평균

Averaged Transforms는 한 변환의 여러 강도에 대해 두 이미지 사이의 코사인 유사도 그래디언트를 계산한 뒤 평균합니다. 가장 강한 변환을 I2에 적용하고, 그 결과와 I1 사이를 단계적으로 보간하여 여러 강도의 그래디언트를 얻습니다. 저자들은 이 평균이 단일 강도에서 생기는 잘못된 대응 영역의 영향을 줄인다고 설명합니다. 이 방법의 잡음 제거 옵션인 Smooth-Grad나 Guided Backpropagation은 선택 사항이며, 평가에서는 각 옵션을 포함하거나 제외한 변형을 함께 비교합니다.

![Figure 4: Qualitative examples of Averaged Transforms compared with Smooth- Grad. On the left, we show the augmentation dissection process of gradually varying…](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-b4f5f44f047fa0b49a53bc57dd2d5786.png?thumb=512)

**Fig. 4** . Qualitative examples of Averaged Transforms compared with Smooth- Grad. On the left, we show the augmentation dissection process of gradually varying the transformation strength of the first image until it reaches the second image.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.

![Figure 5: Qualitative examples of Averaged Transforms compared with Smooth-Grad, for grayscale and color jitter transformations](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-f582629c16f7096b085fcd8273618177.png?thumb=512)

**Fig. 5** . Qualitative examples of Averaged Transforms compared with Smooth-Grad, for grayscale and color jitter transformations.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

![Figure 6: Qualitative examples of Averaged Transforms compared to InputXGrad and Smooth-Grad, for a 90 degree rotation transformation. On top, we show the augm…](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-ac008ea2a16b84fa2e7853f18e685724.png?thumb=512)

**Fig. 6** . Qualitative examples of Averaged Transforms compared to InputXGrad and Smooth-Grad, for a 90 degree rotation transformation. On top, we show the augmentation dissection process.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

## Pairwise Occlusion과 조건부 가림의 차이

Conditional Occlusion은 한 이미지의 가림 영역만 바꾸고 다른 이미지는 완전히 관찰된 상태로 둡니다. 이 방식은 가려진 영역의 문맥이 남아 있으면 유사도가 크게 떨어지지 않는 문제가 있습니다. Pairwise Occlusion은 두 이미지에 무작위 크기와 위치의 가림을 동시에 적용하고, softmax로 정규화한 유사도 감소 점수를 가림 영역의 낮은 ℓ2 노름 특징에 배분합니다. 이 방식은 가림 영역이 평탄한 값을 가져 평가 곡선에 평평한 구간을 만들 수 있다는 한계도 함께 보고됩니다.

![Figure 2: An example of computing conditional occlusion of the second image conditioned on the first image. The contextual information surrounding the dropped…](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-7a80ab8f758ad48f91d1f6391841e353.png?thumb=512)

**Fig. 2** . An example of computing conditional occlusion of the second image conditioned on the first image. The contextual information surrounding the dropped region (indicated by a black box) in the second image is sufficient to produce a high similarity prediction with the fully-observed first image.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

![Figure 7: 6 qualitative examples of Perturbation-based methods. Our methods are not limited to explaining similarity on augmented pairs. We can also apply them…](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-50c3da3e91a1099402c13d64fc7a8718.png?thumb=512)

**Fig. 7** . 6 qualitative examples of Perturbation-based methods. Our methods are not limited to explaining similarity on augmented pairs. We can also apply them to explain similarity of different images from the same class. The bottom example in the first column and the top and bottom examples in the second column present qualitative results on different images of the same class. The other qualitative examples (the top example in the first column and the two examples in the last column) are for augments of an image. Red signifies more important regions while blue signifies less important regions.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

## 쌍 설명을 평가하는 동시 및 조건부 설정

저자들은 삽입, 삭제, 평균 감소, 최대 민감도, 무작위화 검사를 쌍 설명으로 확장합니다. 동시 평가는 두 이미지에서 같은 길이의 픽셀을 함께 추가하거나 제거하여 유사도 변화를 측정합니다. 조건부 평가는 한 이미지만 수정하고 다른 이미지는 완전히 관찰된 상태로 유지합니다. 두 설정은 같은 지표를 다른 조건에서 측정하므로, 점수를 해석할 때 어떤 설정의 결과인지 구분해야 합니다.

![Figure 13: Sanity check for Interaction-CAM (mean), Interaction-CAM (max), Interaction-CAM (attention), Average Transforms (guided backpropagation), Average Tr…](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-375ba8eff6b8b0e3e3d7217154eb77c3.png?thumb=512)

**Fig. 13** . Sanity check for Interaction-CAM (mean), Interaction-CAM (max), Interaction-CAM (attention), Average Transforms (guided backpropagation), Average Transforms (without guided backpropagation), Conditional Occlusion and Pairwise Occlusion, ordered from top to bottom.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 12쪽에서 그림 영역을 추출했습니다.

## SimCLRv2 실험에서 나타난 비교 결과

SimCLRv2 1×와 2×에 대한 실험에서 Averaged Transforms 변형은 SimCLRv2 1×에서 7개 지표 중 5개, SimCLRv2 2×에서 6개 지표 중 6개에서 최고 점수를 얻었다고 저자들은 보고합니다. Interaction-CAM 변형은 SimCLRv2 1×와 2×의 6개 지표 중 4개에서 기준선보다 나은 것으로 보고됩니다. 이 실험은 ImageNet ILSVRC-2012 검증 세트에서 무작위로 고른 2000장과 코사인 유사도를 사용합니다. 최대 민감도에서도 Averaged Transforms가 여러 기준선보다 낮은 값을 보였다고 보고됩니다.

## Barlow Twins에서 나타난 제한적 우위

Barlow Twins는 대조 학습 과제가 아니지만 두 입력을 필요로 하므로 유사도 분석의 대상으로 포함됩니다. 이 모델에서 Interaction-CAM은 SD와 CD 지표에서만 기준선보다 우수하다고 보고됩니다. 저자들은 이 차이가 Barlow Twins가 대조 학습으로 훈련되지 않았다는 점과 관련될 수 있다고 해석합니다. 이 결과는 Barlow Twins 설정에서 나타난 관찰이므로 다른 모델 전체에 그대로 적용할 수 없습니다.

## 결과의 적용 범위와 남은 질문

실험은 SimCLRv2, Barlow Twins, SimSiam, MoCov3를 대상으로 하며 2000장의 ImageNet 검증 이미지 부분집합을 사용합니다. 하류 과제 상관 분석은 다섯 모델에 기반하므로 더 많은 모델에서 확인해야 합니다. 저자들은 정성적 관찰이 모든 사례를 포괄하지 않는다고 밝힙니다. 따라서 이 논문의 결과는 제시된 모델, 데이터, 평가 설정에서 해석해야 합니다.

![Figure 15: Correlation with downstream tasks on the (SI, CI) and (SAD, CAD) group of metrics shown along with the linear correlation coefficient in green, for…](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069/figures/figure-2e8308e31cf831b4ae88a19ca82343ea.png?thumb=512)

**Fig. 15** . Correlation with downstream tasks on the (SI, CI) and (SAD, CAD) group of metrics shown along with the linear correlation coefficient in green, for perturbation, activation and saliency-based methods. In all plots except the last, a positive correlation is observed between the evaluation scores and downstream task performance.

[원문](https://arxiv.org/abs/2206.09753v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis · Visualizing and Understanding Contrastive Learning · 원문 그림 인용 · 원본 PDF 13쪽에서 그림 영역을 추출했습니다.

## 논문 정보

- **저자**: Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2022년 6월 20일
- **등록일**: 2026년 11월 6일
- **수정일**: 2023년 12월 13일
- **버전**: v3
- **arXiv**: 2206.09753
- **분류**: cs.CV
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2206.09753v3) · [원문 PDF ↗](https://arxiv.org/pdf/2206.09753v3)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

Contrastive learning has revolutionized the field of computer vision, learning rich representations from unlabeled data, which generalize well to diverse vision tasks. Consequently, it has become increasingly important to explain these approaches and understand their inner workings mechanisms. Given that contrastive models are trained with interdependent and interacting inputs and aim to learn invariance through data augmentation, the existing methods for explaining single-image systems (e.g., image classification models) are inadequate as they fail to account for these factors and typically assume independent inputs. Additionally, there is a lack of evaluation metrics designed to assess pairs of explanations, and no analytical studies have been conducted to investigate the effectiveness of different techniques used to explaining contrastive learning. In this work, we design visual explanation methods that contribute towards understanding similarity learning tasks from pairs of images. We further adapt existing metrics, used to evaluate visual explanations of image classification systems, to suit pairs of explanations and evaluate our proposed methods with these metrics. Finally, we present a thorough analysis of visual explainability methods for contrastive learning, establish their correlation with downstream tasks and demonstrate the potential of our approaches to investigate their merits and drawbacks.

## 원문 인용

Fawaz Sammani, Boris Joukovsky, Nikos Deligiannis (2022). Visualizing and Understanding Contrastive Learning. arXiv:2206.09753v3. https://arxiv.org/abs/2206.09753v3

**BibTeX**

```
@misc{sammani2022visualizing,
  title = {{Visualizing and Understanding Contrastive Learning}},
  author = {Fawaz Sammani and Boris Joukovsky and Nikos Deligiannis},
  year = {2022},
  eprint = {2206.09753},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.09753v3}
}
```

## 다른 논문 해설

- [Learning Representations with Contrastive Self-Supervised Learning for Histopathology Applications](https://refivu.com/papers/34056d75-d0d7-4a13-a797-cabf81501cec-learning-representations-with-contrastive-self-supervised.md)
- [Cross-Modal Contrastive Learning of Representations for Navigation using Lightweight, Low-Cost Millimeter Wave Radar for Adverse Environmental Conditions](https://refivu.com/papers/5c56fa5a-3227-4a44-a609-9b42bb1290c2-cross-modal-contrastive-learning-of-representations-for.md)
- [Accurate Clinical Toxicity Prediction using Multi-task Deep Neural Nets and Contrastive Molecular Explanations](https://refivu.com/papers/cd601127-20d4-4092-be9b-9fbf722b973c-accurate-clinical-toxicity-prediction-using-multi-task-deep.md)
- [Self-supervised Learning for Human Activity Recognition Using 700,000 Person-days of Wearable Data](https://refivu.com/papers/7d06c47d-a111-423f-a4f8-68d244e1093c-self-supervised-learning-for-human-activity-recognition.md)
- [Context Vectors are Reflections of Word Vectors in Half the Dimensions](https://refivu.com/papers/b7b81b8b-5025-4fbd-a52e-a2e1e26668da-context-vectors-are-reflections-of-word-vectors-in.md)
- [Contrastive Representation Learning: A Framework and Review](https://refivu.com/papers/8d475c35-65aa-4272-b3a4-00f7350d277d-contrastive-representation-learning-a-framework-and-review.md)
- [Benchmarking Large Language Models for Handwritten Text Recognition](https://refivu.com/papers/ee660aba-9003-47fb-9ce3-3e89b7a41331-benchmarking-large-language-models-for-handwritten-text.md)
- [Causality extraction from medical text using Large Language Models (LLMs)](https://refivu.com/papers/49a66e7e-ff6f-418a-83de-3690640fcbf4-causality-extraction-from-medical-text-using-large-language.md)
- [Variational Autoencoder with CCA for Audio-Visual Cross-Modal Retrieval](https://refivu.com/papers/77a078df-3861-4b3b-beec-60ef07a389f2-variational-autoencoder-with-cca-for-audio-visual-cross.md)
- [Automated Novelty Evaluation of Academic Paper: A Collaborative Approach Integrating Human and Large Language Model Knowledge](https://refivu.com/papers/5f1e1cd9-3549-45f8-b6cc-faeabed1488a-automated-novelty-evaluation-of-academic-paper-a.md)
- [Visuomotor Robotic Pruning in Planar Orchards Using Hybrid Reinforcement Learning](https://refivu.com/papers/9ceeac30-cb06-4902-bb2c-03dcd623f027-visuomotor-robotic-pruning-in-planar-orchards-using-hybrid.md)
- [Reinforcement Learning Based Quantum Circuit Optimization via ZX-Calculus](https://refivu.com/papers/9c8e6aa3-4291-4395-9813-828baebb2513-reinforcement-learning-based-quantum-circuit-optimization.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/1c935acc-e6a1-4adf-b191-ce3d39858069-visualizing-and-understanding-contrastive-learning)
