"git@developer.sourcefind.cn:OpenDAS/fairscale.git" did not exist on "937b8b9b8c32443f2b9b3da87b549400b8452fbb"
Unverified Commit b6f73304 authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

SSDlite documentation fixes (#3855)

* Remove incorrect params from doc and add references to the paper.

* Add paper links in doc.
parent 33db2b3e
...@@ -23,6 +23,7 @@ model_urls = { ...@@ -23,6 +23,7 @@ model_urls = {
} }
# Building blocks of SSDlite as described in section 6.2 of MobileNetV2 paper
def _prediction_block(in_channels: int, out_channels: int, kernel_size: int, def _prediction_block(in_channels: int, out_channels: int, kernel_size: int,
norm_layer: Callable[..., nn.Module]) -> nn.Sequential: norm_layer: Callable[..., nn.Module]) -> nn.Sequential:
return nn.Sequential( return nn.Sequential(
...@@ -101,6 +102,7 @@ class SSDLiteFeatureExtractorMobileNet(nn.Module): ...@@ -101,6 +102,7 @@ class SSDLiteFeatureExtractorMobileNet(nn.Module):
assert not backbone[c4_pos].use_res_connect assert not backbone[c4_pos].use_res_connect
self.features = nn.Sequential( self.features = nn.Sequential(
# As described in section 6.3 of MobileNetV3 paper
nn.Sequential(*backbone[:c4_pos], backbone[c4_pos].block[0]), # from start until C4 expansion layer nn.Sequential(*backbone[:c4_pos], backbone[c4_pos].block[0]), # from start until C4 expansion layer
nn.Sequential(backbone[c4_pos].block[1:], *backbone[c4_pos + 1:]), # from C4 depthwise until end nn.Sequential(backbone[c4_pos].block[1:], *backbone[c4_pos + 1:]), # from C4 depthwise until end
) )
...@@ -158,7 +160,11 @@ def ssdlite320_mobilenet_v3_large(pretrained: bool = False, progress: bool = Tru ...@@ -158,7 +160,11 @@ def ssdlite320_mobilenet_v3_large(pretrained: bool = False, progress: bool = Tru
pretrained_backbone: bool = False, trainable_backbone_layers: Optional[int] = None, pretrained_backbone: bool = False, trainable_backbone_layers: Optional[int] = None,
norm_layer: Optional[Callable[..., nn.Module]] = None, norm_layer: Optional[Callable[..., nn.Module]] = None,
**kwargs: Any): **kwargs: Any):
"""Constructs an SSDlite model with input size 320x320 and a MobileNetV3 Large backbone. """Constructs an SSDlite model with input size 320x320 and a MobileNetV3 Large backbone, as described at
`"Searching for MobileNetV3"
<https://arxiv.org/abs/1905.02244>`_ and
`"MobileNetV2: Inverted Residuals and Linear Bottlenecks"
<https://arxiv.org/abs/1801.04381>`_.
See :func:`~torchvision.models.detection.ssd300_vgg16` for more details. See :func:`~torchvision.models.detection.ssd300_vgg16` for more details.
...@@ -170,8 +176,6 @@ def ssdlite320_mobilenet_v3_large(pretrained: bool = False, progress: bool = Tru ...@@ -170,8 +176,6 @@ def ssdlite320_mobilenet_v3_large(pretrained: bool = False, progress: bool = Tru
>>> predictions = model(x) >>> predictions = model(x)
Args: Args:
norm_layer:
**kwargs:
pretrained (bool): If True, returns a model pre-trained on COCO train2017 pretrained (bool): If True, returns a model pre-trained on COCO train2017
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
num_classes (int): number of output classes of the model (including the background) num_classes (int): number of output classes of the model (including the background)
...@@ -189,7 +193,7 @@ def ssdlite320_mobilenet_v3_large(pretrained: bool = False, progress: bool = Tru ...@@ -189,7 +193,7 @@ def ssdlite320_mobilenet_v3_large(pretrained: bool = False, progress: bool = Tru
if pretrained: if pretrained:
pretrained_backbone = False pretrained_backbone = False
# Enable reduced tail if no pretrained backbone is selected # Enable reduced tail if no pretrained backbone is selected. See Table 6 of MobileNetV3 paper.
reduce_tail = not pretrained_backbone reduce_tail = not pretrained_backbone
if norm_layer is None: if norm_layer is None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment