# How to apply my deep learning model to a new dataset?

I am doing semantic segmentation (multi-class classification of image pixels) using convolutional neural networks (CNN) in Keras.

In particular, I am applying this to aerial images of crops (vegetation). In Keras, I successfully developed a workflow to segment/classify different crops for one specific dataset (let's call this dataset rural area #1).

Can I apply my Keras weights trained on rural area #1 for initializing the training of another dataset rural area #2? Such as:

model = load_model("weights_ruralarea1.hdf5")


Then I will proceed to model.fit.

The rural area #2 dataset has little training images for training the CNN. So would using my weights for rural area #1 be a form of transfer learning? or will it be a form of fine-tuning?

There is a difference between using pre trained weights and transfer learning.

1. When you use pre trained weights and re train all the layers in the entire model for the dataset, then you are just working towards converging faster in the direction of better results.

2. If you were to only train the upper layers and lock all the other layers from training, then you are implementing transfer learning.

For your problem at hand, I would use approach 1.

Would be more than happy to elaborate in case you want me to.

Here is a link that explains how to do transfer learning with Keras : https://towardsdatascience.com/transfer-learning-using-keras-d804b2e04ef8

• Nischal, please elaborate.....very good info thus far. Perhaps on why approach 1 should be used for my case. Also, what do we mean by 'train upper layers and lock other layers' ? My model is here. How can I lock and only train these upper layers for example. – user121 Feb 9 '18 at 6:19
• @unknown121 - I have updated my answer that will help you with your model. – Nischal Hp Feb 9 '18 at 7:54