albermax / innvestigate

A toolbox to iNNvestigate neural networks' predictions!
Other
1.24k stars 235 forks source link

Compatible Architectures #278

Closed Lilithrrm closed 2 years ago

Lilithrrm commented 2 years ago

Hi Albermax,

I'd like to use your library on images and have three questions on innvestigate:

1) In your description it's said that your innvestigate library is apllicable to VGG16/19, inception_v3, etc. How "strict" are those architectures meant? If it is a variation (but all layers from keras), should it work as well? (The model I want to investigate is a 10-layer CNN with some conventional layers and two times the inceptionv1-module als layers.)

2) When using another XAI library (SHAP) I was facing issues with the fact that the modelinput was expected to be of dimension (x,x,3) (so RGB) and didnt allow gray scale pics. Is that the same for innvestigate?

3) My model was actually built using tf 2.3. I saw that the newest supported tf version of innvestigate is tf 2.1. However, I am still getting issues when trying to run my model and innvestigate code on tf 2.1. E.g. after analyzer = innvestigate.create_analyzer("gradient", model) analysis = analyzer.analyze(x) I get AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' Would you reccomend to build the model straight away in tf1.12 instead to avoid any issues?

Thank you so much in advance!

Best,

Lilith

adrhill commented 2 years ago

Hi @Lilithrrm,

  1. Since iNNvestigate supports network architectures with parallel connections such as ResNets, I would assume that inception modules work as well. @albermax is more familiar than me with the inner workings of iNNvestigate's Keras graph reversal algorithm, so maybe he can chime in on this.

  2. You can check out this introductory example on MNIST, which applies iNNvestigate to a model with grayscale input.

  3. Current iNNvestigate releases only support TF1. The code for "iNNvestigate 2.0" which works on TensorFlow 2 is done and is currently being reviewed and merged. You can subscribe to issue https://github.com/albermax/innvestigate/pull/277 to be notified about progress!