How to split a Keras model, with a non-sequential architecture like ResNet, into sub-models?
- 阅读更多 关于 How to split a Keras model, with a non-sequential architecture like ResNet, into sub-models?
My model is a resnet-152 i wanna cutting it into two submodels and the problem is with the second one i can't figure out how to build a model from an intermediate layer to the output I tried this code from this response and it doesn't work for me here is my code: def getLayerIndexByName(model, layername): for idx, layer in enumerate(model.layers): if layer.name == layername: return idx idx = getLayerIndexByName(resnet, 'res3a_branch2a') input_shape = resnet.layers[idx].get_input_shape_at(0) # which is here in my case (None, 55, 55, 256) layer_input = Input(shape=input_shape[1:]) # as keras