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

Not getting unique heatmap for every slice in input volume #4

Open
JamesCallanan opened this issue Feb 8, 2022 · 1 comment
Open

Comments

@JamesCallanan
Copy link

I found the issue. It is due to the resizing of the cam variable using skimage.transform.resize().

from skimage.transform import resize
capi=resize(cam,(128,128,128))

This resizing implementation results in cam[ : , : , 0 ] equalling cam[ : , : , 1 ] and cam[ : , : , -1 ] equalling cam[ : , : , -2] for me.

Swapping the resizing function which relies on scipy.ndimage.zoom()) worked for me.
Now each slice now is unique.

def resize_volume(img, desired_depth, desired_height, desired_width):
"""Resize across z-axis"""

Get current depth

current_depth = img.shape[-1]
current_width = img.shape[0]
current_height = img.shape[1]

Compute depth factor

depth = current_depth / desired_depth
width = current_width / desired_width
height = current_height / desired_height
depth_factor = 1 / depth
width_factor = 1 / width
height_factor = 1 / height

Rotate

img = ndimage.rotate(img, 90, reshape=False)

Resize across z-axis

img = ndimage.zoom(img, (width_factor, height_factor, depth_factor), order=1)
return img

capi = resize_volume(cam,128,128,128)

relevant file = guided_Gradcam3.py

@DanielCardozoSantos
Copy link

Hi,
I have a question I'd like to clarify. Does this model, in conjunction with Grad-CAM, generate a heatmap for each "slice" of the input volume? In other words, is the technique applied individually to each slice of the three-dimensional dataset, creating heatmaps for each of them?

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

2 participants