captum icon indicating copy to clipboard operation
captum copied to clipboard

Feature Request add parameter to visualization functions to save figure

Open staniPetrox opened this issue 3 years ago • 3 comments
trafficstars

🚀 Feature

Give visualize_image_attr a flag that allows to save the figure in a given path, might as well implement that new flag for every other visualization function

Motivation

It is cumbersome to save images when receiving a figure from the function. Furthermore you can't show and save a figure at the same time, see this stackoverflow thread

Pitch

add plt.savefig(img_path), add img_path as a parameter to that function in visualization.py.

Alternatives

Additional context

I opened a question thread before, they are both related, however not the same

staniPetrox avatar Nov 02 '22 17:11 staniPetrox

Thank you for the proposal, @staniPetrox! In a general case, we could potentially also take a save_func and call it with the plot. The user can handle saving part the way that they want. cc: @cyrjano , @vivekmig

NarineK avatar Nov 11 '22 00:11 NarineK

Alternatively instead of saving we could also have an option to return the attribution map: norm_attr which will also help with this issue ? https://github.com/pytorch/captum/issues/1053

NarineK avatar Nov 11 '22 00:11 NarineK

that'd be great too! Maybe both?

staniPetrox avatar Nov 13 '22 20:11 staniPetrox