# About improving the classifier when using a pre-trained model

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._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?

• Your model is overfitting after adding a layer. What was the train score w/o the extra layer? Sep 19 at 12:54
• Without the layer (10 epochs) test accuracy 71%.. Whith the _added_layer (100 epochs) test accuracy 61% Sep 19 at 13:03
• Can you also share the score on train data for your model without the extra layer? Would be even better to see the learning curves for both models (i.e. #epochs vs. loss for both models on train and test data). Sep 19 at 15:44
• Accuracy on train data is very high in both cases. Without the _added_layer in 10 epochs is about 98%, and with the added layer 100% Sep 19 at 15:55