Skip to content

rabbit-my/CLIP-CAM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Basic Usage of CLIP-GradCAM

This repo implements a GradCAM method based on the CLIP model. It is inspired by the official code: CLIP-GradCAM Example.

Prerequisites

Before running the code, ensure you have the following Python libraries installed:

  • opencv-python
  • numpy
  • torch
  • pytorch-grad-cam

How to Use

Adjust the parameters as needed:

  • image-path: Specify the path to the input image.
  • labels: Provide a list of descriptions for the image.
  • prompt: Select one description from the list to use as the prompt.
  • method: Specify the method for generating the class activation map. Supported methods include gradcam, gradcam++, scorecam, and others.

Example Command

Run the script with the following command:

python main.py --image-path "cat_and_dog.jpg" --labels ["a cat", "a dog"] --prompt "a cat" --method "gradcam"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages