How should I extract feature from resnet 50 Pytorch pre-trained model for Deep Learning Coloring?

We usually extract the feature just the relu layer before the pooling layer in vgg19, but which layer I should pick for extracting the feature from Resnet 50? Maybe if you can give me some suggestions on how I should do it in code and picking layer in Resnet50? I am a newbie who is still keeping Deep learning in Pytorch in 2 months.
Pytorch VGG19 allows to access with index for extracting the feature layer, but Resnet does not. I can try using for loop, but I am not sure it will work or not.

Here is the project that I want to extract the feature to redraw, but it is not working great that I just use 3 layers out of 5 relu layers in vgg19. I am planning to train it again in Resnet50 on Colab.

You can print the layers of your resnet using print(model).
The output shows you how the submodules are defined.
Since these blocks are not defined by a main nn.Sequential container, you would have to use the attribute names to index specific layers, e.g.:


This line would index the block layer4 (which is an nn.Sequential container), the second Bottleneck and the conv3 layer inside it.
Let me know, if this would work for you.