Skip to content

Commit dc92dc0

Browse files
YosuaMichaelNicolasHug
authored andcommitted
[fbsync] EfficientNet New Documentation (#5854)
Summary: * [DOC] Add new EfficientNet doc. * [DOC] Add missing file. * [FIX] Precommits fix. * [FIX] Precommits fix. * [ENH] Integrate few documentation comments from code review * Update docs/source/models/efficientnet.rst Reviewed By: jdsgomes, NicolasHug Differential Revision: D36095667 fbshipit-source-id: 5f14099067480da795edb7418d7a4e2232e8c300 Co-authored-by: Nicolas Hug <[email protected]>
1 parent 0f826a1 commit dc92dc0

File tree

3 files changed

+152
-40
lines changed

3 files changed

+152
-40
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
EfficientNet
2+
============
3+
4+
.. currentmodule:: torchvision.models
5+
6+
The EfficientNet model is based on the `EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks <https://arxiv.org/abs/1905.11946>`__
7+
paper.
8+
9+
10+
Model builders
11+
--------------
12+
13+
The following model builders can be used to instanciate an EfficientNet model, with or
14+
without pre-trained weights. All the model builders internally rely on the
15+
``torchvision.models.efficientnet.EfficientNet`` base class. Please refer to the `source
16+
code
17+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_ for
18+
more details about this class.
19+
20+
.. autosummary::
21+
:toctree: generated/
22+
:template: function.rst
23+
24+
efficientnet_b0
25+
efficientnet_b1
26+
efficientnet_b2
27+
efficientnet_b3
28+
efficientnet_b4
29+
efficientnet_b5
30+
efficientnet_b6
31+
efficientnet_b7

docs/source/models_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ weights:
3636
.. toctree::
3737
:maxdepth: 1
3838

39+
models/efficientnet
3940
models/regnet
4041
models/resnet
4142
models/squeezenet

torchvision/models/efficientnet.py

Lines changed: 120 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -675,13 +675,23 @@ class EfficientNet_V2_L_Weights(WeightsEnum):
675675
def efficientnet_b0(
676676
*, weights: Optional[EfficientNet_B0_Weights] = None, progress: bool = True, **kwargs: Any
677677
) -> EfficientNet:
678-
"""
679-
Constructs a EfficientNet B0 architecture from
680-
`"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks" <https://arxiv.org/abs/1905.11946>`_.
678+
"""EfficientNet B0 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
679+
Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.
681680
682681
Args:
683-
weights (EfficientNet_B0_Weights, optional): The pretrained weights for the model
684-
progress (bool): If True, displays a progress bar of the download to stderr
682+
weights (:class:`~torchvision.models.EfficientNet_B0_Weights`, optional): The
683+
pretrained weights to use. See
684+
:class:`~torchvision.models.EfficientNet_B0_Weights` below for
685+
more details, and possible values. By default, no pre-trained
686+
weights are used.
687+
progress (bool, optional): If True, displays a progress bar of the
688+
download to stderr. Default is True.
689+
**kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
690+
base class. Please refer to the `source code
691+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
692+
for more details about this class.
693+
.. autoclass:: torchvision.models.EfficientNet_B0_Weights
694+
:members:
685695
"""
686696
weights = EfficientNet_B0_Weights.verify(weights)
687697

@@ -693,13 +703,23 @@ def efficientnet_b0(
693703
def efficientnet_b1(
694704
*, weights: Optional[EfficientNet_B1_Weights] = None, progress: bool = True, **kwargs: Any
695705
) -> EfficientNet:
696-
"""
697-
Constructs a EfficientNet B1 architecture from
698-
`"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks" <https://arxiv.org/abs/1905.11946>`_.
706+
"""EfficientNet B1 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
707+
Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.
699708
700709
Args:
701-
weights (EfficientNet_B1_Weights, optional): The pretrained weights for the model
702-
progress (bool): If True, displays a progress bar of the download to stderr
710+
weights (:class:`~torchvision.models.EfficientNet_B1_Weights`, optional): The
711+
pretrained weights to use. See
712+
:class:`~torchvision.models.EfficientNet_B1_Weights` below for
713+
more details, and possible values. By default, no pre-trained
714+
weights are used.
715+
progress (bool, optional): If True, displays a progress bar of the
716+
download to stderr. Default is True.
717+
**kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
718+
base class. Please refer to the `source code
719+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
720+
for more details about this class.
721+
.. autoclass:: torchvision.models.EfficientNet_B1_Weights
722+
:members:
703723
"""
704724
weights = EfficientNet_B1_Weights.verify(weights)
705725

@@ -711,13 +731,23 @@ def efficientnet_b1(
711731
def efficientnet_b2(
712732
*, weights: Optional[EfficientNet_B2_Weights] = None, progress: bool = True, **kwargs: Any
713733
) -> EfficientNet:
714-
"""
715-
Constructs a EfficientNet B2 architecture from
716-
`"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks" <https://arxiv.org/abs/1905.11946>`_.
734+
"""EfficientNet B2 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
735+
Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.
717736
718737
Args:
719-
weights (EfficientNet_B2_Weights, optional): The pretrained weights for the model
720-
progress (bool): If True, displays a progress bar of the download to stderr
738+
weights (:class:`~torchvision.models.EfficientNet_B2_Weights`, optional): The
739+
pretrained weights to use. See
740+
:class:`~torchvision.models.EfficientNet_B2_Weights` below for
741+
more details, and possible values. By default, no pre-trained
742+
weights are used.
743+
progress (bool, optional): If True, displays a progress bar of the
744+
download to stderr. Default is True.
745+
**kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
746+
base class. Please refer to the `source code
747+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
748+
for more details about this class.
749+
.. autoclass:: torchvision.models.EfficientNet_B2_Weights
750+
:members:
721751
"""
722752
weights = EfficientNet_B2_Weights.verify(weights)
723753

@@ -729,13 +759,23 @@ def efficientnet_b2(
729759
def efficientnet_b3(
730760
*, weights: Optional[EfficientNet_B3_Weights] = None, progress: bool = True, **kwargs: Any
731761
) -> EfficientNet:
732-
"""
733-
Constructs a EfficientNet B3 architecture from
734-
`"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks" <https://arxiv.org/abs/1905.11946>`_.
762+
"""EfficientNet B3 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
763+
Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.
735764
736765
Args:
737-
weights (EfficientNet_B3_Weights, optional): The pretrained weights for the model
738-
progress (bool): If True, displays a progress bar of the download to stderr
766+
weights (:class:`~torchvision.models.EfficientNet_B3_Weights`, optional): The
767+
pretrained weights to use. See
768+
:class:`~torchvision.models.EfficientNet_B3_Weights` below for
769+
more details, and possible values. By default, no pre-trained
770+
weights are used.
771+
progress (bool, optional): If True, displays a progress bar of the
772+
download to stderr. Default is True.
773+
**kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
774+
base class. Please refer to the `source code
775+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
776+
for more details about this class.
777+
.. autoclass:: torchvision.models.EfficientNet_B3_Weights
778+
:members:
739779
"""
740780
weights = EfficientNet_B3_Weights.verify(weights)
741781

@@ -747,13 +787,23 @@ def efficientnet_b3(
747787
def efficientnet_b4(
748788
*, weights: Optional[EfficientNet_B4_Weights] = None, progress: bool = True, **kwargs: Any
749789
) -> EfficientNet:
750-
"""
751-
Constructs a EfficientNet B4 architecture from
752-
`"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks" <https://arxiv.org/abs/1905.11946>`_.
790+
"""EfficientNet B4 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
791+
Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.
753792
754793
Args:
755-
weights (EfficientNet_B4_Weights, optional): The pretrained weights for the model
756-
progress (bool): If True, displays a progress bar of the download to stderr
794+
weights (:class:`~torchvision.models.EfficientNet_B4_Weights`, optional): The
795+
pretrained weights to use. See
796+
:class:`~torchvision.models.EfficientNet_B4_Weights` below for
797+
more details, and possible values. By default, no pre-trained
798+
weights are used.
799+
progress (bool, optional): If True, displays a progress bar of the
800+
download to stderr. Default is True.
801+
**kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
802+
base class. Please refer to the `source code
803+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
804+
for more details about this class.
805+
.. autoclass:: torchvision.models.EfficientNet_B4_Weights
806+
:members:
757807
"""
758808
weights = EfficientNet_B4_Weights.verify(weights)
759809

@@ -765,13 +815,23 @@ def efficientnet_b4(
765815
def efficientnet_b5(
766816
*, weights: Optional[EfficientNet_B5_Weights] = None, progress: bool = True, **kwargs: Any
767817
) -> EfficientNet:
768-
"""
769-
Constructs a EfficientNet B5 architecture from
770-
`"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks" <https://arxiv.org/abs/1905.11946>`_.
818+
"""EfficientNet B5 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
819+
Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.
771820
772821
Args:
773-
weights (EfficientNet_B5_Weights, optional): The pretrained weights for the model
774-
progress (bool): If True, displays a progress bar of the download to stderr
822+
weights (:class:`~torchvision.models.EfficientNet_B5_Weights`, optional): The
823+
pretrained weights to use. See
824+
:class:`~torchvision.models.EfficientNet_B5_Weights` below for
825+
more details, and possible values. By default, no pre-trained
826+
weights are used.
827+
progress (bool, optional): If True, displays a progress bar of the
828+
download to stderr. Default is True.
829+
**kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
830+
base class. Please refer to the `source code
831+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
832+
for more details about this class.
833+
.. autoclass:: torchvision.models.EfficientNet_B5_Weights
834+
:members:
775835
"""
776836
weights = EfficientNet_B5_Weights.verify(weights)
777837

@@ -791,13 +851,23 @@ def efficientnet_b5(
791851
def efficientnet_b6(
792852
*, weights: Optional[EfficientNet_B6_Weights] = None, progress: bool = True, **kwargs: Any
793853
) -> EfficientNet:
794-
"""
795-
Constructs a EfficientNet B6 architecture from
796-
`"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks" <https://arxiv.org/abs/1905.11946>`_.
854+
"""EfficientNet B6 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
855+
Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.
797856
798857
Args:
799-
weights (EfficientNet_B6_Weights, optional): The pretrained weights for the model
800-
progress (bool): If True, displays a progress bar of the download to stderr
858+
weights (:class:`~torchvision.models.EfficientNet_B6_Weights`, optional): The
859+
pretrained weights to use. See
860+
:class:`~torchvision.models.EfficientNet_B6_Weights` below for
861+
more details, and possible values. By default, no pre-trained
862+
weights are used.
863+
progress (bool, optional): If True, displays a progress bar of the
864+
download to stderr. Default is True.
865+
**kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
866+
base class. Please refer to the `source code
867+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
868+
for more details about this class.
869+
.. autoclass:: torchvision.models.EfficientNet_B6_Weights
870+
:members:
801871
"""
802872
weights = EfficientNet_B6_Weights.verify(weights)
803873

@@ -817,13 +887,23 @@ def efficientnet_b6(
817887
def efficientnet_b7(
818888
*, weights: Optional[EfficientNet_B7_Weights] = None, progress: bool = True, **kwargs: Any
819889
) -> EfficientNet:
820-
"""
821-
Constructs a EfficientNet B7 architecture from
822-
`"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks" <https://arxiv.org/abs/1905.11946>`_.
890+
"""EfficientNet B7 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
891+
Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.
823892
824893
Args:
825-
weights (EfficientNet_B7_Weights, optional): The pretrained weights for the model
826-
progress (bool): If True, displays a progress bar of the download to stderr
894+
weights (:class:`~torchvision.models.EfficientNet_B7_Weights`, optional): The
895+
pretrained weights to use. See
896+
:class:`~torchvision.models.EfficientNet_B7_Weights` below for
897+
more details, and possible values. By default, no pre-trained
898+
weights are used.
899+
progress (bool, optional): If True, displays a progress bar of the
900+
download to stderr. Default is True.
901+
**kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
902+
base class. Please refer to the `source code
903+
<https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
904+
for more details about this class.
905+
.. autoclass:: torchvision.models.EfficientNet_B7_Weights
906+
:members:
827907
"""
828908
weights = EfficientNet_B7_Weights.verify(weights)
829909

0 commit comments

Comments
 (0)