logy:

thanks a lot for replying but will the results with both methods be the same ?


I’m not sure which both models you mean, so could you explain it a bit more, please?



 logy:

and if I want the features for the images from this model but without a classification layer … should I remove or ignore the last two layers (head and avgpool)


As previously said, you could replace these layers with nn.Identity or use a forward hook to “skip” them (i.e. get the activation before it’s passed to these two layers). Alternatively, you could of course also write a custom model and remove these layers.