albermax / innvestigate

A toolbox to iNNvestigate neural networks' predictions!
Other
1.26k stars 233 forks source link

Error when analyzing using tensorflow 2.4 #242

Closed aliyaHammad closed 3 years ago

aliyaHammad commented 3 years ago

Hello!

I have been trying to apply an analyzer on a model using TensorFlow 2.4 and I am getting the error shown in the attached pictures. I am using the innvestigate_updates_towards_tf2.0 branch and it works when I am using TensorFlow 2.2, but when upgrading to 2.4 it seems to crash. I can only load the model using TensorFlow 2.4 so it is not possible to just downgrade to 2.2.

Creating an analyzer works fine, but it's the analyzer.analyze(image) function that is causing the issue.

Thanks!

Bildschirmfoto von 2021-03-12 23-18-22 Bildschirmfoto von 2021-03-12 23-18-34

leanderweber commented 3 years ago

Hi @aliyaHammad,

the innvestigate_updates_towards_tf2.0 branch was implemented for (up to) tensorflow version 2.3, so there my be some issues when using tensorflow 2.4. The branch will not really be updated anymore going forward, since an official innvestigate 2 version is currently being worked on.

However, even with tensorflow 2.4, I was not able to reproduce above bug, could you maybe provide some more information?

Cheers, Leander

aliyaHammad commented 3 years ago

Hi @leanderweber!

Thank you for answering. I was using an older version of the branch, and once updating it I faced another issue.

Bildschirmfoto von 2021-04-20 22-11-10

I also noticed that the innvestigate.utils.keras.graph.model_wo_softmax() function deos not actually strip the model of the softmax layer. This issue never happened in the last version. I am using Pycharm, tensorflow 2.4 and python 3.8.

Regards, Aliya Hammad

rachtibat commented 3 years ago

Hi Aliya,

innvestigate 2 returns a dictionary. The keys of the dict are the layer names.

Best