model summary:

enter image description here enter image description here enter image description here

RuntimeError: You must compile your model before using it.

It says that the model needs to be compiled. But as far i know, if i compile a model, all the previous trained data will be lost, and the model will be trained from scratch. I don't want this to happen because i want to use this model for further re-training purposes. Can you help me in this.

Can I re-train the model without compiling it and ,save it and use this model for future training ?


There 2 techniques while using the pre-train model

1. Transfer learning: In the case of transfer learning, we use the pre-train model to train on new kind of dataset so generally, remove the last layer and add a new layer into the network. At this point, as you are adding a new layer the model should be compiled. But don't worry if you are compiling it then weights will not be lost.

2. Retraining (I guess this is your case): As you are not modifying the architecture but just training it on additional dataset then also it is not going to loose weights.

  • $\begingroup$ Thanks, i have one more question. I just want to get the class names of the predictions. I can get the class names on the images that i trained the model. But if i predict an image (say which is not re-trained but already present in pre-trained model i cannot get its class name). Is there any way to get the get the class name ?? $\endgroup$ Jul 3 '19 at 12:05
  • $\begingroup$ Yes, Only if you have access to their JSON file which contains a number to class mapping like in the case of model which are trained on imagenet dataset. Check imagenet json storage.googleapis.com/download.tensorflow.org/data/… If you find the above answer useful kindly marked it as answered $\endgroup$ Jul 3 '19 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.