Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting help with GradCam on Segmentation #36

Open
varungupta31 opened this issue May 12, 2022 · 0 comments
Open

Requesting help with GradCam on Segmentation #36

varungupta31 opened this issue May 12, 2022 · 0 comments

Comments

@varungupta31
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant