Skip to content

Commit 4609c36

Browse files
committed
Remove fasterrcnn_mobilenet_v3_large prototype.
1 parent 24ecd45 commit 4609c36

File tree

4 files changed

+3
-50
lines changed

4 files changed

+3
-50
lines changed
Binary file not shown.

test/test_models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def get_available_video_models():
3737
'googlenet': lambda x: x.logits,
3838
'inception_v3': lambda x: x.logits,
3939
"fasterrcnn_resnet50_fpn": lambda x: x[1],
40-
"fasterrcnn_mobilenet_v3_large": lambda x: x[1],
4140
"fasterrcnn_mobilenet_v3_large_fpn": lambda x: x[1],
4241
"maskrcnn_resnet50_fpn": lambda x: x[1],
4342
"keypointrcnn_resnet50_fpn": lambda x: x[1],

test/test_models_detection_negative_samples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_assign_targets_to_proposals(self):
9797
self.assertEqual(labels[0].dtype, torch.int64)
9898

9999
def test_forward_negative_sample_frcnn(self):
100-
for name in ["fasterrcnn_resnet50_fpn", "fasterrcnn_mobilenet_v3_large", "fasterrcnn_mobilenet_v3_large_fpn"]:
100+
for name in ["fasterrcnn_resnet50_fpn", "fasterrcnn_mobilenet_v3_large_fpn"]:
101101
model = torchvision.models.detection.__dict__[name](
102102
num_classes=2, min_size=100, max_size=100)
103103

torchvision/models/detection/faster_rcnn.py

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
from collections import OrderedDict
2-
31
import torch
42
from torch import nn
53
import torch.nn.functional as F
64

7-
from torchvision.ops import misc as misc_nn_ops
85
from torchvision.ops import MultiScaleRoIAlign
96

107
from ._utils import overwrite_eps
@@ -19,7 +16,7 @@
1916

2017

2118
__all__ = [
22-
"FasterRCNN", "fasterrcnn_resnet50_fpn", "fasterrcnn_mobilenet_v3_large", "fasterrcnn_mobilenet_v3_large_fpn"
19+
"FasterRCNN", "fasterrcnn_resnet50_fpn", "fasterrcnn_mobilenet_v3_large_fpn"
2320
]
2421

2522

@@ -291,8 +288,7 @@ def forward(self, x):
291288
model_urls = {
292289
'fasterrcnn_resnet50_fpn_coco':
293290
'https://download.pytorch.org/models/fasterrcnn_resnet50_fpn_coco-258fb6c6.pth',
294-
'fasterrcnn_mobilenet_v3_large_coco': None,
295-
'fasterrcnn_mobilenet_v3_large_fpn_coco': None,
291+
'fasterrcnn_mobilenet_v3_large_fpn_coco': None, # TODO: Add the final model url
296292
}
297293

298294

@@ -371,48 +367,6 @@ def fasterrcnn_resnet50_fpn(pretrained=False, progress=True,
371367
return model
372368

373369

374-
def fasterrcnn_mobilenet_v3_large(pretrained=False, progress=True, num_classes=91, pretrained_backbone=True,
375-
trainable_backbone_layers=None, min_size=320, max_size=640, **kwargs):
376-
"""
377-
Constructs a Faster R-CNN model with a MobileNetV3-Large backbone. It works similarly
378-
to Faster R-CNN with ResNet-50 FPN backbone. See `fasterrcnn_resnet50_fpn` for more details.
379-
380-
Example::
381-
382-
>>> model = torchvision.models.detection.fasterrcnn_mobilenet_v3_large(pretrained=True)
383-
>>> model.eval()
384-
>>> x = [torch.rand(3, 300, 400), torch.rand(3, 500, 400)]
385-
>>> predictions = model(x)
386-
387-
Args:
388-
pretrained (bool): If True, returns a model pre-trained on COCO train2017
389-
progress (bool): If True, displays a progress bar of the download to stderr
390-
num_classes (int): number of output classes of the model (including the background)
391-
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
392-
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
393-
Valid values are between 0 and 6, with 6 meaning all backbone layers are trainable.
394-
min_size (int): minimum size of the image to be rescaled before feeding it to the backbone
395-
max_size (int): maximum size of the image to be rescaled before feeding it to the backbone
396-
"""
397-
trainable_backbone_layers = _validate_trainable_layers(
398-
pretrained or pretrained_backbone, trainable_backbone_layers, 6, 3)
399-
400-
if pretrained:
401-
pretrained_backbone = False
402-
backbone = mobilenet_backbone("mobilenet_v3_large", pretrained_backbone, False,
403-
trainable_layers=trainable_backbone_layers)
404-
405-
anchor_sizes = ((32, 64, 128, 256, 512, ), )
406-
aspect_ratios = ((0.5, 1.0, 2.0), )
407-
408-
model = FasterRCNN(backbone, num_classes, rpn_anchor_generator=AnchorGenerator(anchor_sizes, aspect_ratios),
409-
min_size=min_size, max_size=max_size, **kwargs)
410-
if pretrained:
411-
state_dict = load_state_dict_from_url(model_urls['fasterrcnn_mobilenet_v3_large_coco'], progress=progress)
412-
model.load_state_dict(state_dict)
413-
return model
414-
415-
416370
def fasterrcnn_mobilenet_v3_large_fpn(pretrained=False, progress=True, num_classes=91, pretrained_backbone=True,
417371
trainable_backbone_layers=None, min_size=320, max_size=640, rpn_score_thresh=0.05,
418372
**kwargs):

0 commit comments

Comments
 (0)