Skip to content

matlab-deep-learning/openVocabularyCAMViaClipSurgery

Repository files navigation

Open Vocabulary CAM via CLIP Surgery

The example in this repository demonstrates how to perform open vocabulary Class Activation Mapping (CAM), a neural network explainability technique. This is achieved via CLIP Surgery [1], a training-free modification to OpenAI's CLIP model that enables several downstream open vocabulary tasks.

Open in MATLAB Online

The following image illustrates the class activation map for the prompt "car" before and after applying CLIP surgery. Class activation map, before and after applying CLIP Surgery.

Setup

  1. Download the repository and extract the contents.
  2. Download the required products below.

Requires MATLAB® release R2026a or newer with the following toolboxes/add-ons:

Getting Started

Run the openVocabularyCAMviaCLIPSurgery.m live script.

Licence

The license is available in the License.txt file in this GitHub repository.

Community Support

MATLAB Central

References

[1] Li, Yi, et al. "A closer look at the explainability of contrastive language-image pre-training." Pattern Recognition 162 (2025): 111409.

Copyright © 2026 The MathWorks, Inc.

About

Perform open vocabulary Class Activation Mapping (CAM), a neural network explainability technique, via CLIP Surgery, a training-free modification to OpenAI's CLIP model.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages