raghakot / keras-vis

Neural network visualization toolkit for keras
https://raghakot.github.io/keras-vis
MIT License
2.98k stars 664 forks source link

AttributeError: Layer sequential_1 has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `get_output_at(node_index)` instead. #84

Open MathiasKahlen opened 6 years ago

MathiasKahlen commented 6 years ago

I am trying to follow the attention example on my model that looks like this:

input_2 (InputLayer) (None, 150, 150, 3) 0
block1_conv1 (Conv2D) (None, 150, 150, 64) 1792
block1_conv2 (Conv2D) (None, 150, 150, 64) 36928
block1_pool (MaxPooling2D) (None, 75, 75, 64) 0
block2_conv1 (Conv2D) (None, 75, 75, 128) 73856
block2_conv2 (Conv2D) (None, 75, 75, 128) 147584
block2_pool (MaxPooling2D) (None, 37, 37, 128) 0
block3_conv1 (Conv2D) (None, 37, 37, 256) 295168
block3_conv2 (Conv2D) (None, 37, 37, 256) 590080
block3_conv3 (Conv2D) (None, 37, 37, 256) 590080
block3_pool (MaxPooling2D) (None, 18, 18, 256) 0
block4_conv1 (Conv2D) (None, 18, 18, 512) 1180160
block4_conv2 (Conv2D) (None, 18, 18, 512) 2359808
block4_conv3 (Conv2D) (None, 18, 18, 512) 2359808
block4_pool (MaxPooling2D) (None, 9, 9, 512) 0
block5_conv1 (Conv2D) (None, 9, 9, 512) 2359808
block5_conv2 (Conv2D) (None, 9, 9, 512) 2359808
block5_conv3 (Conv2D) (None, 9, 9, 512) 2359808
block5_pool (MaxPooling2D) (None, 4, 4, 512) 0
sequential_1 (Sequential) (None, 1) 2097665

but I get the following error when calling the visualize_cam method: AttributeError: Layer sequential_1 has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use get_output_at(node_index) instead.

I have tried searching but I havn't been able to figure out how to proceed from here.

I hope you can help :)

HunterJohnson commented 6 years ago

I have this same problem. Please help @raghakot

itsnamgyu commented 5 years ago

37 Check out my last comment on this issue. Hope it helps :)

itsnamgyu commented 5 years ago

@raghakot This seems to be a popular(?) issue for novice users experimenting with transfer learning. Maybe a hotfix should be included in the main code, or perhaps some documentation? I'd be happy to help if you want to pursue this avenue.

frederikfaye commented 5 years ago

@itsnamgyu Not just transfer learning, also when your own model consists of multiple submodels.

Hope this will get fixed soon!

martin-etchart commented 5 years ago

I have the same issue. I managed to make it work by saving my model arch to json and loading it from there instead of sequentially assembling it. I suspect the json save cleans up the inbound node thing... anyhow it worked.

frederikfaye commented 5 years ago

@martin-etchart Great that you got it to work! Where do you normally sequentially assemble your model? Could you share an example with what you got working? Thanks!

shockzp commented 4 years ago

@martin-etchart I tried saving it to json and loading it. It did not work. A detailed explanation would help. Thanks!