-
Notifications
You must be signed in to change notification settings - Fork 111
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
My generated image for "integrated_gradients.py" was totally black. #125
Comments
It happened to me and I fixed changing transform_to_normalized_grayscale function. change: to: |
Hi, thanks for your reply @matheushent . |
Try to plot grayscale_integrated_gradients inside explain function. If it works so you found the problem is in grid_display function. Remember grayscale_integrated_gradients is a 4D array (batch_size, height, width, channels). |
Will it work if I remove that function? Because I don’t see any point of
it, other transforming it into grayscale.
…On Mon, 6 Apr 2020 at 4:55 PM, Matheus Tosta ***@***.***> wrote:
Hi, thanks for your reply @matheushent <https://github.com/matheushent> .
Still no luck. I changed it and I still get the black image...
Try to plot *grayscale_integrated_gradients* inside explain function. If
it works so you found the problem is in grid_display function. Remember
*grayscale_integrated_gradients* is a 4D array (batch_size, height,
width, channels).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#125 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJLQTTZMOXI6L7QZH57DTTTRLG3Y3ANCNFSM4MA6ZMAQ>
.
|
Indeed I don't use that function, so it will. I just return grayscale_integrated_gradients and work with it knowing it is a 4D array. Furthermore, doing that, you can get all pictures without using the grid, so you can work separately on each image. |
Do you have any example code for me to look at for working with a single
image? I’m still having trouble, even after removing the grayscale function.
On Mon, 6 Apr 2020 at 6:16 PM, Matheus Tosta <notifications@github.com>
wrote:
… Will it work if I remove that function? Because I don’t see any point of
it, other transforming it into grayscale.
… <#m_-4162699721386692276_>
On Mon, 6 Apr 2020 at 4:55 PM, Matheus Tosta *@*.***> wrote: Hi, thanks
for your reply @matheushent <https://github.com/matheushent>
https://github.com/matheushent . Still no luck. I changed it and I still
get the black image... Try to plot *grayscale_integrated_gradients*
inside explain function. If it works so you found the problem is in
grid_display function. Remember *grayscale_integrated_gradients* is a 4D
array (batch_size, height, width, channels). — You are receiving this
because you authored the thread. Reply to this email directly, view it on
GitHub <#125 (comment)
<#125 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AJLQTTZMOXI6L7QZH57DTTTRLG3Y3ANCNFSM4MA6ZMAQ
.
Indeed I don't use that function, so it will. I just return
*grayscale_integrated_gradients* and work with it knowing it is a 4D
array. Furthermore, doing that, you can get all pictures without using the
grid, so I can work separately on each image.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#125 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJLQTT542GOUJXZRHFSCI4DRLHFJFANCNFSM4MA6ZMAQ>
.
|
Hi everyone! The problem comes from the facts that th enumber of channels in the map can be > 3, which is unhandy to plot. Reducing to 1 channel only aims at representing it more easily. In the next tf-explain release, I'll make sure to split the generation of the 4D tensor from the generation of the visualization, so that anyone can use attribution map the way they want. |
When I use the |
@matheushent What is the use of grid_display function? I went through the code and I get the use of everything except for the grid_display function. I was wondering what is the significance of that function? What if we do not use that function? |
In my understanding, grid_display function only concatenates all images into one. When disabling it you need to change the way things happen on callback. For example, here is the example of what I did in the core:
Note that doing it and setting _grid as false, grayscale_integrated_gradients will return a 4D array of shape (batch_size, H, W, N), so a error will be raised since here it is:
Note
Also, I recommend you to change max_outputs parameter of tf.summary.image according your needs since the default is 3. |
@matheushent So, basically grid_display is required only
Is that correct? |
@rao208 Yes, but note you need to pass a list |
@matheushent Oh okay... now it is clear...Thank you :) |
I know this isn't the right way to talk about this problem but I didn't know how to contact the maintainers.
I don't know why this happens. I tried it out for different images, but to no avail. I also tried changing the parameter
n_steps
yet I got a black image.The text was updated successfully, but these errors were encountered: