raghakot / keras-vis

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

VGG Regression with two input layers #91

Open rbn5009 opened 6 years ago

rbn5009 commented 6 years ago

Raghakot,

I've been experimenting with using pre-trained VGG16 as a feature extractor and merging the output of the last (None, 4096) dense layer with another small FC dense model. The output of the merged model is a single number (regression).

My model input looks like the following, where the first input is the image and the second is a vector of length 2 where I specify information needed for making a prediction that it cannot learn from the image itself : [(None, 224, 224, 3), (None, 2)]

I'd like to essentially hard-code the second input to be a constant [n1, n2] or something, while performing activation maximization or saliency on the image input. Any thoughts on how to accomplish this? Can I specify the second input_layer as the wrt_tensor when the Optimizer is called?

Thanks!

manuelblancovalentin commented 6 years ago

I'm also interested in this. My model uses two inputs but when I try to use the optimizer from the vis.utils module I get the following error:

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