diff --git a/docs/source/models/squeezenet.rst b/docs/source/models/squeezenet.rst new file mode 100644 index 00000000000..a3e8603e92d --- /dev/null +++ b/docs/source/models/squeezenet.rst @@ -0,0 +1,26 @@ +SqueezeNet +========== + +.. currentmodule:: torchvision.models + +The SqueezeNet model is based on the `SqueezeNet: AlexNet-level accuracy with +50x fewer parameters and <0.5MB model size `__ +paper. + + +Model builders +-------------- + +The following model builders can be used to instanciate a SqueezeNet model, with or +without pre-trained weights. All the model builders internally rely on the +``torchvision.models.squeezenet.SqueezeNet`` base class. Please refer to the `source +code +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + squeezenet1_0 + squeezenet1_1 diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index c644320d9cb..a8fdad8efb0 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -37,6 +37,7 @@ weights: :maxdepth: 1 models/resnet + models/squeezenet models/vgg diff --git a/torchvision/models/squeezenet.py b/torchvision/models/squeezenet.py index bde8b5efcfd..419fc892131 100644 --- a/torchvision/models/squeezenet.py +++ b/torchvision/models/squeezenet.py @@ -159,14 +159,27 @@ class SqueezeNet1_1_Weights(WeightsEnum): def squeezenet1_0( *, weights: Optional[SqueezeNet1_0_Weights] = None, progress: bool = True, **kwargs: Any ) -> SqueezeNet: - r"""SqueezeNet model architecture from the `"SqueezeNet: AlexNet-level - accuracy with 50x fewer parameters and <0.5MB model size" + """SqueezeNet model architecture from the `SqueezeNet: AlexNet-level + accuracy with 50x fewer parameters and <0.5MB model size `_ paper. + The required minimum input size of the model is 21x21. Args: - weights (SqueezeNet1_0_Weights, optional): The pretrained weights for the model - progress (bool): If True, displays a progress bar of the download to stderr + weights (:class:`~torchvision.models.SqueezeNet1_0_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.SqueezeNet1_0_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.squeezenet.SqueezeNet`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.SqueezeNet1_0_Weights + :members: """ weights = SqueezeNet1_0_Weights.verify(weights) return _squeezenet("1_0", weights, progress, **kwargs) @@ -176,15 +189,28 @@ def squeezenet1_0( def squeezenet1_1( *, weights: Optional[SqueezeNet1_1_Weights] = None, progress: bool = True, **kwargs: Any ) -> SqueezeNet: - r"""SqueezeNet 1.1 model from the `official SqueezeNet repo + """SqueezeNet 1.1 model from the `official SqueezeNet repo `_. + SqueezeNet 1.1 has 2.4x less computation and slightly fewer parameters than SqueezeNet 1.0, without sacrificing accuracy. The required minimum input size of the model is 17x17. Args: - weights (SqueezeNet1_1_Weights, optional): The pretrained weights for the model - progress (bool): If True, displays a progress bar of the download to stderr + weights (:class:`~torchvision.models.SqueezeNet1_1_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.SqueezeNet1_1_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.squeezenet.SqueezeNet`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.SqueezeNet1_1_Weights + :members: """ weights = SqueezeNet1_1_Weights.verify(weights) return _squeezenet("1_1", weights, progress, **kwargs)