Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions torchvision/models/detection/generalized_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import torch
from torch import nn, Tensor

from ...utils import _log_api_usage_once
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related failure: ImportError: cannot import name '_log_api_usage_once'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is because this feature was added in #4735. I'll rebase this PR on top of master once I merge #4735



class GeneralizedRCNN(nn.Module):
"""
Expand All @@ -25,6 +27,7 @@ class GeneralizedRCNN(nn.Module):

def __init__(self, backbone, rpn, roi_heads, transform):
super(GeneralizedRCNN, self).__init__()
_log_api_usage_once(self)
self.transform = transform
self.backbone = backbone
self.rpn = rpn
Expand Down
2 changes: 2 additions & 0 deletions torchvision/models/detection/retinanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ...ops import misc as misc_nn_ops
from ...ops.feature_pyramid_network import LastLevelP6P7
from ..resnet import resnet50
from ...utils import _log_api_usage_once
from . import _utils as det_utils
from ._utils import overwrite_eps
from .anchor_utils import AnchorGenerator
Expand Down Expand Up @@ -336,6 +337,7 @@ def __init__(
topk_candidates=1000,
):
super().__init__()
_log_api_usage_once(self)

if not hasattr(backbone, "out_channels"):
raise ValueError(
Expand Down
2 changes: 2 additions & 0 deletions torchvision/models/detection/ssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from ..._internally_replaced_utils import load_state_dict_from_url
from ...ops import boxes as box_ops
from ...utils import _log_api_usage_once
from .. import vgg
from . import _utils as det_utils
from .anchor_utils import DefaultBoxGenerator
Expand Down Expand Up @@ -181,6 +182,7 @@ def __init__(
positive_fraction: float = 0.25,
):
super().__init__()
_log_api_usage_once(self)

self.backbone = backbone

Expand Down
2 changes: 2 additions & 0 deletions torchvision/models/detection/ssdlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from ..._internally_replaced_utils import load_state_dict_from_url
from ...ops.misc import ConvNormActivation
from ...utils import _log_api_usage_once
from .. import mobilenet
from . import _utils as det_utils
from .anchor_utils import DefaultBoxGenerator
Expand Down Expand Up @@ -119,6 +120,7 @@ def __init__(
min_depth: int = 16,
):
super().__init__()
_log_api_usage_once(self)

assert not backbone[c4_pos].use_res_connect
self.features = nn.Sequential(
Expand Down