Skip to content

Commit c90578d

Browse files
committed
updated experiments
1 parent ad105cf commit c90578d

File tree

241 files changed

+1477
-3282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+1477
-3282
lines changed

Images/artemis.jpg

1.08 MB
Loading

Images/astronaut.png

708 KB
Loading

Images/el2.jpeg

13.1 KB
Loading

Images/el4.jpeg

57.8 KB
Loading

Images/elephant.jpg

277 KB
Loading

Images/zebra.jpeg

12.8 KB
Loading

Images/zebra.jpg

5.25 MB
Loading

README.md

+44-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
1-
# sem_project_IVRL
1+
# CLIP Explainability
2+
3+
This repo contains the code for the [CLIP Explainability project](CLIP_Explainability.pdf).
4+
In this project, we conduct an in-depth study of CLIP’s learned image and text representations using saliency map visualization. We propose a modification to the existing saliency visualization method that improves its performance as shown by our qualitative evaluations. We then use this method to study CLIP’s ability in capturing similarities and dissimilarities between an input image and targets belonging to different domains including image, text, and emotion.
5+
6+
## Setup
7+
8+
To install the required libraries run the following command:
9+
10+
```
11+
pip install -r requirements.txt
12+
13+
```
14+
15+
## Organzation
16+
17+
[code](code) directory contains
18+
19+
- the implementation of saliency visualization methods: for [ViT] (code/vit_cam.py) and ResNet (code/rn_cam.py)-based CLIP
20+
- Gildenblat et al.'s implementation of [GradCAM](code/pytorch-grad-cam)
21+
- A re-implementation of CLIP taken from [Transformer-MM-Explainability](https://github.com/hila-chefer/Transformer-MM-Explainability) repo that keeps tack of attention maps and gradients: [clip_.py](code/clip_.py)
22+
- [Notebooks](code/notebooks/) for the experiments explained in the report
23+
24+
25+
[Images](Images) contains images used in the experiments.
26+
27+
[results](results) contains the results obtained from the experiments. Any result generated by the notebooks will be stored in this directory.
28+
29+
30+
## Experiments
31+
32+
33+
| Notebook Name | Experiment | Note |
34+
| ------------- | ------------- | ------------- |
35+
| [vit_block_vis](code/notebook/vit_block_vis.ipynb) | Layer-wise Attention Visualization | - |
36+
| [saliency_method_compare](code/notebook/saliency_method_compare.ipynb) | ViT Explainability Method Comparison | qualitative comparison |
37+
| [affectnet_emotions](code/notebook/affectnet_emotions.ipynb) | ViT Explainability Method Comparison | bias comparison. you need to download a sample of the AffectNet dataset [here](https://drive.google.com/drive/u/1/folders/11RusPab71wGw6LTd9pUnY1Gz3JSH-N_N) and place it in [Images](Images). |
38+
| [pos_neg_vis](code/notebook/pos_neg_vis.ipynb) | Positive vs Negative Saliency | - |
39+
| [artemis_emotions](code/notebook/artemis_emotions.ipynb) | Emotion-Image Similarity | you need to download the pre-processed WikiArt images [here](https://drive.google.com/drive/u/1/folders/11RusPab71wGw6LTd9pUnY1Gz3JSH-N_N) and place it in [Images](Images). Note that this notebook chooses images randomly so the results may not be the same as the ones in the report. |
40+
| [perword_vis](code/notebook/perword_vis.ipynb) | Word-Wise Saliency Visualization |
41+
| [global_vis](code/notebook/global_vis.ipynb) | - | can be used to visualize saliency maps for ViT and ResNet-based CLIP.
42+
can be used to reporoduce the results for bias detection.|
43+
44+

code/README.md

-6
This file was deleted.

code/notebooks/affectnet_emotions.ipynb

+108-209
Large diffs are not rendered by default.

code/notebooks/artemis_emotions.ipynb

+576-244
Large diffs are not rendered by default.

code/notebooks/cross_image_saliency.ipynb

-1,469
This file was deleted.

code/notebooks/global_vis.ipynb

+27-95
Large diffs are not rendered by default.

code/notebooks/perword_vis.ipynb

+48-205
Large diffs are not rendered by default.

code/notebooks/pos_neg_vis.ipynb

+50-810
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)