Unverified Commit 2214acbe authored by Hu Ye's avatar Hu Ye Committed by GitHub
Browse files

revamp FCOS doc (#5901)



* refactor doc

* refactor code

* add fcos.rst

* add fcos
Co-authored-by: default avatarNicolas Hug <contact@nicolas-hug.com>
parent 557c5daa
FCOS
=========
.. currentmodule:: torchvision.models.detection
The RetinaNet model is based on the `FCOS: Fully Convolutional One-Stage Object Detection
<https://arxiv.org/abs/1904.01355>`__ 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
<https://github.com/pytorch/vision/blob/main/torchvision/models/detection/fcos.py>`_ for
more details about this class.
.. autosummary::
:toctree: generated/
:template: function.rst
fcos_resnet50_fpn
...@@ -93,8 +93,9 @@ weights: ...@@ -93,8 +93,9 @@ weights:
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
models/retinanet models/fcos
models/mask_rcnn models/mask_rcnn
models/retinanet
Table of all available detection weights Table of all available detection weights
---------------------------------------- ----------------------------------------
......
...@@ -679,7 +679,7 @@ def fcos_resnet50_fpn( ...@@ -679,7 +679,7 @@ def fcos_resnet50_fpn(
""" """
Constructs a FCOS model with a ResNet-50-FPN backbone. Constructs a FCOS model with a ResNet-50-FPN backbone.
Reference: `"FCOS: Fully Convolutional One-Stage Object Detection" <https://arxiv.org/abs/1904.01355>`_. Reference: `FCOS: Fully Convolutional One-Stage Object Detection <https://arxiv.org/abs/1904.01355>`_.
The input to the model is expected to be a list of tensors, each of shape ``[C, H, W]``, one for each 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. image, and should be in ``0-1`` range. Different images can have different sizes.
...@@ -715,13 +715,25 @@ def fcos_resnet50_fpn( ...@@ -715,13 +715,25 @@ def fcos_resnet50_fpn(
>>> predictions = model(x) >>> predictions = model(x)
Args: 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 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) 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 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 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 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
<https://github.com/pytorch/vision/blob/main/torchvision/models/detection/fcos.py>`_
for more details about this class.
.. autoclass:: torchvision.models.detection.FCOS_ResNet50_FPN_Weights
:members:
""" """
weights = FCOS_ResNet50_FPN_Weights.verify(weights) weights = FCOS_ResNet50_FPN_Weights.verify(weights)
weights_backbone = ResNet50_Weights.verify(weights_backbone) weights_backbone = ResNet50_Weights.verify(weights_backbone)
......
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