I have tried adding a layer in the Resnet Model as shown:
fuente ="https://tfhub.dev/tensorflow/resnet_50/feature_vector/1" class ResNetModel(tf.keras.Model): def __init__(self, classes): super(ResNetModel, self).__init__() self._feature_extractor = hub.KerasLayer(fuente, trainable=False) self._added_layer = tf.keras.layers.Dense(32, activation = "relu",trainable = True) self._classifier = tf.keras.layers.Dense(classes, activation='softmax') def call(self, inputs): x = self._feature_extractor(inputs) x= self._added_layer(x) x = self._classifier(x) return x
The test accuracy has diminished a lot. When training with more epochs, the training accuracy rapidly arrives at 100%, but the test accuracy stucks at 61.7%, much worse that using the model without the added layer(72% with 10 epochs). I expected some improvement in the result. Where is my error?