Skip to content

Added docs for DenseNet #5878

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 3 commits into from
Apr 26, 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
27 changes: 27 additions & 0 deletions docs/source/models/densenet.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
DenseNet
========

.. currentmodule:: torchvision.models

The DenseNet model is based on the `Densely Connected Convolutional Networks
<https://arxiv.org/abs/1608.06993>`_ paper.


Model builders
--------------

The following model builders can be used to instantiate a DenseNet model, with or
without pre-trained weights. All the model builders internally rely on the
``torchvision.models.densenet.DenseNet`` base class. Please refer to the `source
code
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_ for
more details about this class.

.. autosummary::
:toctree: generated/
:template: function.rst

densenet121
densenet161
densenet169
densenet201
1 change: 1 addition & 0 deletions docs/source/models_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ weights:
:maxdepth: 1

models/convnext
models/densenet
models/efficientnet
models/efficientnetv2
models/regnet
Expand Down
76 changes: 56 additions & 20 deletions torchvision/models/densenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,23 @@ class DenseNet201_Weights(WeightsEnum):
@handle_legacy_interface(weights=("pretrained", DenseNet121_Weights.IMAGENET1K_V1))
def densenet121(*, weights: Optional[DenseNet121_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet:
r"""Densenet-121 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_.
`Densely Connected Convolutional Networks <https://arxiv.org/abs/1608.06993>`_.
The required minimum input size of the model is 29x29.

Args:
weights (DenseNet121_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: *False*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
weights (:class:`~torchvision.models.DenseNet121_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.DenseNet121_Weights` below for
more details, and possible values. By default, no pre-trained
weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to the ``torchvision.models.densenet.DenseNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_
for more details about this class.

.. autoclass:: torchvision.models.DenseNet121_Weights
:members:
"""
weights = DenseNet121_Weights.verify(weights)

Expand All @@ -356,14 +365,23 @@ def densenet121(*, weights: Optional[DenseNet121_Weights] = None, progress: bool
@handle_legacy_interface(weights=("pretrained", DenseNet161_Weights.IMAGENET1K_V1))
def densenet161(*, weights: Optional[DenseNet161_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet:
r"""Densenet-161 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_.
`Densely Connected Convolutional Networks <https://arxiv.org/abs/1608.06993>`_.
The required minimum input size of the model is 29x29.

Args:
weights (DenseNet161_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: *False*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
weights (:class:`~torchvision.models.DenseNet161_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.DenseNet161_Weights` below for
more details, and possible values. By default, no pre-trained
weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to the ``torchvision.models.densenet.DenseNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_
for more details about this class.

.. autoclass:: torchvision.models.DenseNet161_Weights
:members:
"""
weights = DenseNet161_Weights.verify(weights)

Expand All @@ -373,14 +391,23 @@ def densenet161(*, weights: Optional[DenseNet161_Weights] = None, progress: bool
@handle_legacy_interface(weights=("pretrained", DenseNet169_Weights.IMAGENET1K_V1))
def densenet169(*, weights: Optional[DenseNet169_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet:
r"""Densenet-169 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_.
`Densely Connected Convolutional Networks <https://arxiv.org/abs/1608.06993>`_.
The required minimum input size of the model is 29x29.

Args:
weights (DenseNet169_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: *False*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
weights (:class:`~torchvision.models.DenseNet169_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.DenseNet169_Weights` below for
more details, and possible values. By default, no pre-trained
weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to the ``torchvision.models.densenet.DenseNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_
for more details about this class.

.. autoclass:: torchvision.models.DenseNet169_Weights
:members:
"""
weights = DenseNet169_Weights.verify(weights)

Expand All @@ -390,14 +417,23 @@ def densenet169(*, weights: Optional[DenseNet169_Weights] = None, progress: bool
@handle_legacy_interface(weights=("pretrained", DenseNet201_Weights.IMAGENET1K_V1))
def densenet201(*, weights: Optional[DenseNet201_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet:
r"""Densenet-201 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_.
`Densely Connected Convolutional Networks <https://arxiv.org/abs/1608.06993>`_.
The required minimum input size of the model is 29x29.

Args:
weights (DenseNet201_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: *False*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
weights (:class:`~torchvision.models.DenseNet201_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.DenseNet201_Weights` below for
more details, and possible values. By default, no pre-trained
weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to the ``torchvision.models.densenet.DenseNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_
for more details about this class.

.. autoclass:: torchvision.models.DenseNet201_Weights
:members:
"""
weights = DenseNet201_Weights.verify(weights)

Expand Down