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

Pixelflipping #3

Closed
albermax opened this issue Feb 26, 2018 · 10 comments
Closed

Pixelflipping #3

albermax opened this issue Feb 26, 2018 · 10 comments

Comments

@albermax
Copy link
Owner

albermax commented Feb 26, 2018

In the tool submodule adding a pixelflipping evaluation.

Constructor inputs:

  • model, analyzer(s), function to merge attribution region (e.g., non-overlapping max-pooling), function to "blur" region, size of regions, number of steps.
  • evaluate (generator+normal interface):
    • do all analyzations, "blur", use fit_generator of model to get new predictions.
    • output, matrix: (analyzer, sample, number of steps) output.

Multi-gpu?

@albermax
Copy link
Owner Author

Please have a look and update the documentation formatting. Thanks.

@albermax
Copy link
Owner Author

How does it go?

@postskript
Copy link
Contributor

The perturbation is implemented and I uploaded a Jupyter Notebook for MNIST #43 . A few (not so urgent) features remain to do, e.g. in-place perturbation but I guess this can be postponed to after the first release. Also updated the documentation #44 .

For the notebook, I still have to find some parameters which give nice results. Apart from that, it should be done more or less.

@albermax
Copy link
Owner Author

albermax commented Mar 27, 2018

Great, thank you!

Could please you resubmit the notebook so one can see the output on Github?

@postskript
Copy link
Contributor

I added the output in #49 .

@sebastian-lapuschkin
Copy link
Contributor

When using perturbation methods "mean" and "gaussian" in examples/mnist_perturbation, only in the first perturbation step something seems to happen. In the consecutive ones, not much change is to be seen.

Questions/Suggestions/Stuff:

  • if perturbation regions are specified, are those the regions to perturb or also the candidate regions? If the region parameter only determines the size of the perturbation region, but not the computation of a region candidate of that size, I suggest using the parameter to also subdivide the input into perturbation regions of that size. The purpose would be to disqualify already perturbed pixel locations for consecutive perturbations: For example, take the region parameter to subdivide the mnist image into a grid of regions, and perturb the regions. something along those lines. just avoid re-perturbing the same pixels again and again.
  • are saliency maps recomputed after each perturbation, or is this a one-shot step prior to the perturbation sequence?
  • Suggestion: add perturbation methods zeros, ones, etc.
  • Suggestion: add to the plot the input image, the saliency map to perturb by and for each perturbation step an indicator next to the perturbed image, which input region has been perturbed.

@albermax
Copy link
Owner Author

Thank you! Looks good!!

Would you mind to extend the notebook by a comparison of a few analyzers, a smaller region and more steps?
The notebooks should be a hands on documentation and therefore it would be great to have some text that walks the reader through the whole notebook ;-)

@sebastian-lapuschkin
Copy link
Contributor

sebastian-lapuschkin commented Apr 25, 2018

Something does not seem to be ok with the notebook. I have been working on the textual description and up to cell 18 in the notebook, there is no data being passed to the perturbation analyzer.
Thus, after perturbing currently up to 40% of whatever (?) (several perturbation functions and saliency variants have been compared), virtually nothing changes.

Similarly, the calls to test_sample = perturbation_analysis.compute_on_batch(test_sample) provoke no change in the given sample, which reflects in the plot below. The example file examples/mnist_perturbations.py seems to work, however, with several analyzers and perturbation methods..

ToDos:

  • get the notebook to work. optimally compute perturbations comparingly between several analyzers. plot all those curves.
  • fix perturbation region sizes other than (1,1) leading to crashes.
  • Adapt both the notebook and the example python scripts to the layout and work flow pattern of the other example files: Same setup, re-use utility and plotting functions.

pfa some perturbation code I have used for another project, for reference.
deep-gait-perturbations.zip
the 'meat' of the perturbation functionality can be found in perturbation_experiments.py

@postskript
Copy link
Contributor

Thanks a lot for the revision!

... virtually nothing changes.

I set the inplace flag in the Perturbation object to False to avoid confusion when rerunning the script (in this case you would start with the already perturbated data if you do not rerun the data loading cell which is not what you want).

fix perturbation region sizes other than (1,1) leading to crashes.

I have not been able to reproduce this, it works for arbitray region shapes (tried out LRP Epsilon and Gradient). When does the problem occur?

Adapt both the notebook and the example python scripts to the layout and work flow pattern of the other example files: Same setup, re-use utility and plotting functions.

I adapted the notebook to match the other ones already.

The mnist_perturbation.py will be updated as soon as the notebook is in an acceptable state. Until then it should not be used.

... compute perturbations comparingly between several analyzers

This is definitely on the To-do list but I haven't had time yet unfortunately. So far, I mainly tried out LRP Epsilon.

@postskript
Copy link
Contributor

Ad 5.: done in #73

@albermax albermax closed this as completed Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants