Skip to content

refactor FCOS doc #5901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/source/models/fcos.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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
3 changes: 2 additions & 1 deletion docs/source/models_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ weights:
.. toctree::
:maxdepth: 1

models/retinanet
models/fcos
models/mask_rcnn
models/retinanet

Table of all available detection weights
----------------------------------------
Expand Down
18 changes: 15 additions & 3 deletions torchvision/models/detection/fcos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" <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
image, and should be in ``0-1`` range. Different images can have different sizes.
Expand Down Expand Up @@ -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
<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_backbone = ResNet50_Weights.verify(weights_backbone)
Expand Down