Reputation:
I am getting error when plotting my model. My code is
from keras.utils import plot_model
plot_model(model, to_file='model.png')
Showing error
1 frames /usr/local/lib/python3.6/dist-packages/keras/utils/vis_utils.py in model_to_dot(model, show_shapes, show_layer_names, rankdir, expand_nested, dpi, subgraph) 167 node_key = layer.name + '_ib-' + str(i) 168 if node_key in model._network_nodes: --> 169 for inbound_layer in node.inbound_layers: 170 inbound_layer_id = str(id(inbound_layer)) 171 if not expand_nested: TypeError: 'InputLayer' object is not iterable
My keras model summary is
Model: "PneumoniaModel"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_1 (InputLayer) [(None, 84, 84, 1)] 0
_________________________________________________________________
zero_padding2d (ZeroPadding2 (None, 90, 90, 1) 0
_________________________________________________________________
conv0 (Conv2D) (None, 84, 84, 32) 1600
_________________________________________________________________
bn0 (BatchNormalization) (None, 84, 84, 32) 128
_________________________________________________________________
activation (Activation) (None, 84, 84, 32) 0
_________________________________________________________________
pool0 (MaxPooling2D) (None, 42, 42, 32) 0
_________________________________________________________________
flatten (Flatten) (None, 56448) 0
_________________________________________________________________
fc (Dense) (None, 1) 56449
=================================================================
Total params: 58,177
Trainable params: 58,113
Non-trainable params: 64
Upvotes: 0
Views: 3066
Reputation:
I had just solved it,
Error was in importing instead of
from tensorflow.keras.utils import plot_model
I was importing
from keras.utils import plot_model
I was using tensorflow 2.0 in my model so it solved.
Upvotes: 2