Easy VGG feature extraction module

If you ever wanted to do this:

r11, r31, r51 = vgg_net.forward(targets=['relu1_1', 'relu3_1', 'relu5_1'])

then this module is for you! :slight_smile:

This is something I made to scratch my own itch. I wanted to extract multiple features from (mostly VGG) models in a single forward pass, by addressing the layers in a nice (human readable and human memorable) way, without making a subclass for every combination of features I want to run.

After being unhappy with the solution I found here I sat down and made a module that is pretty much a replacement for torchvision.models.vgg. And now I finally published it as a PyPI module, instead of copying the files from one project to the next :stuck_out_tongue_closed_eyes:

You can find it on github:

or simply install it via pip:

pip install pytorch-vgg-named

I also added the normalized VGG weights provided by Leon Gatys. If you use these, pay attention to the note on normalization in the readme file.

If you need help, or have feedback, reach out to me here or on github, or twitter, or email, or or or… :stuck_out_tongue: