I’m trying to split a cnn_learner resnet 34 model, into the feature extraction part (until flatten()) and the rest, to use the output of that feature extraction part as input into another model.
But now, learn.get_preds() outputs the prediction of classes instead of the 1024 x 1 feature vector (output of flatten layer). And head isn’t even present in the learn.layer_groups
AFAIK, layer_groups is a fastai construction used to implement learning rates by layer group and perhaps to aid in splitting off the head of an existing model. Assigning a new value to it does not affect the model used by the Learner.
You’ll need to alter the model and assign the new model to learn.model. Or construct a new Learner from it.