keras-vis icon indicating copy to clipboard operation
keras-vis copied to clipboard

3D saliency implementation

Open kitamura-felipe opened this issue 7 years ago • 6 comments

This PR adds saliency3D.py, which implements a 3D version of visualize_cam().

Usage is described in example/3D_saliency_snippet.ipynb

A minor change in scipy/misc/pilutils.py is needed and is described in vis/visualization/follow_this.txt

kitamura-felipe avatar Jul 21 '18 04:07 kitamura-felipe

Thank you for the PR.

I don't think we should merge this change. Because currently keras-vis (i.e., master branch) is able to visualize cam in 3-dims.

https://github.com/raghakot/keras-vis/blob/9821aeab1f9396dba5e9137d0c3bcf4e6dee52bd/vis/visualization/saliency.py#L187-L188

keisen avatar Aug 31 '18 22:08 keisen

Indeed it calculates 3dims. But there is a minor bug in the output to handle 3d grayscale images.

Em sex, 31 de ago de 2018 19:34, Keisen [email protected] escreveu:

Thank you for the PR.

I don't think we should merge this change. Because currently keras-vis (i.e., master branch) is able to visualize cam in 3-dims.

https://github.com/raghakot/keras-vis/blob/9821aeab1f9396dba5e9137d0c3bcf4e6dee52bd/vis/visualization/saliency.py#L187-L188

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/raghakot/keras-vis/pull/124#issuecomment-417805961, or mute the thread https://github.com/notifications/unsubscribe-auth/AX5aCcpw8r2BgeQ1hSdQuzcJRpIc4O_Sks5uWboGgaJpZM4VZetc .

kitamura-felipe avatar Aug 31 '18 23:08 kitamura-felipe

Can you show us the detail of minor bug ?

keisen avatar Sep 01 '18 04:09 keisen

I don't have the error anymore, but if you run the code on a 3D model with 1 channel (batch_size, d1, d2, d3, channel=1), the error will appear.

The solution I proposed is just to adjust the output of as visualize_cam_with_losses folows:

[image: image.png]

[image: photo] Felipe Campos Kitamura Head, Artificial Intelligence Lab DASA Neuroradiologist at Universidade Federal de São Paulo +55 11 97963-0032 <+55+11+97963-0032> | [email protected] http://facebook.com/felipe.kitamura? http://br.linkedin.com/in/felipe-kitamura-7a6477a1

On Sat, Sep 1, 2018 at 1:15 AM Keisen [email protected] wrote:

Can you show us the detail of minor bug ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/raghakot/keras-vis/pull/124#issuecomment-417831344, or mute the thread https://github.com/notifications/unsubscribe-auth/AX5aCc5OpL1HAYwe9FpASyVwwQxknEy0ks5uWgnEgaJpZM4VZetc .

kitamura-felipe avatar Sep 01 '18 13:09 kitamura-felipe

I don't have the error anymore, but if you run the code on a 3D model with 1 channel (batch_size, d1, d2, d3, channel=1), the error will appear.

I tried it but the error was not occurred. The shape of input data is (batch_size, d1, d2, d3, 1) and the shape of visualize_cam result is (d1, d2, d3), It has no problem.

Can you post the short script (or the link of Gist) here that can reproduce your issue ?

visualize_cam_with_losses folows: [image: image.png] [image: photo]

Please resend the images if you need.

keisen avatar Sep 02 '18 05:09 keisen

We should just fix the issue that causes his use-case to not work. The API should handle N-dim inputs.

raghakot avatar Sep 15 '18 01:09 raghakot