0

I am training a model with two inputs (imaging data) and want to plot GRAD-CAM to visualize the activation maps. I tried to do this by following this example in Keras: https://keras.io/examples/vision/grad_cam/

While doing this for the multi-input network, I am getting an error:

ValueError: Graph disconnected: cannot obtain value for tensor KerasTensor(type_spec=TensorSpec(shape=(None, 224, 224, 3), dtype=tf.float32, name='input_2'), name='input_2', description="created by layer 'input_2'") at layer "zero_padding2d_2". The following previous layers were accessed without issue: []

I believe the error is from this part of the code:

grad_model = keras.models.Model(
        model.inputs, [model.get_layer(last_conv_layer_name).output, model.output]
    )

How can I change the above in the case of multi-input models?

Dushi Fdz
  • 161
  • 3
  • 22
  • 2
    you need to provide more details, like your model code, how you're compiling it, etc – Musabbir Arrafi Aug 24 '23 at 17:58
  • Does this answer your question? [How to get class activation map for multi output model?](https://stackoverflow.com/questions/65245923/how-to-get-class-activation-map-for-multi-output-model) – Innat Aug 24 '23 at 22:21

0 Answers0