-
Notifications
You must be signed in to change notification settings - Fork 26.2k
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
Backbone add out indices #22493
Backbone add out indices #22493
Conversation
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind having both available. Thanks for implementing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I agree that it'd be good to have both out_features and out_indices
* Add out_indices to backbones, deprecate out_features * Update - can specify both out_features and out_indices but not both * Can specify both * Fix copies * Add out_indices to convnextv2 configuration
* Add out_indices to backbones, deprecate out_features * Update - can specify both out_features and out_indices but not both * Can specify both * Fix copies * Add out_indices to convnextv2 configuration
What does this PR do?
Add out_indices as a way to specify which feature maps are returned in the backbone.
This isn't strictly necessary for cross loading timm backbones and is an optional design choice.
Reasoning:
AutoBackbone
. For the same model e.g.microsoft/resnet-50
andresnet50
, the stage names are different, whereas the layer index is the same.out_indices=(1,)
means the same for both model. whereas selecting features requires knowing one useslayer1
and the other usesstage1
.out_features
requires knowing the names of the layers in order select which layers you want and is more prone to errors with typosout_indices
is the param used in timm. Once advantage ofout_indices
is that you can do negative indexing easily. For example, to get the last two feature maps, you need only passout_indices=(-2, -1)
.Outstanding question on whether both
out_features
andout_indices
should exist at the same time.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.