jacobgil / pytorch-grad-cam

Advanced AI Explainability for computer vision. Support for CNNs, Vision Transformers, Classification, Object detection, Segmentation, Image similarity and more.
https://jacobgil.github.io/pytorch-gradcam-book
MIT License
10.1k stars 1.53k forks source link

Support for CLIP #460

Open Sidd1609 opened 11 months ago

Sidd1609 commented 11 months ago

Hello, wanted to say that the repo is really well put and maintained! really appreciate everyone's effort.

I am currently trying to visualize concept activations on the image features using model = "ViT-L/14" for CLIP. I figured the target_layers but I am getting the issue where I need to also pass the text_features as:

ine 1501, in _call_impl return forward_call(*args, **kwargs) TypeError: forward() missing 1 required positional argument: 'text'

is there anyway of passing arguments to the forward call for the loaded model?

Thanks Regards -SriSiddarthC

jacobgil commented 10 months ago

Hi @Sidd1609 ,

You can create a wrapper around the model that will call it with the desired signature.

FUIGUIMURONG commented 9 months ago

Hello, wanted to say that the repo is really well put and maintained! really appreciate everyone's effort.

I am currently trying to visualize concept activations on the image features using model = "ViT-L/14" for CLIP. I figured the target_layers but I am getting the issue where I need to also pass the text_features as:

ine 1501, in _call_impl return forward_call(*args, **kwargs) TypeError: forward() missing 1 required positional argument: 'text'

is there anyway of passing arguments to the forward call for the loaded model?

Thanks Regards -SriSiddarthC

I also want to visualize the clip visual feature, do you slove it ?

Sidd1609 commented 9 months ago

No not yet

On Mon, Nov 27, 2023 at 11:13 AM FUIGUIMURONG @.***> wrote:

Hello, wanted to say that the repo is really well put and maintained! really appreciate everyone's effort.

I am currently trying to visualize concept activations on the image features using model = "ViT-L/14" for CLIP. I figured the target_layers but I am getting the issue where I need to also pass the text_features as:

ine 1501, in _call_impl return forward_call(*args, **kwargs) TypeError: forward() missing 1 required positional argument: 'text'

is there anyway of passing arguments to the forward call for the loaded model?

Thanks Regards -SriSiddarthC

I also want to visualize the clip visual feature, do you slove it ?

— Reply to this email directly, view it on GitHub https://github.com/jacobgil/pytorch-grad-cam/issues/460#issuecomment-1827158101, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALTC7VZSWRNMUF32LLWH6HDYGQR7JAVCNFSM6AAAAAA5E6TJROVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRXGE2TQMJQGE . You are receiving this because you were mentioned.Message ID: @.***>

Danny-1-8 commented 8 months ago

Hello, wanted to say that the repo is really well put and maintained! really appreciate everyone's effort.

I am currently trying to visualize concept activations on the image features using model = "ViT-L/14" for CLIP. I figured the target_layers but I am getting the issue where I need to also pass the text_features as:

ine 1501, in _call_impl return forward_call(*args, **kwargs) TypeError: forward() missing 1 required positional argument: 'text'

is there anyway of passing arguments to the forward call for the loaded model?

Thanks Regards -SriSiddarthC

Hello friend,do you think the "cam" is compatible with the visual encoder of CLIP?

Aashish75 commented 4 months ago

@Sidd1609 @Danny-1-8 @FUIGUIMURONG were any of you able to get past the "TypeError: forward() missing 1 required positional argument: 'text'" and visualise the activations on the image?

zj56 commented 3 weeks ago

I also want to visualize the clip visual feature.