diff --git a/docs/source/models/densenet.rst b/docs/source/models/densenet.rst new file mode 100644 index 00000000000..ee984886925 --- /dev/null +++ b/docs/source/models/densenet.rst @@ -0,0 +1,27 @@ +DenseNet +======== + +.. currentmodule:: torchvision.models + +The DenseNet model is based on the `Densely Connected Convolutional Networks +`_ 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 +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + densenet121 + densenet161 + densenet169 + densenet201 diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index 77756b634b2..d3132639be5 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -37,6 +37,7 @@ weights: :maxdepth: 1 models/convnext + models/densenet models/efficientnet models/efficientnetv2 models/regnet diff --git a/torchvision/models/densenet.py b/torchvision/models/densenet.py index 405af0cbfde..12a0e645545 100644 --- a/torchvision/models/densenet.py +++ b/torchvision/models/densenet.py @@ -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" `_. + `Densely Connected Convolutional Networks `_. 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" `_. + 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 + `_ + for more details about this class. + + .. autoclass:: torchvision.models.DenseNet121_Weights + :members: """ weights = DenseNet121_Weights.verify(weights) @@ -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" `_. + `Densely Connected Convolutional Networks `_. 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" `_. + 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 + `_ + for more details about this class. + + .. autoclass:: torchvision.models.DenseNet161_Weights + :members: """ weights = DenseNet161_Weights.verify(weights) @@ -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" `_. + `Densely Connected Convolutional Networks `_. 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" `_. + 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 + `_ + for more details about this class. + + .. autoclass:: torchvision.models.DenseNet169_Weights + :members: """ weights = DenseNet169_Weights.verify(weights) @@ -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" `_. + `Densely Connected Convolutional Networks `_. 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" `_. + 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 + `_ + for more details about this class. + + .. autoclass:: torchvision.models.DenseNet201_Weights + :members: """ weights = DenseNet201_Weights.verify(weights)