albermax / albermax/innvestigate

No softmax found

未关闭
#168 13 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
1.3k
派生
230
PR 合并指标
30 天内没有已合并 PR

描述

Hi
Can you help me albermax. I am just running this section of code:

```python
import innvestigate
import innvestigate.utils
import tensorflow.keras.applications.vgg16 as vgg16
from tensorflow.keras.preprocessing.image import load_img
from tensorflow.keras.preprocessing.image import img_to_array
import numpy as np
import imp
import os
# Get model
model, preprocess = vgg16.VGG16(), vgg16.preprocess_input
# Strip softmax layer
model = innvestigate.utils.model_wo_softmax(model)
```
I am getting the below error:
```python
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
in
21 model, preprocess = vgg16.VGG16(), vgg16.preprocess_input
22 # Strip softmax layer
---> 23 model = innvestigate.utils.model_wo_softmax(model)
24
25 # Create analyzer

/opt/anaconda3/lib/python3.7/site-packages/innvestigate/utils/__init__.py in model_wo_softmax(*args, **kwargs)
35 from .keras.graph import model_wo_softmax
36
---> 37 return model_wo_softmax(*args, **kwargs)
38
39

/opt/anaconda3/lib/python3.7/site-packages/innvestigate/utils/keras/graph.py in model_wo_softmax(model)
381 """Creates a new model w/o the final softmax activation."""
382 return keras.models.Model(inputs=model.inputs,
--> 383 outputs=pre_softmax_tensors(model.outputs),
384 name=model.name)
385

/opt/anaconda3/lib/python3.7/site-packages/innvestigate/utils/keras/graph.py in pre_softmax_tensors(Xs, should_find_softmax)
373
374 if should_find_softmax and not softmax_found:
--> 375 raise Exception("No softmax found.")
376
377 return ret

Exception: No softmax found.
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。