Skip to main content

A wrapper package for CLIP, providing explanations for how the model compares images and captions.

Project description

exCLIP

This repository contains the code for the TMLR'25 paper Explaining Caption-Image Interactions in CLIP Models with Second-Order Attributions.

A demo is alreay included in the demo.ipynb notebook.

We are still working on cleaning up the code to make it easily accessible and will be updating this repo over the next couple of days. To stay tuned, we would be glad if you leave a star! 🤩

Contribution

Our method enables to look into which part of a caption and an image CLIP matches. We can make arbitrary selections over spans in captions and see which image regions correspond to them or vice versa. This is demonstrated in the follwing plot.

example

In the top row, we select spans in captions (yellow) and see what they correspond to in the image above. In the bottom row, we select bounding-boxes in the image (yellow) and see what they correspond to in the caption below. Heatmaps in both images and captions are red for positive and blue for negative values.

For all details, check out the paper!

Installation

To use our exclip package, clone this repository, create a fresh python environment (3.11 or higher) and run the following command inside the cloned repo.

$ pip install .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exclip-1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

exclip-1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file exclip-1.0.tar.gz.

File metadata

  • Download URL: exclip-1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for exclip-1.0.tar.gz
Algorithm Hash digest
SHA256 2bbae068eeb2dae04e39496466b13aa6189aeee8e40501b3e9eaa475c2a3c0af
MD5 e3ef75899df1f71a7ecc58032078af2d
BLAKE2b-256 f5db7f812bdb6411add4cce30b2688141000e0926c39927151292cff44ef2e3d

See more details on using hashes here.

File details

Details for the file exclip-1.0-py3-none-any.whl.

File metadata

  • Download URL: exclip-1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for exclip-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bae0f6295c8e585097ce14336d00c26ca4fda423f0d46a01316ec11d4a329f5e
MD5 6d189335218d11faa68b0921cda40a29
BLAKE2b-256 eb2ac497b595e7e5679bbe09e85e7e1f7fc405f5ddaba7ee7fa35cf9ebdec7d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page