Extracting last layer features (resnet34)

Can someone please tell me which lecture discusses about how to extract the last layer features from resnet34? By last layer, I mean the layer before the fully connected layer.

For example,

learn = ConvLearner.pretrained(arch, data, precompute=True )

learn.load('my_model')

Now, how do I get the last layer features for a given image using my_model?

Have a look at the lesson7-CAM notebook. The function register_forward_hook might help you achieve what you need, IMO.

1 Like