-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[BLOCKED] Replace IntermediateLayerGetter with feature_extraction.create_feature_extractor() #4540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@datumbox looks like it is one-line change. I can do that for segm models. As FX is beta etc, do you think we should keep an option to use |
Thanks @vfdev-5, it might require a bit more work for the 3rd bullet point but overall it should be straightforward. It's not a high priority task and potentially a good intro task for someone who onboards on the code-base. :) Concerning the FX status, this is a valid concern. I'm in discussions with the FX team to assess better. My current understanding is that the API is not expected to change dramatically and because the use of the |
OK, I'll send only a PR for segmentation models and leave the rest for others :) My concern on BC was from pytorch side and torch fx functionality (being still in beta), I was imagining if something breaks in their API etc, torchvision models can be directly impacted without a way to go back and use |
I see. Given the |
@datumbox can I work on this issue? |
@kingjuno There are a few limitations of using the FX-based approach (losing class info) which means replacing the SSD ones might not work. I'm currently OOO, but I can look into if this still makes sense once I'm back. |
ok |
@kingjuno you can draft a PR for 2nd task ("Replace IntermediateLayerGetter calls in Detection models [3]") and I can review and help with meanwhile. |
Backbones that have been passed through FX won't have class information in the submodules (see pytorch/pytorch#66335). As a result we might no longer be able to do @vfdev-5 I know that you previously replaced segmentation but back then this limitation was not known and it's not clear if we are affected. I was hoping to take more time prior the next release to check carefully that we didn't mess up anything before rolling out the change to more places. But if you feel you have the capacity to thoroughly check that none of the models for segmentation or detection are affected, feel free to do it now. |
@vfdev-5 Should I proceed with this issue? |
Uh oh!
There was an error while loading. Please reload this page.
🚀 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:IntermediateLayerGetter
calls in Segmentation models [1, 2]IntermediateLayerGetter
calls in Detection models [3]SSDFeatureExtractorVGG
[4] andSSDLiteFeatureExtractorMobileNet
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
The text was updated successfully, but these errors were encountered: