Skip to content

Requesting help with GradCam on Segmentation  #36

Open
@varungupta31

Description

@varungupta31

@jacobgil Thank you for this repository.
I am trying to implement this in my keras trained segmentation model (FCN8+VGG19).
I have referenced the Segmentation Notebook from your gradcam repo for pytroch, where you have created a wrapper, as pytorch model was returning a dictionary rather than a tensor. However, with Keras, I loaded my model, pre-processed and fed the input image, and ran model.predict(), I get a tensor which is basically of the shape of input image and has values depending on the category (in my case 0 and 1).

I'm having issues proceeding from here.
This repo does:

top_1 = decode_predictions(predictions)[0][0]
print('Predicted class:')
print('%s (%s) with probability %.2f' % (top_1[1], top_1[0], top_1[2]))

predicted_class = np.argmax(predictions)
cam, heatmap = grad_cam(model, preprocessed_input, predicted_class, "block5_conv3")

So it's basically picking up a category, and calculating gradients.
What should I do in my case?

Kindly help me out,
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions