I have a CNN network with three layers and after fitting the model, weights are saved on disk. The second time I load the weights, but this time model is increased with a layer. So it is now 4 layer network. Is it possible to transfer model weights with the different architecture? If yes then how? I am using keras for development.
For me it shows error: 'You are trying to load a weight file containing 3 layers into a model with 4 layers'.
Thanks in advance!
I have not tried this, but it should be possible by using the layer.get_weights() and layer.set_weights(weights) methods.
weights = old_model_layer.get_weights()
new_model_layer.set_weights(weights)
See https://keras.io/layers/about-keras-layers/ for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With