Skip to content

Commit f28d93b

Browse files
fmassakazhang
andauthored
Expand usage logging to detection models (#4736)
* Expand usage logging to detection models Summary: Track all detection model instantiation. Reviewed By: sallysyw Differential Revision: D31741603 fbshipit-source-id: 89467db5d89ea41c5a9ab95d1846264d0a1f4199 * Fix lint Co-authored-by: Kai Zhang <[email protected]>
1 parent 5c57f5e commit f28d93b

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

torchvision/models/detection/generalized_rcnn.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import torch
1010
from torch import nn, Tensor
1111

12+
from ...utils import _log_api_usage_once
13+
1214

1315
class GeneralizedRCNN(nn.Module):
1416
"""
@@ -25,6 +27,7 @@ class GeneralizedRCNN(nn.Module):
2527

2628
def __init__(self, backbone, rpn, roi_heads, transform):
2729
super(GeneralizedRCNN, self).__init__()
30+
_log_api_usage_once(self)
2831
self.transform = transform
2932
self.backbone = backbone
3033
self.rpn = rpn

torchvision/models/detection/retinanet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ...ops import boxes as box_ops
1212
from ...ops import misc as misc_nn_ops
1313
from ...ops.feature_pyramid_network import LastLevelP6P7
14+
from ...utils import _log_api_usage_once
1415
from ..resnet import resnet50
1516
from . import _utils as det_utils
1617
from ._utils import overwrite_eps
@@ -336,6 +337,7 @@ def __init__(
336337
topk_candidates=1000,
337338
):
338339
super().__init__()
340+
_log_api_usage_once(self)
339341

340342
if not hasattr(backbone, "out_channels"):
341343
raise ValueError(

torchvision/models/detection/ssd.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from ..._internally_replaced_utils import load_state_dict_from_url
1010
from ...ops import boxes as box_ops
11+
from ...utils import _log_api_usage_once
1112
from .. import vgg
1213
from . import _utils as det_utils
1314
from .anchor_utils import DefaultBoxGenerator
@@ -181,6 +182,7 @@ def __init__(
181182
positive_fraction: float = 0.25,
182183
):
183184
super().__init__()
185+
_log_api_usage_once(self)
184186

185187
self.backbone = backbone
186188

torchvision/models/detection/ssdlite.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from ..._internally_replaced_utils import load_state_dict_from_url
1010
from ...ops.misc import ConvNormActivation
11+
from ...utils import _log_api_usage_once
1112
from .. import mobilenet
1213
from . import _utils as det_utils
1314
from .anchor_utils import DefaultBoxGenerator
@@ -119,6 +120,7 @@ def __init__(
119120
min_depth: int = 16,
120121
):
121122
super().__init__()
123+
_log_api_usage_once(self)
122124

123125
assert not backbone[c4_pos].use_res_connect
124126
self.features = nn.Sequential(

0 commit comments

Comments
 (0)