albermax / innvestigate

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

Model with more than one output #146

Closed beatriz-ferreira closed 5 years ago

beatriz-ferreira commented 5 years ago

Hi,

I was trying to run innvestigate for a custom model that has more than one output (kind of a multi-task model). I am also getting the following error (already mentioned in): line 370-371 of analyzer/base.py

        if len(model_output) > 1:
            raise ValueError("Only models with one output tensor are allowed.")

So I guess I have to split it into two different models

Originally posted by @jurgyy in https://github.com/albermax/innvestigate/issues/137#issuecomment-470149510

Is there any way of analyzing such a model with more than one output? I'm really interested in keeping the two outputs, i.e. a joint model, as the two outputs predict different level classifications (categories and attributes) of the same image. Since these two outputs are related I would like to study them together. Is there any way of applying innvestigate for such a case?

Thank you!

albermax commented 5 years ago

Hi Beatriz,

how about adding a concatenation layer in the end? Sorry, it's a bit inconvenient. We will keep it in mind for the major, upcoming update.

Cheers, Max

beatriz-ferreira commented 5 years ago

Hi Max,

Thank you for your reply. I'll try that! Adding a concatenation layer shouldn't change any behaviour of the interpretation, is that correct?

Yes, it would be great if the major upcoming update considered this issue!!

Best, Beatriz

albermax commented 5 years ago

No, mind that most/all analysis methods work w.r.t. to one output neuron. Thus it only changes the way you index them.

We will!

Cheers

ujjwalnur commented 1 year ago

@albermax Has this been worked on ?