Skip to content

Efficientnetv2 #5864

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 25, 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
26 changes: 26 additions & 0 deletions docs/source/models/efficientnetv2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
EfficientNetV2
============

.. currentmodule:: torchvision.models

The EfficientNetV2 model is based on the `EfficientNetV2: Smaller Models and Faster Training <https://arxiv.org/abs/2104.00298>`__
paper.


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

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

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

efficientnet_v2_s
efficientnet_v2_m
efficientnet_v2_l
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/efficientnet
models/efficientnetv2
models/regnet
models/resnet
models/squeezenet
Expand Down
51 changes: 42 additions & 9 deletions torchvision/models/efficientnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,11 +925,22 @@ def efficientnet_v2_s(
) -> EfficientNet:
"""
Constructs an EfficientNetV2-S architecture from
`"EfficientNetV2: Smaller Models and Faster Training" <https://arxiv.org/abs/2104.00298>`_.
`EfficientNetV2: Smaller Models and Faster Training <https://arxiv.org/abs/2104.00298>`_.

Args:
weights (EfficientNet_V2_S_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.EfficientNet_V2_S_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.EfficientNet_V2_S_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.efficientnet.EfficientNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
for more details about this class.
.. autoclass:: torchvision.models.EfficientNet_V2_S_Weights
:members:
"""
weights = EfficientNet_V2_S_Weights.verify(weights)

Expand All @@ -951,11 +962,22 @@ def efficientnet_v2_m(
) -> EfficientNet:
"""
Constructs an EfficientNetV2-M architecture from
`"EfficientNetV2: Smaller Models and Faster Training" <https://arxiv.org/abs/2104.00298>`_.
`EfficientNetV2: Smaller Models and Faster Training <https://arxiv.org/abs/2104.00298>`_.

Args:
weights (EfficientNet_V2_M_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.EfficientNet_V2_M_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.EfficientNet_V2_M_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.efficientnet.EfficientNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
for more details about this class.
.. autoclass:: torchvision.models.EfficientNet_V2_M_Weights
:members:
"""
weights = EfficientNet_V2_M_Weights.verify(weights)

Expand All @@ -977,11 +999,22 @@ def efficientnet_v2_l(
) -> EfficientNet:
"""
Constructs an EfficientNetV2-L architecture from
`"EfficientNetV2: Smaller Models and Faster Training" <https://arxiv.org/abs/2104.00298>`_.
`EfficientNetV2: Smaller Models and Faster Training <https://arxiv.org/abs/2104.00298>`_.

Args:
weights (EfficientNet_V2_L_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.EfficientNet_V2_L_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.EfficientNet_V2_L_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.efficientnet.EfficientNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
for more details about this class.
.. autoclass:: torchvision.models.EfficientNet_V2_L_Weights
:members:
"""
weights = EfficientNet_V2_L_Weights.verify(weights)

Expand Down