Skip to content

Remove publication_year and interpolation meta #5848

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 4 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion test/test_extended_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_naming_conventions(model_fn):
def test_schema_meta_validation(model_fn):
classification_fields = ["size", "categories", "acc@1", "acc@5", "min_size"]
defaults = {
"all": ["task", "architecture", "publication_year", "interpolation", "recipe", "num_params"],
"all": ["task", "architecture", "recipe", "num_params"],
"models": classification_fields,
"detection": ["categories", "map"],
"quantization": classification_fields + ["backend", "quantization", "unquantized"],
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/alexnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
import torch.nn as nn

from ..transforms._presets import ImageClassification, InterpolationMode
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._meta import _IMAGENET_CATEGORIES
Expand Down Expand Up @@ -59,12 +59,10 @@ class AlexNet_Weights(WeightsEnum):
meta={
"task": "image_classification",
"architecture": "AlexNet",
"publication_year": 2012,
"num_params": 61100840,
"size": (224, 224),
"min_size": (63, 63),
"categories": _IMAGENET_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/pytorch/vision/tree/main/references/classification#alexnet-and-vgg",
"acc@1": 56.522,
"acc@5": 79.066,
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/convnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from ..ops.misc import Conv2dNormActivation
from ..ops.stochastic_depth import StochasticDepth
from ..transforms._presets import ImageClassification, InterpolationMode
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._meta import _IMAGENET_CATEGORIES
Expand Down Expand Up @@ -206,11 +206,9 @@ def _convnext(
_COMMON_META = {
"task": "image_classification",
"architecture": "ConvNeXt",
"publication_year": 2022,
"size": (224, 224),
"min_size": (32, 32),
"categories": _IMAGENET_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/pytorch/vision/tree/main/references/classification#convnext",
}

Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/densenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import torch.utils.checkpoint as cp
from torch import Tensor

from ..transforms._presets import ImageClassification, InterpolationMode
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._meta import _IMAGENET_CATEGORIES
Expand Down Expand Up @@ -268,11 +268,9 @@ def _densenet(
_COMMON_META = {
"task": "image_classification",
"architecture": "DenseNet",
"publication_year": 2016,
"size": (224, 224),
"min_size": (29, 29),
"categories": _IMAGENET_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/pytorch/vision/pull/116",
}

Expand Down
5 changes: 1 addition & 4 deletions torchvision/models/detection/faster_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from torchvision.ops import MultiScaleRoIAlign

from ...ops import misc as misc_nn_ops
from ...transforms._presets import ObjectDetection, InterpolationMode
from ...transforms._presets import ObjectDetection
from .._api import WeightsEnum, Weights
from .._meta import _COCO_CATEGORIES
from .._utils import handle_legacy_interface, _ovewrite_value_param
Expand Down Expand Up @@ -372,9 +372,7 @@ def forward(self, x):
_COMMON_META = {
"task": "image_object_detection",
"architecture": "FasterRCNN",
"publication_year": 2015,
"categories": _COCO_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
}


Expand All @@ -398,7 +396,6 @@ class FasterRCNN_ResNet50_FPN_V2_Weights(WeightsEnum):
transforms=ObjectDetection,
meta={
**_COMMON_META,
"publication_year": 2021,
"num_params": 43712278,
"recipe": "https://github.com/pytorch/vision/pull/5763",
"map": 46.7,
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/detection/fcos.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ...ops import boxes as box_ops
from ...ops import misc as misc_nn_ops
from ...ops.feature_pyramid_network import LastLevelP6P7
from ...transforms._presets import ObjectDetection, InterpolationMode
from ...transforms._presets import ObjectDetection
from ...utils import _log_api_usage_once
from .._api import WeightsEnum, Weights
from .._meta import _COCO_CATEGORIES
Expand Down Expand Up @@ -653,10 +653,8 @@ class FCOS_ResNet50_FPN_Weights(WeightsEnum):
meta={
"task": "image_object_detection",
"architecture": "FCOS",
"publication_year": 2019,
"num_params": 32269600,
"categories": _COCO_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/pytorch/vision/tree/main/references/detection#fcos-resnet-50-fpn",
"map": 39.2,
},
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/detection/keypoint_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from torchvision.ops import MultiScaleRoIAlign

from ...ops import misc as misc_nn_ops
from ...transforms._presets import ObjectDetection, InterpolationMode
from ...transforms._presets import ObjectDetection
from .._api import WeightsEnum, Weights
from .._meta import _COCO_PERSON_CATEGORIES, _COCO_PERSON_KEYPOINT_NAMES
from .._utils import handle_legacy_interface, _ovewrite_value_param
Expand Down Expand Up @@ -310,10 +310,8 @@ def forward(self, x):
_COMMON_META = {
"task": "image_object_detection",
"architecture": "KeypointRCNN",
"publication_year": 2017,
"categories": _COCO_PERSON_CATEGORIES,
"keypoint_names": _COCO_PERSON_KEYPOINT_NAMES,
"interpolation": InterpolationMode.BILINEAR,
}


Expand Down
5 changes: 1 addition & 4 deletions torchvision/models/detection/mask_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from torchvision.ops import MultiScaleRoIAlign

from ...ops import misc as misc_nn_ops
from ...transforms._presets import ObjectDetection, InterpolationMode
from ...transforms._presets import ObjectDetection
from .._api import WeightsEnum, Weights
from .._meta import _COCO_CATEGORIES
from .._utils import handle_legacy_interface, _ovewrite_value_param
Expand Down Expand Up @@ -354,7 +354,6 @@ def __init__(self, in_channels, dim_reduced, num_classes):
"task": "image_object_detection",
"architecture": "MaskRCNN",
"categories": _COCO_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
}


Expand All @@ -364,7 +363,6 @@ class MaskRCNN_ResNet50_FPN_Weights(WeightsEnum):
transforms=ObjectDetection,
meta={
**_COMMON_META,
"publication_year": 2017,
"num_params": 44401393,
"recipe": "https://github.com/pytorch/vision/tree/main/references/detection#mask-r-cnn",
"map": 37.9,
Expand All @@ -380,7 +378,6 @@ class MaskRCNN_ResNet50_FPN_V2_Weights(WeightsEnum):
transforms=ObjectDetection,
meta={
**_COMMON_META,
"publication_year": 2021,
"num_params": 46359409,
"recipe": "https://github.com/pytorch/vision/pull/5773",
"map": 47.4,
Expand Down
5 changes: 1 addition & 4 deletions torchvision/models/detection/retinanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ...ops import boxes as box_ops
from ...ops import misc as misc_nn_ops
from ...ops.feature_pyramid_network import LastLevelP6P7
from ...transforms._presets import ObjectDetection, InterpolationMode
from ...transforms._presets import ObjectDetection
from ...utils import _log_api_usage_once
from .._api import WeightsEnum, Weights
from .._meta import _COCO_CATEGORIES
Expand Down Expand Up @@ -677,7 +677,6 @@ def forward(self, images, targets=None):
"task": "image_object_detection",
"architecture": "RetinaNet",
"categories": _COCO_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
}


Expand All @@ -687,7 +686,6 @@ class RetinaNet_ResNet50_FPN_Weights(WeightsEnum):
transforms=ObjectDetection,
meta={
**_COMMON_META,
"publication_year": 2017,
"num_params": 34014999,
"recipe": "https://github.com/pytorch/vision/tree/main/references/detection#retinanet",
"map": 36.4,
Expand All @@ -702,7 +700,6 @@ class RetinaNet_ResNet50_FPN_V2_Weights(WeightsEnum):
transforms=ObjectDetection,
meta={
**_COMMON_META,
"publication_year": 2019,
"num_params": 38198935,
"recipe": "https://github.com/pytorch/vision/pull/5756",
"map": 41.5,
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/detection/ssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch import nn, Tensor

from ...ops import boxes as box_ops
from ...transforms._presets import ObjectDetection, InterpolationMode
from ...transforms._presets import ObjectDetection
from ...utils import _log_api_usage_once
from .._api import WeightsEnum, Weights
from .._meta import _COCO_CATEGORIES
Expand All @@ -32,11 +32,9 @@ class SSD300_VGG16_Weights(WeightsEnum):
meta={
"task": "image_object_detection",
"architecture": "SSD",
"publication_year": 2015,
"num_params": 35641826,
"size": (300, 300),
"categories": _COCO_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/pytorch/vision/tree/main/references/detection#ssd300-vgg16",
"map": 25.1,
},
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/detection/ssdlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch import nn, Tensor

from ...ops.misc import Conv2dNormActivation
from ...transforms._presets import ObjectDetection, InterpolationMode
from ...transforms._presets import ObjectDetection
from ...utils import _log_api_usage_once
from .. import mobilenet
from .._api import WeightsEnum, Weights
Expand Down Expand Up @@ -191,11 +191,9 @@ class SSDLite320_MobileNet_V3_Large_Weights(WeightsEnum):
meta={
"task": "image_object_detection",
"architecture": "SSDLite",
"publication_year": 2018,
"num_params": 3440060,
"size": (320, 320),
"categories": _COCO_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/pytorch/vision/tree/main/references/detection#ssdlite320-mobilenetv3-large",
"map": 21.3,
},
Expand Down
5 changes: 0 additions & 5 deletions torchvision/models/efficientnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,17 +439,13 @@ def _efficientnet_conf(
_COMMON_META_V1 = {
**_COMMON_META,
"architecture": "EfficientNet",
"publication_year": 2019,
"interpolation": InterpolationMode.BICUBIC,
"min_size": (1, 1),
}


_COMMON_META_V2 = {
**_COMMON_META,
"architecture": "EfficientNetV2",
"publication_year": 2021,
"interpolation": InterpolationMode.BILINEAR,
"min_size": (33, 33),
}

Expand Down Expand Up @@ -494,7 +490,6 @@ class EfficientNet_B1_Weights(WeightsEnum):
**_COMMON_META_V1,
"num_params": 7794184,
"recipe": "https://github.com/pytorch/vision/issues/3995#new-recipe-with-lr-wd-crop-tuning",
"interpolation": InterpolationMode.BILINEAR,
"size": (240, 240),
"acc@1": 79.838,
"acc@5": 94.934,
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/googlenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torch.nn.functional as F
from torch import Tensor

from ..transforms._presets import ImageClassification, InterpolationMode
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._meta import _IMAGENET_CATEGORIES
Expand Down Expand Up @@ -282,12 +282,10 @@ class GoogLeNet_Weights(WeightsEnum):
meta={
"task": "image_classification",
"architecture": "GoogLeNet",
"publication_year": 2014,
"num_params": 6624904,
"size": (224, 224),
"min_size": (15, 15),
"categories": _IMAGENET_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/pytorch/vision/tree/main/references/classification#googlenet",
"acc@1": 69.778,
"acc@5": 89.530,
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import torch.nn.functional as F
from torch import nn, Tensor

from ..transforms._presets import ImageClassification, InterpolationMode
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._meta import _IMAGENET_CATEGORIES
Expand Down Expand Up @@ -414,12 +414,10 @@ class Inception_V3_Weights(WeightsEnum):
meta={
"task": "image_classification",
"architecture": "InceptionV3",
"publication_year": 2015,
"num_params": 27161264,
"size": (299, 299),
"min_size": (75, 75),
"categories": _IMAGENET_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/pytorch/vision/tree/main/references/classification#inception-v3",
"acc@1": 77.294,
"acc@5": 93.450,
Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/mnasnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import torch.nn as nn
from torch import Tensor

from ..transforms._presets import ImageClassification, InterpolationMode
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._meta import _IMAGENET_CATEGORIES
Expand Down Expand Up @@ -214,11 +214,9 @@ def _load_from_state_dict(
_COMMON_META = {
"task": "image_classification",
"architecture": "MNASNet",
"publication_year": 2018,
"size": (224, 224),
"min_size": (1, 1),
"categories": _IMAGENET_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/1e100/mnasnet_trainer",
}

Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/mobilenetv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch import nn

from ..ops.misc import Conv2dNormActivation
from ..transforms._presets import ImageClassification, InterpolationMode
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._meta import _IMAGENET_CATEGORIES
Expand Down Expand Up @@ -197,12 +197,10 @@ def forward(self, x: Tensor) -> Tensor:
_COMMON_META = {
"task": "image_classification",
"architecture": "MobileNetV2",
"publication_year": 2018,
"num_params": 3504872,
"size": (224, 224),
"min_size": (1, 1),
"categories": _IMAGENET_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
}


Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/mobilenetv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from torch import nn, Tensor

from ..ops.misc import Conv2dNormActivation, SqueezeExcitation as SElayer
from ..transforms._presets import ImageClassification, InterpolationMode
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._meta import _IMAGENET_CATEGORIES
Expand Down Expand Up @@ -306,11 +306,9 @@ def _mobilenet_v3(
_COMMON_META = {
"task": "image_classification",
"architecture": "MobileNetV3",
"publication_year": 2019,
"size": (224, 224),
"min_size": (1, 1),
"categories": _IMAGENET_CATEGORIES,
"interpolation": InterpolationMode.BILINEAR,
}


Expand Down
4 changes: 1 addition & 3 deletions torchvision/models/optical_flow/raft.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from torch.nn.modules.instancenorm import InstanceNorm2d
from torchvision.ops import Conv2dNormActivation

from ...transforms._presets import OpticalFlow, InterpolationMode
from ...transforms._presets import OpticalFlow
from ...utils import _log_api_usage_once
from .._api import Weights, WeightsEnum
from .._utils import handle_legacy_interface
Expand Down Expand Up @@ -514,8 +514,6 @@ def forward(self, image1, image2, num_flow_updates: int = 12):
_COMMON_META = {
"task": "optical_flow",
"architecture": "RAFT",
"publication_year": 2020,
"interpolation": InterpolationMode.BILINEAR,
}


Expand Down
Loading