captum
captum copied to clipboard
Feature Request add parameter to visualization functions to save figure
🚀 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
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
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
that'd be great too! Maybe both?