Skip to content
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

delete flowvision.models._util #110

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flowvision/models/detection/backbone_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
)

from flowvision.layers.blocks import misc as misc_nn_ops
from .._utils import IntermediateLayerGetter
from ..layer_getter import IntermediateLayerGetter
from .. import resnet
from .. import mobilenet


class BackboneWithFPN(nn.Module):
"""
Adds a FPN on top of a model.
Internally, it uses flowvision.models._utils.IntermediateLayerGetter to
Internally, it uses flowvision.models.layer_getter.IntermediateLayerGetter to
extract a submodel that returns the feature maps specified in return_layers.
The same limitations of IntermediateLayerGetter apply here.
Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
class IntermediateLayerGetter(nn.ModuleDict):
"""
Module wrapper that returns intermediate layers from a model

It has a strong assumption that the modules have been registered
into the model in the same order as they are used.
This means that one should **not** reuse the same nn.Module
twice in the forward if you want this to work.

Additionally, it is only able to query submodules that are directly
assigned to the model. So if `model` is passed, `model.feature1` can
be returned, but not `model.feature1.layer2`.

Args:
model (nn.Module): model on which we will extract the features
return_layers (Dict[name, new_name]): a dict containing the names
Expand Down