From 3265ad2e9666e6cddeb94d523456e570ff4d55ca Mon Sep 17 00:00:00 2001 From: Hu Ye Date: Wed, 27 Apr 2022 20:53:33 +0800 Subject: [PATCH 1/4] refactor doc --- torchvision/models/detection/fcos.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/torchvision/models/detection/fcos.py b/torchvision/models/detection/fcos.py index 628a343e5a3..6504153df9a 100644 --- a/torchvision/models/detection/fcos.py +++ b/torchvision/models/detection/fcos.py @@ -715,13 +715,25 @@ def fcos_resnet50_fpn( >>> predictions = model(x) Args: - weights (FCOS_ResNet50_FPN_Weights, optional): The pretrained weights for the model + weights (:class:`~torchvision.models.detection.FCOS_ResNet50_FPN_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.detection.FCOS_ResNet50_FPN_Weights` + below for more details, and possible values. By default, no + pre-trained weights are used. progress (bool): If True, displays a progress bar of the download to stderr num_classes (int, optional): number of output classes of the model (including the background) - weights_backbone (ResNet50_Weights, optional): The pretrained weights for the backbone + weights_backbone (:class:`~torchvision.models.ResNet50_Weights`, optional): The pretrained weights for + the backbone. trainable_backbone_layers (int, optional): number of trainable (not frozen) resnet layers starting from final block. Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable. If ``None`` is passed (the default) this value is set to 3. Default: None + **kwargs: parameters passed to the ``torchvision.models.detection.FCOS`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.detection.FCOS_ResNet50_FPN_Weights + :members: """ weights = FCOS_ResNet50_FPN_Weights.verify(weights) weights_backbone = ResNet50_Weights.verify(weights_backbone) From af2f0609203eb9cd5e666ebfc4e43b8b7b3c74d8 Mon Sep 17 00:00:00 2001 From: Hu Ye Date: Wed, 27 Apr 2022 20:56:44 +0800 Subject: [PATCH 2/4] refactor code --- torchvision/models/detection/fcos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/detection/fcos.py b/torchvision/models/detection/fcos.py index 6504153df9a..54094d2fa22 100644 --- a/torchvision/models/detection/fcos.py +++ b/torchvision/models/detection/fcos.py @@ -679,7 +679,7 @@ def fcos_resnet50_fpn( """ Constructs a FCOS model with a ResNet-50-FPN backbone. - Reference: `"FCOS: Fully Convolutional One-Stage Object Detection" `_. + Reference: `FCOS: Fully Convolutional One-Stage Object Detection `_. The input to the model is expected to be a list of tensors, each of shape ``[C, H, W]``, one for each image, and should be in ``0-1`` range. Different images can have different sizes. From 4264ef0f3eaeac1e08fcca041047ba3399f1ca0a Mon Sep 17 00:00:00 2001 From: Hu Ye Date: Wed, 27 Apr 2022 20:59:48 +0800 Subject: [PATCH 3/4] add fcos.rst --- docs/source/models/fcos.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/source/models/fcos.rst diff --git a/docs/source/models/fcos.rst b/docs/source/models/fcos.rst new file mode 100644 index 00000000000..4096cc30f68 --- /dev/null +++ b/docs/source/models/fcos.rst @@ -0,0 +1,22 @@ +FCOS +========= + +.. currentmodule:: torchvision.models.detection + +The RetinaNet model is based on the `FCOS: Fully Convolutional One-Stage Object Detection +`__ paper. + +Model builders +-------------- + +The following model builders can be used to instantiate a FCOS model, with or +without pre-trained weights. All the model buidlers internally rely on the +``torchvision.models.detection.fcos.FCOS`` base class. Please refer to the `source code +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + fcos_resnet50_fpn From d86682b9bcb20671a1ef2fe36f6fd3d7eefccfec Mon Sep 17 00:00:00 2001 From: Hu Ye Date: Wed, 27 Apr 2022 21:01:20 +0800 Subject: [PATCH 4/4] add fcos --- docs/source/models_new.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index 41a7b3d482f..f7776de909d 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -94,6 +94,7 @@ weights: :maxdepth: 1 models/retinanet + models/fcos Table of all available detection weights ----------------------------------------