Giter Site home page Giter Site logo

relevance-cam's Introduction

PyTorch Implementation of [Relevance-CAM: Your Model Already Knows Where to Look] [CVPR 2021]

This is implementation of [Relevance-CAM: Your Model Already Knows Where to Look] which is accepted by CVPR 2021

Comparison

Introduction

Official implementation of [Relevance-CAM: Your Model Already Knows Where to Look].

We introduce a novel method which allows to analyze the intermediate layers of a model as well as the last convolutional layer.

Method consists of 3 phases:

  1. Propagation to get the activation map of a target layer of a model.

  2. Backpropagation of to the target layer with Layer-wise Relevance Propagation Rule to calculate the weighting component

  3. Weighted summation with activation map and weighting component.

Relevance-CAM pipeline

Code explanation

Example: By running Multi_CAM.py, multiple CAM results of images in the picture folder can be saved in the results folder.

python Multi_CAM.py --models resnet50 --target_layer layer2   for the last layer of ResNet50
python Multi_CAM.py --models resnet50 --target_layer layer4   for the intermediate layer of ResNet50

python Multi_CAM.py --models vgg16 --target_layer 43          for the last layer of VGG16
python Multi_CAM.py --models vgg16 --target_layer 23          for the intermediate layer of VGG16

python Multi_CAM.py --models vgg19 --target_layer 52          for the last layer of VGG16
python Multi_CAM.py --models vgg19 --target_layer 39          for the intermediate layer of VGG16
  1. Model: resnet50 or vgg16, by --models.
  2. Target layer for R-CAM: you can choose layer2 of resnet50 by --target_layer.
  3. Target class: If you want to make R-CAM for african elephant class, you can use --target_class 386, 386 is index of ImageNet for elephant. default value is maximum index of model output.

Citation

@InProceedings{Lee_2021_CVPR,
    author    = {Lee, Jeong Ryong and Kim, Sewon and Park, Inyong and Eo, Taejoon and Hwang, Dosik},
    title     = {Relevance-CAM: Your Model Already Knows Where To Look},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2021},
    pages     = {14944-14953}
}

relevance-cam's People

Contributors

mongeoroo avatar stephanie-fu avatar

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.