I have trained a multilabel/multiclass model using pretrained resnet34 weights, using data with 28 classes. I would now like to use the weights of this model, minus the head, to train a BINARY classifier using the same data but with only one of the labels. The new classifier uses the exact same input images and the model will need only small changes, all in and near the head.
Lesson 9 gave me the ability to drop a new custom head into the resnet34 pretrained model. But it involves a call:
ConvLearner.pretrained(f_model, md, custom_head=head_reg4)
which requires a standard argument (e.g. resnet34 function, which is in the meta table) in the first argument (I think), and not, for example, simply a path to my transfer-trained model.
So I do not know how to change the head on the model I have trained (it was saved in a prior run and I will read it in using, I guess, learner.load()).
One possible way is to:
- create a new model with the new custom head and original resnet34 weights
- read in the model that I trained and copy its weights into the new model
Step 1 is easy. What is the best way to accomplish step 2?
Am I thinking about this the right way?
Finally: is there documentation that would answer this question?