I have been given a model by a college and want to use it to create a heatmap. To do so, i need to get the result of the last convolutional layer. So I've tried to create a new model using the definitions of the old. I've seen this is possible in python and it seems it should be possible according to the docs.
My code looks something like this:
const combined_output_model = (cam_model) => {
const conv_layer = cam_model.layers.length - 3
const input_layer = cam_model.input
const output_layer = cam_model.layers[conv_layer].output
return model = tf.model(
inputs=input_layer,
outputs=output_layer
)
However, when I run the code I get the following error:
container.ts:156 Uncaught (in promise) TypeError: Cannot read property 'sourceLayer' of undefined
at e [as constructor] (container.ts:156)
at new e (training.ts:483)
at Object.t.model (exports.ts:74)
at predictor (prediction.js:28)
when looking at both input_layer and output_layer in the local variables show they both have sourceLayers
Any help appreciated.
Regards