Fine-tuning Deep Learning Models in Keras

Renjith Ms
1 min readMar 19, 2018

--

I followed the tutorial in the link provided below

I have to fine tune a model which is already trained with the dataset .I have to fine tune this model with new set of data which are representing the same classes as in my training but having some difference in its view.The procedure used by me is given below

finemodel=baseline_model()
finemodel.load_weights(‘mysavedmodel.h5’)
for layer in finemodel.layers[:5]:
…….layer.trainable = False

I want to freeze the weight for the first 5 layers so that they remain intact throughout the fine-tuning process.

finemodel.fit(X_train_ft,y_train_ft,validation_data=(X_test_ft,y_test_ft),nb_epoch=10,batch_size=10)

It is actually a common practice to freeze the weights of the first few layers of the pre-trained network. This is because the first few layers capture universal features like curves and edges that are also relevant to our new problem. We want to keep those weights intact. Instead, we will get the network to focus on learning dataset-specific features in the subsequent layers.

https://medium.com/@14prakash/transfer-learning-using-keras-d804b2e04ef8

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Renjith Ms
Renjith Ms

No responses yet

Write a response