Giter Club home page Giter Club logo

score-cam's Introduction

score-cam

Repository containing code to run Score-CAM algorithm available on https://arxiv.org/pdf/1910.01279v1.pdf.

Pre-requisites

Make sure you have installed python 3.6+ and setup GPU configuration in case you have GPU available.

At the root run:

$ virtualenv env
$ source env/bin/activate
$ pip install -r requirements.txt

Running

To run a simple example just enter python example.py on terminal. Output image will be saved at the root.

alt text

Upcoming

  • Visualize more than one image per run
  • Implement on tf-explain

score-cam's People

Contributors

matheushent avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tubbz-alt

score-cam's Issues

Error: List of numpy arrays passed is not the size of what the model is expecting

Hi,

Thank you for writing and maintaining this repo, it's a very easy to understand implementation of Score-CAM!

I have the VGG16 example working fine, and am now trying to adapt this to use my own Mask-RCNN model I have developed using this repo as a basis. I am running into an error however that I am unsure of how to fix, and was wondering if any advice could be provided?

When running

explainer = ScoreCAM()

target_size = (3456, 5184)

data = (img, None)
# Compute ScoreCAM on VGG16
image = explainer.explain(
    data, model.keras_model, max_prob, target_size, _grid=False
)[0]
explainer.save(image, ".", "score_cam.png")

I am running into the following error:

ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 3 array(s), but instead got the following list of 1 arrays: [<tf.Tensor: id=10530, shape=(64, 3456, 5184, 3), dtype=float32, numpy=
array([[[[ 3.64952057e+02,  3.75305298e+02,  3.77893616e+02],
         [ 1.37095261e+02,  1.40957092e+02,  1.41922562e+02],

The full stack trace can be seen here. I think the issue is that masked_images is not in the form it should be? A printout of masked_images can be seen here.

Any help is greatly appreciated!

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.