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?