GithubHelp home page GithubHelp logo

wofmanaf / group-cam Goto Github PK

View Code? Open in Web Editor NEW
106.0 106.0 24.0 1.21 MB

Code for paper: Group-CAM: Group Score-Weighted Visual Explanations for Deep Convolutional Networks

License: Apache License 2.0

Python 100.00%

group-cam's People

Contributors

wofmanaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

group-cam's Issues

about details on insertion and deletion evaluation

Hi, thanks for sharing your code that is very useful. I just have a simple question. In the paper, you said you the number of replaced pixels is 224 x 8, but in your code, it is 224 x 2. Which one do you recommend for experiments? In the previous papers, it is around one per cent that is close to 224 x 2. What is your reason that you choose 3.6%? Thanks.

About ResNet50 results

Hi, I found out the results of GradCAM and GroupCAM are the same for resnet50. Could you offer some explanations? Thanks.

Using GroupCAM, get a NoneType

I use your groupcam code, but I get the NoneType

image

Here is my code:

def cam(model, loader, target_layer='conv1'):
    gc = GroupCAM(model, target_layer=target_layer)
    for i, (data, target) in enumerate(loader):
        if torch.cuda.is_available():
            data = data.cuda(non_blocking=True)
            target = target.cuda(non_blocking=True)
        saliency_maps = []
        model.eval()
        for idx in range(data.shape[0]):
            image = data[idx].unsqueeze(0)
            if idx == data.shape[0] - 1:
                saliency = gc(image, class_idx=target[idx], retain_graph=False)
            else:
                saliency = gc(image, class_idx=target[idx], retain_graph=True)
            saliency = saliency.to(device)
            saliency_maps.append(saliency)
        saliency_maps = torch.cat(saliency_maps, dim=0)
        mean = torch.mean(saliency_maps)
        saliency_maps = torch.where(saliency_maps < mean, 0.0, 1.0)

The model is my DNN, and the loader is the CIFAR-10 eval_loader,

My PyTorch version: '1.12.1+cu116'
Python version: 3.7

Codes for the localization evaluation part.

Hi,
I have seen your paper and you have done a splendid job on the class activation maps generating algorithm. Also, you have uploaded your codes for the sanity check, deletion and insertion, as well as finetuning the classification network. I am wondering it would be very kind of you to upload your codes for the localization evaluation, too. So, is that uploading possible?

Thanks,
Ema1997.

self.gradients['value'].data error

when debugging line 44 in groupcam.py, it happens Exception has occurred: KeyError
'value'

self.gradients.items is <built-in method items of dict object at 0x7f62f854ad80>
Is there a problem there?
thanks

Demo error

Hi, Great Job! Thanks for your work.

when i run the demo : python3 demo.py --arch vgg19 --target_layer features.36 --input images/ILSVRC2012_val_00043392.JPEG --output base.png

Then warning come and no more happen:

~/work/Group-CAM$ python3 demo.py --arch vgg19 --target_layer features.36 --input images/ILSVRC2012_val_00043392.JPEG --output base.png

/.local/lib/python3.6/site-packages/kornia/augmentation/augmentation.py:1833: DeprecationWarning: GaussianBlur is no longer maintained and will be removed from the future versions. Please use RandomGaussianBlur instead. category=DeprecationWarning,

torch:1.7.0

torchvision:0.8.1

kornia:0.5.4

Ubuntu 18.04.5 LTS

Thank you!

code bug

I got some confusion about the code in main.py line 315.images = images * saliency_maps + blur(images) + (1-saliency_maps).
What do you mean to plus the (1 - saliency_maps) here? And what's the size of the saliency_maps here?

Can't generate Group-CAM saliency map

Thanks for sharing the code.

I tried to Generate saliency map used by Group-CAD, but couldn't.

python3 demo.py --arch=vgg19 --target_layer=features.35 --input=Images/ILSVRC2012_val_00000073.JPEG --output=base.png
# demo.py, l48

gc = GroupCAM(model, target_layer=args.target_layer)

base

2021visualization

Is there any possible to share newest code of visualization such as Guided Integrated Gradients?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.