aniketmaurya / chitra

A multi-functional library for full-stack Deep Learning. Simplifies Model Building, API development, and Model Deployment.

Home Page:https://chitra.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disconnected graph error in `InterpretModel`

aniketmaurya opened this issue · comments

Bug description

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-91-b64613cd9976> in <module>
----> 1 interpret(img.image, auto_resize=False)

~/miniconda3/envs/aniket/lib/python3.7/site-packages/chitra/trainer.py in __call__(self, image, auto_resize, image_size)
    352             X,
    353             penultimate_layer=-1,  # model.layers number
--> 354             seek_penultimate_conv_layer=True,
    355         )
    356         cam = normalize(cam)

~/miniconda3/envs/aniket/lib/python3.7/site-packages/tf_keras_vis/gradcam.py in __call__(self, loss, seed_input, penultimate_layer, seek_penultimate_conv_layer, activation_modifier, expand_cam, training)
    148         # Processing gradcam
    149         model = tf.keras.Model(inputs=self.model.inputs,
--> 150                                outputs=self.model.outputs + [penultimate_output_tensor])
    151 
    152         with tf.GradientTape(watch_accessed_variables=False) as tape:

~/miniconda3/envs/aniket/lib/python3.7/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
    515     self._self_setattr_tracking = False  # pylint: disable=protected-access
    516     try:
--> 517       result = method(self, *args, **kwargs)
    518     finally:
    519       self._self_setattr_tracking = previous_value  # pylint: disable=protected-access

~/miniconda3/envs/aniket/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in __init__(self, inputs, outputs, name, trainable, **kwargs)
    118     generic_utils.validate_kwargs(kwargs, {})
    119     super(Functional, self).__init__(name=name, trainable=trainable)
--> 120     self._init_graph_network(inputs, outputs)
    121 
    122   @trackable.no_automatic_dependency_tracking

~/miniconda3/envs/aniket/lib/python3.7/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
    515     self._self_setattr_tracking = False  # pylint: disable=protected-access
    516     try:
--> 517       result = method(self, *args, **kwargs)
    518     finally:
    519       self._self_setattr_tracking = previous_value  # pylint: disable=protected-access

~/miniconda3/envs/aniket/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in _init_graph_network(self, inputs, outputs)
    202     # Keep track of the network's nodes and layers.
    203     nodes, nodes_by_depth, layers, _ = _map_graph_network(
--> 204         self.inputs, self.outputs)
    205     self._network_nodes = nodes
    206     self._nodes_by_depth = nodes_by_depth

~/miniconda3/envs/aniket/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in _map_graph_network(inputs, outputs)
    988                              'The following previous layers '
    989                              'were accessed without issue: ' +
--> 990                              str(layers_with_complete_input))
    991         for x in nest.flatten(node.outputs):
    992           computable_tensors.add(id(x))

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

Expected result

Actual result

Steps to reproduce

Context

Your Environment

  • Version used:
  • Operating System and version:
  • Link to your fork:

Stale issue message

Stale issue message