pytorch / pytorch/vision

[BLOCKED] Replace IntermediateLayerGetter with feature_extraction.create_feature_extractor()

Open
#4,540 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement module: models needs discussion
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🚀 The feature

A new feature extraction utility based on FX was introduced by #4302. It allows us to extract internal outputs of a module in a simpler way and it should be a drop-in replacement of the old IntermediateLayerGetter class.

Unfortunately the create_feature_extractor() util is not currently used anywhere on vision. We should investigate using it to replace some of the old approaches. Here is a list of candidates:

  • Replace IntermediateLayerGetter calls in Segmentation models [1, 2]
  • Replace IntermediateLayerGetter calls in Detection models [3]
  • Rewrite model surgery from the SSDFeatureExtractorVGG [4] and SSDLiteFeatureExtractorMobileNet modules [5].

Extra care needs to be given to ensure that the old weights of pre-trained models can still load and the validation statistics remain the same.

Motivation, pitch

Using the latest FX-based utility will help us future proof our code-base.

cc @datumbox

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the create_feature_extractor utility and the listed IntermediateLayerGetter uses in segmentation.py and detection/backbone_utils.py. Then inspect SSDFeatureExtractorVGG in ssd.py and SSDLiteFeatureExtractorMobileNet in ssdlite.py. Done means the candidates use the FX-based utility while old pretrained weights still load and validation statistics remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.