Is there a way to remove a rescaling layer from a functional model?
I'm trying to remove the rescaling layer from this model:
efficientnetb0_model.layers[0:10]
Output:
[<tensorflow.python.keras.engine.input_layer.InputLayer at 0x18d5e873d90>,
<tensorflow.python.keras.layers.preprocessing.image_preprocessing.Rescaling at 0x18d5e8a2d00>,
<tensorflow.python.keras.layers.preprocessing.normalization.Normalization at 0x18d5eb48100>,
<tensorflow.python.keras.layers.convolutional.ZeroPadding2D at 0x18d5eb48550>,
<tensorflow.python.keras.layers.convolutional.Conv2D at 0x18d5eb7f670>,
<tensorflow.python.keras.layers.normalization_v2.BatchNormalization at 0x18d5eba2c70>,
<tensorflow.python.keras.layers.core.Activation at 0x18d5eb481f0>,
<tensorflow.python.keras.layers.convolutional.DepthwiseConv2D at 0x18d5ebe8e50>,
<tensorflow.python.keras.layers.normalization_v2.BatchNormalization at 0x18d5ec08e20>,
<tensorflow.python.keras.layers.core.Activation at 0x18d5ec2f1c0>]
I tried this:
efficientnetb0_model.layers.pop(1)
efficientnetb0_model.layers[0:10]
But nothing happens:
[<tensorflow.python.keras.engine.input_layer.InputLayer at 0x18d5e873d90>,
<tensorflow.python.keras.layers.preprocessing.image_preprocessing.Rescaling at 0x18d5e8a2d00>,
<tensorflow.python.keras.layers.preprocessing.normalization.Normalization at 0x18d5eb48100>,
<tensorflow.python.keras.layers.convolutional.ZeroPadding2D at 0x18d5eb48550>,
<tensorflow.python.keras.layers.convolutional.Conv2D at 0x18d5eb7f670>,
<tensorflow.python.keras.layers.normalization_v2.BatchNormalization at 0x18d5eba2c70>,
<tensorflow.python.keras.layers.core.Activation at 0x18d5eb481f0>,
<tensorflow.python.keras.layers.convolutional.DepthwiseConv2D at 0x18d5ebe8e50>,
<tensorflow.python.keras.layers.normalization_v2.BatchNormalization at 0x18d5ec08e20>,
<tensorflow.python.keras.layers.core.Activation at 0x18d5ec2f1c0>]