Closed linchundan88 closed 5 years ago
input_tensor = model.layers[0].input
fModel = Model(inputs=input_tensor, outputs=model.layers[-1].output)
target_tensor = fModel(input_tensor)
In this case, input_tensor will be none.
Another problem, if I load a model from file, I must predict one time before generating saliency maps ,otherwise it will raise an exception: "tensorflow.python.framework.errors_impl.InternalError: Blas SGEMM launch failed : m=21609, n=128, k=64
But if I use this model to predict one time, after that DeepExplain run well.
About the first issue, do you know the shape of the input? In this case, you can define the input shape in the model. DeepLIFT needs to run the model on a baseline first, so the dimensions need to be known (or you can pass the baseline=
parameter explicitly)
I can change the input shape in the model, but I have a lot of models, it will take a long time. I want to know how to pass the baseline= parameter explicitly. Can you give me an example? I use Keras most of the time. Thanks in advance.
baseline must be a numpy array with the size of the input. I found it.
such as : baseline1 = np.zeros((image_size, image_size, 3)) explainer = de.get_explainer('deeplift', target_tensor, input_tensor, baseline=baseline1)
if some dimensions of input are not specified, for example
(None, None, None, 3)
Method
elrp
works fine, butdeeplift
raises an error. (Both traditional API and Explainer API.) TypeError: 'NoneType' object cannot be interpreted as an integer.In v0.1, it seems to work OK.