From c4c7b084c93454b84268b8a0ae97c0e9f1e48140 Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Fri, 21 Jan 2022 16:43:06 -0800 Subject: [PATCH 01/13] renamed ImageNet weights --- test/test_prototype_models.py | 10 +- torchvision/prototype/models/_api.py | 2 +- torchvision/prototype/models/alexnet.py | 6 +- torchvision/prototype/models/convnext.py | 6 +- torchvision/prototype/models/densenet.py | 24 ++-- .../prototype/models/detection/faster_rcnn.py | 6 +- .../prototype/models/detection/fcos.py | 2 +- .../models/detection/keypoint_rcnn.py | 2 +- .../prototype/models/detection/mask_rcnn.py | 2 +- .../prototype/models/detection/retinanet.py | 2 +- torchvision/prototype/models/detection/ssd.py | 2 +- .../prototype/models/detection/ssdlite.py | 2 +- torchvision/prototype/models/efficientnet.py | 50 ++++---- torchvision/prototype/models/googlenet.py | 6 +- torchvision/prototype/models/inception.py | 6 +- torchvision/prototype/models/mnasnet.py | 12 +- torchvision/prototype/models/mobilenetv2.py | 6 +- torchvision/prototype/models/mobilenetv3.py | 14 +-- .../models/quantization/googlenet.py | 10 +- .../models/quantization/inception.py | 10 +- .../models/quantization/mobilenetv2.py | 10 +- .../models/quantization/mobilenetv3.py | 10 +- .../prototype/models/quantization/resnet.py | 38 +++--- .../models/quantization/shufflenetv2.py | 20 ++-- torchvision/prototype/models/regnet.py | 112 +++++++++--------- torchvision/prototype/models/resnet.py | 68 +++++------ .../models/segmentation/deeplabv3.py | 6 +- .../prototype/models/segmentation/fcn.py | 4 +- .../prototype/models/segmentation/lraspp.py | 2 +- torchvision/prototype/models/shufflenetv2.py | 12 +- torchvision/prototype/models/squeezenet.py | 12 +- torchvision/prototype/models/vgg.py | 50 ++++---- .../prototype/models/vision_transformer.py | 24 ++-- 33 files changed, 274 insertions(+), 274 deletions(-) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index 3efdf8d7d87..6f9c3b0e42d 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -54,15 +54,15 @@ def _build_model(fn, **kwargs): @pytest.mark.parametrize( "name, weight", [ - ("ResNet50_Weights.ImageNet1K_V1", models.ResNet50_Weights.ImageNet1K_V1), - ("ResNet50_Weights.default", models.ResNet50_Weights.ImageNet1K_V2), + ("ResNet50_Weights.IMAGENET1K_V1", models.ResNet50_Weights.IMAGENET1K_V1), + ("ResNet50_Weights.default", models.ResNet50_Weights.IMAGENET1K_V2), ( "ResNet50_QuantizedWeights.default", - models.quantization.ResNet50_QuantizedWeights.ImageNet1K_FBGEMM_V2, + models.quantization.ResNet50_QuantizedWeights.IMAGENET1K_FBGEMM_V2, ), ( - "ResNet50_QuantizedWeights.ImageNet1K_FBGEMM_V1", - models.quantization.ResNet50_QuantizedWeights.ImageNet1K_FBGEMM_V1, + "ResNet50_QuantizedWeights.IMAGENET1K_FBGEMM_V1", + models.quantization.ResNet50_QuantizedWeights.IMAGENET1K_FBGEMM_V1, ), ], ) diff --git a/torchvision/prototype/models/_api.py b/torchvision/prototype/models/_api.py index 40a5ea93124..e27b4d7adda 100644 --- a/torchvision/prototype/models/_api.py +++ b/torchvision/prototype/models/_api.py @@ -80,7 +80,7 @@ def __getattr__(self, name): def get_weight(name: str) -> WeightsEnum: """ - Gets the weight enum value by its full name. Example: "ResNet50_Weights.ImageNet1K_V1" + Gets the weight enum value by its full name. Example: "ResNet50_Weights.IMAGENET1K_V1" Args: name (str): The name of the weight enum entry. diff --git a/torchvision/prototype/models/alexnet.py b/torchvision/prototype/models/alexnet.py index 8c55385b7c1..a6f2af81064 100644 --- a/torchvision/prototype/models/alexnet.py +++ b/torchvision/prototype/models/alexnet.py @@ -14,7 +14,7 @@ class AlexNet_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/alexnet-owt-7be5be79.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -31,10 +31,10 @@ class AlexNet_Weights(WeightsEnum): "acc@5": 79.066, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", AlexNet_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", AlexNet_Weights.IMAGENET1K_V1)) def alexnet(*, weights: Optional[AlexNet_Weights] = None, progress: bool = True, **kwargs: Any) -> AlexNet: weights = AlexNet_Weights.verify(weights) diff --git a/torchvision/prototype/models/convnext.py b/torchvision/prototype/models/convnext.py index 788dcbc2cd1..800556ca8a2 100644 --- a/torchvision/prototype/models/convnext.py +++ b/torchvision/prototype/models/convnext.py @@ -178,7 +178,7 @@ def forward(self, x: Tensor) -> Tensor: class ConvNeXt_Tiny_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/convnext_tiny-47b116bd.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=236), meta={ @@ -195,10 +195,10 @@ class ConvNeXt_Tiny_Weights(WeightsEnum): "acc@5": 96.146, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", ConvNeXt_Tiny_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ConvNeXt_Tiny_Weights.IMAGENET1K_V1)) def convnext_tiny(*, weights: Optional[ConvNeXt_Tiny_Weights] = None, progress: bool = True, **kwargs: Any) -> ConvNeXt: r"""ConvNeXt model architecture from the `"A ConvNet for the 2020s" `_ paper. diff --git a/torchvision/prototype/models/densenet.py b/torchvision/prototype/models/densenet.py index 522d4c4fcb6..65cdc808c66 100644 --- a/torchvision/prototype/models/densenet.py +++ b/torchvision/prototype/models/densenet.py @@ -76,7 +76,7 @@ def _densenet( class DenseNet121_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/densenet121-a639ec97.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -86,11 +86,11 @@ class DenseNet121_Weights(WeightsEnum): "acc@5": 91.972, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class DenseNet161_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/densenet161-8d451a50.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -100,11 +100,11 @@ class DenseNet161_Weights(WeightsEnum): "acc@5": 93.560, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class DenseNet169_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/densenet169-b2777c0a.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -114,11 +114,11 @@ class DenseNet169_Weights(WeightsEnum): "acc@5": 92.806, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class DenseNet201_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/densenet201-c1103571.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -128,31 +128,31 @@ class DenseNet201_Weights(WeightsEnum): "acc@5": 93.370, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", DenseNet121_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", DenseNet121_Weights.IMAGENET1K_V1)) def densenet121(*, weights: Optional[DenseNet121_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet: weights = DenseNet121_Weights.verify(weights) return _densenet(32, (6, 12, 24, 16), 64, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", DenseNet161_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", DenseNet161_Weights.IMAGENET1K_V1)) def densenet161(*, weights: Optional[DenseNet161_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet: weights = DenseNet161_Weights.verify(weights) return _densenet(48, (6, 12, 36, 24), 96, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", DenseNet169_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", DenseNet169_Weights.IMAGENET1K_V1)) def densenet169(*, weights: Optional[DenseNet169_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet: weights = DenseNet169_Weights.verify(weights) return _densenet(32, (6, 12, 32, 32), 64, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", DenseNet201_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", DenseNet201_Weights.IMAGENET1K_V1)) def densenet201(*, weights: Optional[DenseNet201_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet: weights = DenseNet201_Weights.verify(weights) diff --git a/torchvision/prototype/models/detection/faster_rcnn.py b/torchvision/prototype/models/detection/faster_rcnn.py index 4a70b12bff2..657d2b31733 100644 --- a/torchvision/prototype/models/detection/faster_rcnn.py +++ b/torchvision/prototype/models/detection/faster_rcnn.py @@ -83,7 +83,7 @@ class FasterRCNN_MobileNet_V3_Large_320_FPN_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", FasterRCNN_ResNet50_FPN_Weights.Coco_V1), - weights_backbone=("pretrained_backbone", ResNet50_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def fasterrcnn_resnet50_fpn( *, @@ -162,7 +162,7 @@ def _fasterrcnn_mobilenet_v3_large_fpn( @handle_legacy_interface( weights=("pretrained", FasterRCNN_MobileNet_V3_Large_FPN_Weights.Coco_V1), - weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def fasterrcnn_mobilenet_v3_large_fpn( *, @@ -193,7 +193,7 @@ def fasterrcnn_mobilenet_v3_large_fpn( @handle_legacy_interface( weights=("pretrained", FasterRCNN_MobileNet_V3_Large_320_FPN_Weights.Coco_V1), - weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def fasterrcnn_mobilenet_v3_large_320_fpn( *, diff --git a/torchvision/prototype/models/detection/fcos.py b/torchvision/prototype/models/detection/fcos.py index d1f7f9ba361..c99a4089f9a 100644 --- a/torchvision/prototype/models/detection/fcos.py +++ b/torchvision/prototype/models/detection/fcos.py @@ -43,7 +43,7 @@ class FCOS_ResNet50_FPN_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", FCOS_ResNet50_FPN_Weights.COCO_V1), - weights_backbone=("pretrained_backbone", ResNet50_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def fcos_resnet50_fpn( *, diff --git a/torchvision/prototype/models/detection/keypoint_rcnn.py b/torchvision/prototype/models/detection/keypoint_rcnn.py index f4e71dd3e41..c0acdd47d63 100644 --- a/torchvision/prototype/models/detection/keypoint_rcnn.py +++ b/torchvision/prototype/models/detection/keypoint_rcnn.py @@ -66,7 +66,7 @@ class KeypointRCNN_ResNet50_FPN_Weights(WeightsEnum): if kwargs["pretrained"] == "legacy" else KeypointRCNN_ResNet50_FPN_Weights.Coco_V1, ), - weights_backbone=("pretrained_backbone", ResNet50_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def keypointrcnn_resnet50_fpn( *, diff --git a/torchvision/prototype/models/detection/mask_rcnn.py b/torchvision/prototype/models/detection/mask_rcnn.py index 0c137718382..107d9f14068 100644 --- a/torchvision/prototype/models/detection/mask_rcnn.py +++ b/torchvision/prototype/models/detection/mask_rcnn.py @@ -44,7 +44,7 @@ class MaskRCNN_ResNet50_FPN_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", MaskRCNN_ResNet50_FPN_Weights.Coco_V1), - weights_backbone=("pretrained_backbone", ResNet50_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def maskrcnn_resnet50_fpn( *, diff --git a/torchvision/prototype/models/detection/retinanet.py b/torchvision/prototype/models/detection/retinanet.py index 314c036ccc6..6ed07355528 100644 --- a/torchvision/prototype/models/detection/retinanet.py +++ b/torchvision/prototype/models/detection/retinanet.py @@ -44,7 +44,7 @@ class RetinaNet_ResNet50_FPN_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", RetinaNet_ResNet50_FPN_Weights.Coco_V1), - weights_backbone=("pretrained_backbone", ResNet50_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def retinanet_resnet50_fpn( *, diff --git a/torchvision/prototype/models/detection/ssd.py b/torchvision/prototype/models/detection/ssd.py index 94eb2839bce..12eed9139f9 100644 --- a/torchvision/prototype/models/detection/ssd.py +++ b/torchvision/prototype/models/detection/ssd.py @@ -43,7 +43,7 @@ class SSD300_VGG16_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", SSD300_VGG16_Weights.Coco_V1), - weights_backbone=("pretrained_backbone", VGG16_Weights.ImageNet1K_Features), + weights_backbone=("pretrained_backbone", VGG16_Weights.IMAGENET1K_FEATURES), ) def ssd300_vgg16( *, diff --git a/torchvision/prototype/models/detection/ssdlite.py b/torchvision/prototype/models/detection/ssdlite.py index e06c7ee6e46..e082e6f4a54 100644 --- a/torchvision/prototype/models/detection/ssdlite.py +++ b/torchvision/prototype/models/detection/ssdlite.py @@ -48,7 +48,7 @@ class SSDLite320_MobileNet_V3_Large_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", SSDLite320_MobileNet_V3_Large_Weights.Coco_V1), - weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def ssdlite320_mobilenet_v3_large( *, diff --git a/torchvision/prototype/models/efficientnet.py b/torchvision/prototype/models/efficientnet.py index c1fe1bc45dc..3e34ee8c3bb 100644 --- a/torchvision/prototype/models/efficientnet.py +++ b/torchvision/prototype/models/efficientnet.py @@ -74,7 +74,7 @@ def _efficientnet( class EfficientNet_B0_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/efficientnet_b0_rwightman-3dd342df.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=256, interpolation=InterpolationMode.BICUBIC), meta={ @@ -85,11 +85,11 @@ class EfficientNet_B0_Weights(WeightsEnum): "acc@5": 93.532, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class EfficientNet_B1_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/efficientnet_b1_rwightman-533bc792.pth", transforms=partial(ImageNetEval, crop_size=240, resize_size=256, interpolation=InterpolationMode.BICUBIC), meta={ @@ -100,7 +100,7 @@ class EfficientNet_B1_Weights(WeightsEnum): "acc@5": 94.186, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/efficientnet_b1-c27df63c.pth", transforms=partial(ImageNetEval, crop_size=240, resize_size=255, interpolation=InterpolationMode.BILINEAR), meta={ @@ -113,11 +113,11 @@ class EfficientNet_B1_Weights(WeightsEnum): "acc@5": 94.934, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class EfficientNet_B2_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/efficientnet_b2_rwightman-bcdf34b7.pth", transforms=partial(ImageNetEval, crop_size=288, resize_size=288, interpolation=InterpolationMode.BICUBIC), meta={ @@ -128,11 +128,11 @@ class EfficientNet_B2_Weights(WeightsEnum): "acc@5": 95.310, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class EfficientNet_B3_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/efficientnet_b3_rwightman-cf984f9c.pth", transforms=partial(ImageNetEval, crop_size=300, resize_size=320, interpolation=InterpolationMode.BICUBIC), meta={ @@ -143,11 +143,11 @@ class EfficientNet_B3_Weights(WeightsEnum): "acc@5": 96.054, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class EfficientNet_B4_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/efficientnet_b4_rwightman-7eb33cd5.pth", transforms=partial(ImageNetEval, crop_size=380, resize_size=384, interpolation=InterpolationMode.BICUBIC), meta={ @@ -158,11 +158,11 @@ class EfficientNet_B4_Weights(WeightsEnum): "acc@5": 96.594, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class EfficientNet_B5_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/efficientnet_b5_lukemelas-b6417697.pth", transforms=partial(ImageNetEval, crop_size=456, resize_size=456, interpolation=InterpolationMode.BICUBIC), meta={ @@ -173,11 +173,11 @@ class EfficientNet_B5_Weights(WeightsEnum): "acc@5": 96.628, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class EfficientNet_B6_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/efficientnet_b6_lukemelas-c76e70fd.pth", transforms=partial(ImageNetEval, crop_size=528, resize_size=528, interpolation=InterpolationMode.BICUBIC), meta={ @@ -188,11 +188,11 @@ class EfficientNet_B6_Weights(WeightsEnum): "acc@5": 96.916, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class EfficientNet_B7_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/efficientnet_b7_lukemelas-dcc49843.pth", transforms=partial(ImageNetEval, crop_size=600, resize_size=600, interpolation=InterpolationMode.BICUBIC), meta={ @@ -203,10 +203,10 @@ class EfficientNet_B7_Weights(WeightsEnum): "acc@5": 96.908, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", EfficientNet_B0_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", EfficientNet_B0_Weights.IMAGENET1K_V1)) def efficientnet_b0( *, weights: Optional[EfficientNet_B0_Weights] = None, progress: bool = True, **kwargs: Any ) -> EfficientNet: @@ -215,7 +215,7 @@ def efficientnet_b0( return _efficientnet(width_mult=1.0, depth_mult=1.0, dropout=0.2, weights=weights, progress=progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", EfficientNet_B1_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", EfficientNet_B1_Weights.IMAGENET1K_V1)) def efficientnet_b1( *, weights: Optional[EfficientNet_B1_Weights] = None, progress: bool = True, **kwargs: Any ) -> EfficientNet: @@ -224,7 +224,7 @@ def efficientnet_b1( return _efficientnet(width_mult=1.0, depth_mult=1.1, dropout=0.2, weights=weights, progress=progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", EfficientNet_B2_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", EfficientNet_B2_Weights.IMAGENET1K_V1)) def efficientnet_b2( *, weights: Optional[EfficientNet_B2_Weights] = None, progress: bool = True, **kwargs: Any ) -> EfficientNet: @@ -233,7 +233,7 @@ def efficientnet_b2( return _efficientnet(width_mult=1.1, depth_mult=1.2, dropout=0.3, weights=weights, progress=progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", EfficientNet_B3_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", EfficientNet_B3_Weights.IMAGENET1K_V1)) def efficientnet_b3( *, weights: Optional[EfficientNet_B3_Weights] = None, progress: bool = True, **kwargs: Any ) -> EfficientNet: @@ -242,7 +242,7 @@ def efficientnet_b3( return _efficientnet(width_mult=1.2, depth_mult=1.4, dropout=0.3, weights=weights, progress=progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", EfficientNet_B4_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", EfficientNet_B4_Weights.IMAGENET1K_V1)) def efficientnet_b4( *, weights: Optional[EfficientNet_B4_Weights] = None, progress: bool = True, **kwargs: Any ) -> EfficientNet: @@ -251,7 +251,7 @@ def efficientnet_b4( return _efficientnet(width_mult=1.4, depth_mult=1.8, dropout=0.4, weights=weights, progress=progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", EfficientNet_B5_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", EfficientNet_B5_Weights.IMAGENET1K_V1)) def efficientnet_b5( *, weights: Optional[EfficientNet_B5_Weights] = None, progress: bool = True, **kwargs: Any ) -> EfficientNet: @@ -268,7 +268,7 @@ def efficientnet_b5( ) -@handle_legacy_interface(weights=("pretrained", EfficientNet_B6_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", EfficientNet_B6_Weights.IMAGENET1K_V1)) def efficientnet_b6( *, weights: Optional[EfficientNet_B6_Weights] = None, progress: bool = True, **kwargs: Any ) -> EfficientNet: @@ -285,7 +285,7 @@ def efficientnet_b6( ) -@handle_legacy_interface(weights=("pretrained", EfficientNet_B7_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", EfficientNet_B7_Weights.IMAGENET1K_V1)) def efficientnet_b7( *, weights: Optional[EfficientNet_B7_Weights] = None, progress: bool = True, **kwargs: Any ) -> EfficientNet: diff --git a/torchvision/prototype/models/googlenet.py b/torchvision/prototype/models/googlenet.py index fde36615bcf..b2841ddf07d 100644 --- a/torchvision/prototype/models/googlenet.py +++ b/torchvision/prototype/models/googlenet.py @@ -15,7 +15,7 @@ class GoogLeNet_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/googlenet-1378be20.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -32,10 +32,10 @@ class GoogLeNet_Weights(WeightsEnum): "acc@5": 89.530, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", GoogLeNet_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", GoogLeNet_Weights.IMAGENET1K_V1)) def googlenet(*, weights: Optional[GoogLeNet_Weights] = None, progress: bool = True, **kwargs: Any) -> GoogLeNet: weights = GoogLeNet_Weights.verify(weights) diff --git a/torchvision/prototype/models/inception.py b/torchvision/prototype/models/inception.py index 75c2e655ca6..f82c8444718 100644 --- a/torchvision/prototype/models/inception.py +++ b/torchvision/prototype/models/inception.py @@ -14,7 +14,7 @@ class Inception_V3_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/inception_v3_google-0cc3c7bd.pth", transforms=partial(ImageNetEval, crop_size=299, resize_size=342), meta={ @@ -31,10 +31,10 @@ class Inception_V3_Weights(WeightsEnum): "acc@5": 93.450, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", Inception_V3_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", Inception_V3_Weights.IMAGENET1K_V1)) def inception_v3(*, weights: Optional[Inception_V3_Weights] = None, progress: bool = True, **kwargs: Any) -> Inception3: weights = Inception_V3_Weights.verify(weights) diff --git a/torchvision/prototype/models/mnasnet.py b/torchvision/prototype/models/mnasnet.py index feeec0103f4..ec9c9e5f53b 100644 --- a/torchvision/prototype/models/mnasnet.py +++ b/torchvision/prototype/models/mnasnet.py @@ -36,7 +36,7 @@ class MNASNet0_5_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/mnasnet0.5_top1_67.823-3ffadce67e.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -46,7 +46,7 @@ class MNASNet0_5_Weights(WeightsEnum): "acc@5": 87.490, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class MNASNet0_75_Weights(WeightsEnum): @@ -55,7 +55,7 @@ class MNASNet0_75_Weights(WeightsEnum): class MNASNet1_0_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/mnasnet1.0_top1_73.512-f206786ef8.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -65,7 +65,7 @@ class MNASNet1_0_Weights(WeightsEnum): "acc@5": 91.510, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class MNASNet1_3_Weights(WeightsEnum): @@ -85,7 +85,7 @@ def _mnasnet(alpha: float, weights: Optional[WeightsEnum], progress: bool, **kwa return model -@handle_legacy_interface(weights=("pretrained", MNASNet0_5_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", MNASNet0_5_Weights.IMAGENET1K_V1)) def mnasnet0_5(*, weights: Optional[MNASNet0_5_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet: weights = MNASNet0_5_Weights.verify(weights) @@ -99,7 +99,7 @@ def mnasnet0_75(*, weights: Optional[MNASNet0_75_Weights] = None, progress: bool return _mnasnet(0.75, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", MNASNet1_0_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", MNASNet1_0_Weights.IMAGENET1K_V1)) def mnasnet1_0(*, weights: Optional[MNASNet1_0_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet: weights = MNASNet1_0_Weights.verify(weights) diff --git a/torchvision/prototype/models/mobilenetv2.py b/torchvision/prototype/models/mobilenetv2.py index 48160bcae98..1219f94c677 100644 --- a/torchvision/prototype/models/mobilenetv2.py +++ b/torchvision/prototype/models/mobilenetv2.py @@ -14,7 +14,7 @@ class MobileNet_V2_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/mobilenet_v2-b0353104.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -31,10 +31,10 @@ class MobileNet_V2_Weights(WeightsEnum): "acc@5": 90.286, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", MobileNet_V2_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", MobileNet_V2_Weights.IMAGENET1K_V1)) def mobilenet_v2( *, weights: Optional[MobileNet_V2_Weights] = None, progress: bool = True, **kwargs: Any ) -> MobileNetV2: diff --git a/torchvision/prototype/models/mobilenetv3.py b/torchvision/prototype/models/mobilenetv3.py index b9ba39e57d5..a34324aa327 100644 --- a/torchvision/prototype/models/mobilenetv3.py +++ b/torchvision/prototype/models/mobilenetv3.py @@ -49,7 +49,7 @@ def _mobilenet_v3( class MobileNet_V3_Large_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/mobilenet_v3_large-8738ca79.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -60,7 +60,7 @@ class MobileNet_V3_Large_Weights(WeightsEnum): "acc@5": 91.340, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/mobilenet_v3_large-5c1a4163.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -71,11 +71,11 @@ class MobileNet_V3_Large_Weights(WeightsEnum): "acc@5": 92.566, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class MobileNet_V3_Small_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/mobilenet_v3_small-047dcff4.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -86,10 +86,10 @@ class MobileNet_V3_Small_Weights(WeightsEnum): "acc@5": 87.402, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", MobileNet_V3_Large_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", MobileNet_V3_Large_Weights.IMAGENET1K_V1)) def mobilenet_v3_large( *, weights: Optional[MobileNet_V3_Large_Weights] = None, progress: bool = True, **kwargs: Any ) -> MobileNetV3: @@ -99,7 +99,7 @@ def mobilenet_v3_large( return _mobilenet_v3(inverted_residual_setting, last_channel, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", MobileNet_V3_Small_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", MobileNet_V3_Small_Weights.IMAGENET1K_V1)) def mobilenet_v3_small( *, weights: Optional[MobileNet_V3_Small_Weights] = None, progress: bool = True, **kwargs: Any ) -> MobileNetV3: diff --git a/torchvision/prototype/models/quantization/googlenet.py b/torchvision/prototype/models/quantization/googlenet.py index dde9550d4a3..3af827d230a 100644 --- a/torchvision/prototype/models/quantization/googlenet.py +++ b/torchvision/prototype/models/quantization/googlenet.py @@ -24,7 +24,7 @@ class GoogLeNet_QuantizedWeights(WeightsEnum): - ImageNet1K_FBGEMM_V1 = Weights( + IMAGENET1K_FBGEMM_V1 = Weights( url="https://download.pytorch.org/models/quantized/googlenet_fbgemm-c00238cf.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -39,20 +39,20 @@ class GoogLeNet_QuantizedWeights(WeightsEnum): "backend": "fbgemm", "quantization": "ptq", "recipe": "https://github.com/pytorch/vision/tree/main/references/classification#post-training-quantized-models", - "unquantized": GoogLeNet_Weights.ImageNet1K_V1, + "unquantized": GoogLeNet_Weights.IMAGENET1K_V1, "acc@1": 69.826, "acc@5": 89.404, }, ) - default = ImageNet1K_FBGEMM_V1 + default = IMAGENET1K_FBGEMM_V1 @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: GoogLeNet_QuantizedWeights.ImageNet1K_FBGEMM_V1 + lambda kwargs: GoogLeNet_QuantizedWeights.IMAGENET1K_FBGEMM_V1 if kwargs.get("quantize", False) - else GoogLeNet_Weights.ImageNet1K_V1, + else GoogLeNet_Weights.IMAGENET1K_V1, ) ) def googlenet( diff --git a/torchvision/prototype/models/quantization/inception.py b/torchvision/prototype/models/quantization/inception.py index 583bd90e41d..df3017d0ada 100644 --- a/torchvision/prototype/models/quantization/inception.py +++ b/torchvision/prototype/models/quantization/inception.py @@ -23,7 +23,7 @@ class Inception_V3_QuantizedWeights(WeightsEnum): - ImageNet1K_FBGEMM_V1 = Weights( + IMAGENET1K_FBGEMM_V1 = Weights( url="https://download.pytorch.org/models/quantized/inception_v3_google_fbgemm-71447a44.pth", transforms=partial(ImageNetEval, crop_size=299, resize_size=342), meta={ @@ -38,20 +38,20 @@ class Inception_V3_QuantizedWeights(WeightsEnum): "backend": "fbgemm", "quantization": "ptq", "recipe": "https://github.com/pytorch/vision/tree/main/references/classification#post-training-quantized-models", - "unquantized": Inception_V3_Weights.ImageNet1K_V1, + "unquantized": Inception_V3_Weights.IMAGENET1K_V1, "acc@1": 77.176, "acc@5": 93.354, }, ) - default = ImageNet1K_FBGEMM_V1 + default = IMAGENET1K_FBGEMM_V1 @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: Inception_V3_QuantizedWeights.ImageNet1K_FBGEMM_V1 + lambda kwargs: Inception_V3_QuantizedWeights.IMAGENET1K_FBGEMM_V1 if kwargs.get("quantize", False) - else Inception_V3_Weights.ImageNet1K_V1, + else Inception_V3_Weights.IMAGENET1K_V1, ) ) def inception_v3( diff --git a/torchvision/prototype/models/quantization/mobilenetv2.py b/torchvision/prototype/models/quantization/mobilenetv2.py index 8cba427ff1b..723e55c5de4 100644 --- a/torchvision/prototype/models/quantization/mobilenetv2.py +++ b/torchvision/prototype/models/quantization/mobilenetv2.py @@ -24,7 +24,7 @@ class MobileNet_V2_QuantizedWeights(WeightsEnum): - ImageNet1K_QNNPACK_V1 = Weights( + IMAGENET1K_QNNPACK_V1 = Weights( url="https://download.pytorch.org/models/quantized/mobilenet_v2_qnnpack_37f702c5.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -39,20 +39,20 @@ class MobileNet_V2_QuantizedWeights(WeightsEnum): "backend": "qnnpack", "quantization": "qat", "recipe": "https://github.com/pytorch/vision/tree/main/references/classification#qat-mobilenetv2", - "unquantized": MobileNet_V2_Weights.ImageNet1K_V1, + "unquantized": MobileNet_V2_Weights.IMAGENET1K_V1, "acc@1": 71.658, "acc@5": 90.150, }, ) - default = ImageNet1K_QNNPACK_V1 + default = IMAGENET1K_QNNPACK_V1 @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: MobileNet_V2_QuantizedWeights.ImageNet1K_QNNPACK_V1 + lambda kwargs: MobileNet_V2_QuantizedWeights.IMAGENET1K_QNNPACK_V1 if kwargs.get("quantize", False) - else MobileNet_V2_Weights.ImageNet1K_V1, + else MobileNet_V2_Weights.IMAGENET1K_V1, ) ) def mobilenet_v2( diff --git a/torchvision/prototype/models/quantization/mobilenetv3.py b/torchvision/prototype/models/quantization/mobilenetv3.py index cdb1b413de2..b1918e4c8cc 100644 --- a/torchvision/prototype/models/quantization/mobilenetv3.py +++ b/torchvision/prototype/models/quantization/mobilenetv3.py @@ -57,7 +57,7 @@ def _mobilenet_v3_model( class MobileNet_V3_Large_QuantizedWeights(WeightsEnum): - ImageNet1K_QNNPACK_V1 = Weights( + IMAGENET1K_QNNPACK_V1 = Weights( url="https://download.pytorch.org/models/quantized/mobilenet_v3_large_qnnpack-5bcacf28.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -72,20 +72,20 @@ class MobileNet_V3_Large_QuantizedWeights(WeightsEnum): "backend": "qnnpack", "quantization": "qat", "recipe": "https://github.com/pytorch/vision/tree/main/references/classification#qat-mobilenetv3", - "unquantized": MobileNet_V3_Large_Weights.ImageNet1K_V1, + "unquantized": MobileNet_V3_Large_Weights.IMAGENET1K_V1, "acc@1": 73.004, "acc@5": 90.858, }, ) - default = ImageNet1K_QNNPACK_V1 + default = IMAGENET1K_QNNPACK_V1 @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: MobileNet_V3_Large_QuantizedWeights.ImageNet1K_QNNPACK_V1 + lambda kwargs: MobileNet_V3_Large_QuantizedWeights.IMAGENET1K_QNNPACK_V1 if kwargs.get("quantize", False) - else MobileNet_V3_Large_Weights.ImageNet1K_V1, + else MobileNet_V3_Large_Weights.IMAGENET1K_V1, ) ) def mobilenet_v3_large( diff --git a/torchvision/prototype/models/quantization/resnet.py b/torchvision/prototype/models/quantization/resnet.py index d8d0eee636a..51624303a6a 100644 --- a/torchvision/prototype/models/quantization/resnet.py +++ b/torchvision/prototype/models/quantization/resnet.py @@ -66,7 +66,7 @@ def _resnet( class ResNet18_QuantizedWeights(WeightsEnum): - ImageNet1K_FBGEMM_V1 = Weights( + IMAGENET1K_FBGEMM_V1 = Weights( url="https://download.pytorch.org/models/quantized/resnet18_fbgemm_16fa66dd.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -74,16 +74,16 @@ class ResNet18_QuantizedWeights(WeightsEnum): "architecture": "ResNet", "publication_year": 2015, "num_params": 11689512, - "unquantized": ResNet18_Weights.ImageNet1K_V1, + "unquantized": ResNet18_Weights.IMAGENET1K_V1, "acc@1": 69.494, "acc@5": 88.882, }, ) - default = ImageNet1K_FBGEMM_V1 + default = IMAGENET1K_FBGEMM_V1 class ResNet50_QuantizedWeights(WeightsEnum): - ImageNet1K_FBGEMM_V1 = Weights( + IMAGENET1K_FBGEMM_V1 = Weights( url="https://download.pytorch.org/models/quantized/resnet50_fbgemm_bf931d71.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -91,12 +91,12 @@ class ResNet50_QuantizedWeights(WeightsEnum): "architecture": "ResNet", "publication_year": 2015, "num_params": 25557032, - "unquantized": ResNet50_Weights.ImageNet1K_V1, + "unquantized": ResNet50_Weights.IMAGENET1K_V1, "acc@1": 75.920, "acc@5": 92.814, }, ) - ImageNet1K_FBGEMM_V2 = Weights( + IMAGENET1K_FBGEMM_V2 = Weights( url="https://download.pytorch.org/models/quantized/resnet50_fbgemm-23753f79.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -104,16 +104,16 @@ class ResNet50_QuantizedWeights(WeightsEnum): "architecture": "ResNet", "publication_year": 2015, "num_params": 25557032, - "unquantized": ResNet50_Weights.ImageNet1K_V2, + "unquantized": ResNet50_Weights.IMAGENET1K_V2, "acc@1": 80.282, "acc@5": 94.976, }, ) - default = ImageNet1K_FBGEMM_V2 + default = IMAGENET1K_FBGEMM_V2 class ResNeXt101_32X8D_QuantizedWeights(WeightsEnum): - ImageNet1K_FBGEMM_V1 = Weights( + IMAGENET1K_FBGEMM_V1 = Weights( url="https://download.pytorch.org/models/quantized/resnext101_32x8_fbgemm_09835ccf.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -121,12 +121,12 @@ class ResNeXt101_32X8D_QuantizedWeights(WeightsEnum): "architecture": "ResNeXt", "publication_year": 2016, "num_params": 88791336, - "unquantized": ResNeXt101_32X8D_Weights.ImageNet1K_V1, + "unquantized": ResNeXt101_32X8D_Weights.IMAGENET1K_V1, "acc@1": 78.986, "acc@5": 94.480, }, ) - ImageNet1K_FBGEMM_V2 = Weights( + IMAGENET1K_FBGEMM_V2 = Weights( url="https://download.pytorch.org/models/quantized/resnext101_32x8_fbgemm-ee16d00c.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -134,20 +134,20 @@ class ResNeXt101_32X8D_QuantizedWeights(WeightsEnum): "architecture": "ResNeXt", "publication_year": 2016, "num_params": 88791336, - "unquantized": ResNeXt101_32X8D_Weights.ImageNet1K_V2, + "unquantized": ResNeXt101_32X8D_Weights.IMAGENET1K_V2, "acc@1": 82.574, "acc@5": 96.132, }, ) - default = ImageNet1K_FBGEMM_V2 + default = IMAGENET1K_FBGEMM_V2 @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: ResNet18_QuantizedWeights.ImageNet1K_FBGEMM_V1 + lambda kwargs: ResNet18_QuantizedWeights.IMAGENET1K_FBGEMM_V1 if kwargs.get("quantize", False) - else ResNet18_Weights.ImageNet1K_V1, + else ResNet18_Weights.IMAGENET1K_V1, ) ) def resnet18( @@ -165,9 +165,9 @@ def resnet18( @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: ResNet50_QuantizedWeights.ImageNet1K_FBGEMM_V1 + lambda kwargs: ResNet50_QuantizedWeights.IMAGENET1K_FBGEMM_V1 if kwargs.get("quantize", False) - else ResNet50_Weights.ImageNet1K_V1, + else ResNet50_Weights.IMAGENET1K_V1, ) ) def resnet50( @@ -185,9 +185,9 @@ def resnet50( @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: ResNeXt101_32X8D_QuantizedWeights.ImageNet1K_FBGEMM_V1 + lambda kwargs: ResNeXt101_32X8D_QuantizedWeights.IMAGENET1K_FBGEMM_V1 if kwargs.get("quantize", False) - else ResNeXt101_32X8D_Weights.ImageNet1K_V1, + else ResNeXt101_32X8D_Weights.IMAGENET1K_V1, ) ) def resnext101_32x8d( diff --git a/torchvision/prototype/models/quantization/shufflenetv2.py b/torchvision/prototype/models/quantization/shufflenetv2.py index dd2c8ce1cb8..e0aacc77aca 100644 --- a/torchvision/prototype/models/quantization/shufflenetv2.py +++ b/torchvision/prototype/models/quantization/shufflenetv2.py @@ -65,41 +65,41 @@ def _shufflenetv2( class ShuffleNet_V2_X0_5_QuantizedWeights(WeightsEnum): - ImageNet1K_FBGEMM_V1 = Weights( + IMAGENET1K_FBGEMM_V1 = Weights( url="https://download.pytorch.org/models/quantized/shufflenetv2_x0.5_fbgemm-00845098.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ **_COMMON_META, "num_params": 1366792, - "unquantized": ShuffleNet_V2_X0_5_Weights.ImageNet1K_V1, + "unquantized": ShuffleNet_V2_X0_5_Weights.IMAGENET1K_V1, "acc@1": 57.972, "acc@5": 79.780, }, ) - default = ImageNet1K_FBGEMM_V1 + default = IMAGENET1K_FBGEMM_V1 class ShuffleNet_V2_X1_0_QuantizedWeights(WeightsEnum): - ImageNet1K_FBGEMM_V1 = Weights( + IMAGENET1K_FBGEMM_V1 = Weights( url="https://download.pytorch.org/models/quantized/shufflenetv2_x1_fbgemm-db332c57.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ **_COMMON_META, "num_params": 2278604, - "unquantized": ShuffleNet_V2_X1_0_Weights.ImageNet1K_V1, + "unquantized": ShuffleNet_V2_X1_0_Weights.IMAGENET1K_V1, "acc@1": 68.360, "acc@5": 87.582, }, ) - default = ImageNet1K_FBGEMM_V1 + default = IMAGENET1K_FBGEMM_V1 @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: ShuffleNet_V2_X0_5_QuantizedWeights.ImageNet1K_FBGEMM_V1 + lambda kwargs: ShuffleNet_V2_X0_5_QuantizedWeights.IMAGENET1K_FBGEMM_V1 if kwargs.get("quantize", False) - else ShuffleNet_V2_X0_5_Weights.ImageNet1K_V1, + else ShuffleNet_V2_X0_5_Weights.IMAGENET1K_V1, ) ) def shufflenet_v2_x0_5( @@ -118,9 +118,9 @@ def shufflenet_v2_x0_5( @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: ShuffleNet_V2_X1_0_QuantizedWeights.ImageNet1K_FBGEMM_V1 + lambda kwargs: ShuffleNet_V2_X1_0_QuantizedWeights.IMAGENET1K_FBGEMM_V1 if kwargs.get("quantize", False) - else ShuffleNet_V2_X1_0_Weights.ImageNet1K_V1, + else ShuffleNet_V2_X1_0_Weights.IMAGENET1K_V1, ) ) def shufflenet_v2_x1_0( diff --git a/torchvision/prototype/models/regnet.py b/torchvision/prototype/models/regnet.py index 46831f96718..4cdae5bf75c 100644 --- a/torchvision/prototype/models/regnet.py +++ b/torchvision/prototype/models/regnet.py @@ -75,7 +75,7 @@ def _regnet( class RegNet_Y_400MF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_y_400mf-c65dace8.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -86,7 +86,7 @@ class RegNet_Y_400MF_Weights(WeightsEnum): "acc@5": 91.716, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_y_400mf-e6988f5f.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -97,11 +97,11 @@ class RegNet_Y_400MF_Weights(WeightsEnum): "acc@5": 92.742, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_Y_800MF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_y_800mf-1b27b58c.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -112,7 +112,7 @@ class RegNet_Y_800MF_Weights(WeightsEnum): "acc@5": 93.136, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_y_800mf-58fc7688.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -123,11 +123,11 @@ class RegNet_Y_800MF_Weights(WeightsEnum): "acc@5": 94.502, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_Y_1_6GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_y_1_6gf-b11a554e.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -138,7 +138,7 @@ class RegNet_Y_1_6GF_Weights(WeightsEnum): "acc@5": 93.966, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_y_1_6gf-0d7bc02a.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -149,11 +149,11 @@ class RegNet_Y_1_6GF_Weights(WeightsEnum): "acc@5": 95.444, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_Y_3_2GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_y_3_2gf-b5a9779c.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -164,7 +164,7 @@ class RegNet_Y_3_2GF_Weights(WeightsEnum): "acc@5": 94.576, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_y_3_2gf-9180c971.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -175,11 +175,11 @@ class RegNet_Y_3_2GF_Weights(WeightsEnum): "acc@5": 95.972, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_Y_8GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_y_8gf-d0d0e4a8.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -190,7 +190,7 @@ class RegNet_Y_8GF_Weights(WeightsEnum): "acc@5": 95.048, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_y_8gf-dc2b1b54.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -201,11 +201,11 @@ class RegNet_Y_8GF_Weights(WeightsEnum): "acc@5": 96.330, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_Y_16GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_y_16gf-9e6ed7dd.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -216,7 +216,7 @@ class RegNet_Y_16GF_Weights(WeightsEnum): "acc@5": 95.240, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_y_16gf-3e4a00f9.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -227,11 +227,11 @@ class RegNet_Y_16GF_Weights(WeightsEnum): "acc@5": 96.328, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_Y_32GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_y_32gf-4dee3f7a.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -242,7 +242,7 @@ class RegNet_Y_32GF_Weights(WeightsEnum): "acc@5": 95.340, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_y_32gf-8db6d4b5.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -253,7 +253,7 @@ class RegNet_Y_32GF_Weights(WeightsEnum): "acc@5": 96.498, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_Y_128GF_Weights(WeightsEnum): @@ -262,7 +262,7 @@ class RegNet_Y_128GF_Weights(WeightsEnum): class RegNet_X_400MF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_x_400mf-adf1edd5.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -273,7 +273,7 @@ class RegNet_X_400MF_Weights(WeightsEnum): "acc@5": 90.950, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_x_400mf-62229a5f.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -284,11 +284,11 @@ class RegNet_X_400MF_Weights(WeightsEnum): "acc@5": 92.322, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_X_800MF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_x_800mf-ad17e45c.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -299,7 +299,7 @@ class RegNet_X_800MF_Weights(WeightsEnum): "acc@5": 92.348, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_x_800mf-94a99ebd.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -310,11 +310,11 @@ class RegNet_X_800MF_Weights(WeightsEnum): "acc@5": 93.826, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_X_1_6GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_x_1_6gf-e3633e7f.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -325,7 +325,7 @@ class RegNet_X_1_6GF_Weights(WeightsEnum): "acc@5": 93.440, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_x_1_6gf-a12f2b72.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -336,11 +336,11 @@ class RegNet_X_1_6GF_Weights(WeightsEnum): "acc@5": 94.922, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_X_3_2GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_x_3_2gf-f342aeae.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -351,7 +351,7 @@ class RegNet_X_3_2GF_Weights(WeightsEnum): "acc@5": 93.992, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_x_3_2gf-7071aa85.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -362,11 +362,11 @@ class RegNet_X_3_2GF_Weights(WeightsEnum): "acc@5": 95.430, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_X_8GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_x_8gf-03ceed89.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -377,7 +377,7 @@ class RegNet_X_8GF_Weights(WeightsEnum): "acc@5": 94.686, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_x_8gf-2b70d774.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -388,11 +388,11 @@ class RegNet_X_8GF_Weights(WeightsEnum): "acc@5": 95.678, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_X_16GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_x_16gf-2007eb11.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -403,7 +403,7 @@ class RegNet_X_16GF_Weights(WeightsEnum): "acc@5": 94.944, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_x_16gf-ba3796d7.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -414,11 +414,11 @@ class RegNet_X_16GF_Weights(WeightsEnum): "acc@5": 96.196, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class RegNet_X_32GF_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/regnet_x_32gf-9d47f8d0.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -429,7 +429,7 @@ class RegNet_X_32GF_Weights(WeightsEnum): "acc@5": 95.248, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/regnet_x_32gf-6eb8fdc6.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -440,10 +440,10 @@ class RegNet_X_32GF_Weights(WeightsEnum): "acc@5": 96.288, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 -@handle_legacy_interface(weights=("pretrained", RegNet_Y_400MF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_Y_400MF_Weights.IMAGENET1K_V1)) def regnet_y_400mf(*, weights: Optional[RegNet_Y_400MF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_Y_400MF_Weights.verify(weights) @@ -451,7 +451,7 @@ def regnet_y_400mf(*, weights: Optional[RegNet_Y_400MF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_Y_800MF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_Y_800MF_Weights.IMAGENET1K_V1)) def regnet_y_800mf(*, weights: Optional[RegNet_Y_800MF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_Y_800MF_Weights.verify(weights) @@ -459,7 +459,7 @@ def regnet_y_800mf(*, weights: Optional[RegNet_Y_800MF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_Y_1_6GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_Y_1_6GF_Weights.IMAGENET1K_V1)) def regnet_y_1_6gf(*, weights: Optional[RegNet_Y_1_6GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_Y_1_6GF_Weights.verify(weights) @@ -469,7 +469,7 @@ def regnet_y_1_6gf(*, weights: Optional[RegNet_Y_1_6GF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_Y_3_2GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_Y_3_2GF_Weights.IMAGENET1K_V1)) def regnet_y_3_2gf(*, weights: Optional[RegNet_Y_3_2GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_Y_3_2GF_Weights.verify(weights) @@ -479,7 +479,7 @@ def regnet_y_3_2gf(*, weights: Optional[RegNet_Y_3_2GF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_Y_8GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_Y_8GF_Weights.IMAGENET1K_V1)) def regnet_y_8gf(*, weights: Optional[RegNet_Y_8GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_Y_8GF_Weights.verify(weights) @@ -489,7 +489,7 @@ def regnet_y_8gf(*, weights: Optional[RegNet_Y_8GF_Weights] = None, progress: bo return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_Y_16GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_Y_16GF_Weights.IMAGENET1K_V1)) def regnet_y_16gf(*, weights: Optional[RegNet_Y_16GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_Y_16GF_Weights.verify(weights) @@ -499,7 +499,7 @@ def regnet_y_16gf(*, weights: Optional[RegNet_Y_16GF_Weights] = None, progress: return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_Y_32GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_Y_32GF_Weights.IMAGENET1K_V1)) def regnet_y_32gf(*, weights: Optional[RegNet_Y_32GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_Y_32GF_Weights.verify(weights) @@ -519,7 +519,7 @@ def regnet_y_128gf(*, weights: Optional[RegNet_Y_128GF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_X_400MF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_X_400MF_Weights.IMAGENET1K_V1)) def regnet_x_400mf(*, weights: Optional[RegNet_X_400MF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_X_400MF_Weights.verify(weights) @@ -527,7 +527,7 @@ def regnet_x_400mf(*, weights: Optional[RegNet_X_400MF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_X_800MF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_X_800MF_Weights.IMAGENET1K_V1)) def regnet_x_800mf(*, weights: Optional[RegNet_X_800MF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_X_800MF_Weights.verify(weights) @@ -535,7 +535,7 @@ def regnet_x_800mf(*, weights: Optional[RegNet_X_800MF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_X_1_6GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_X_1_6GF_Weights.IMAGENET1K_V1)) def regnet_x_1_6gf(*, weights: Optional[RegNet_X_1_6GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_X_1_6GF_Weights.verify(weights) @@ -543,7 +543,7 @@ def regnet_x_1_6gf(*, weights: Optional[RegNet_X_1_6GF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_X_3_2GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_X_3_2GF_Weights.IMAGENET1K_V1)) def regnet_x_3_2gf(*, weights: Optional[RegNet_X_3_2GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_X_3_2GF_Weights.verify(weights) @@ -551,7 +551,7 @@ def regnet_x_3_2gf(*, weights: Optional[RegNet_X_3_2GF_Weights] = None, progress return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_X_8GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_X_8GF_Weights.IMAGENET1K_V1)) def regnet_x_8gf(*, weights: Optional[RegNet_X_8GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_X_8GF_Weights.verify(weights) @@ -559,7 +559,7 @@ def regnet_x_8gf(*, weights: Optional[RegNet_X_8GF_Weights] = None, progress: bo return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_X_16GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_X_16GF_Weights.IMAGENET1K_V1)) def regnet_x_16gf(*, weights: Optional[RegNet_X_16GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_X_16GF_Weights.verify(weights) @@ -567,7 +567,7 @@ def regnet_x_16gf(*, weights: Optional[RegNet_X_16GF_Weights] = None, progress: return _regnet(params, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", RegNet_X_32GF_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", RegNet_X_32GF_Weights.IMAGENET1K_V1)) def regnet_x_32gf(*, weights: Optional[RegNet_X_32GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet: weights = RegNet_X_32GF_Weights.verify(weights) diff --git a/torchvision/prototype/models/resnet.py b/torchvision/prototype/models/resnet.py index e9a3552f3db..e44b6df0367 100644 --- a/torchvision/prototype/models/resnet.py +++ b/torchvision/prototype/models/resnet.py @@ -61,7 +61,7 @@ def _resnet( class ResNet18_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/resnet18-f37072fd.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -74,11 +74,11 @@ class ResNet18_Weights(WeightsEnum): "acc@5": 89.078, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class ResNet34_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/resnet34-b627a593.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -91,11 +91,11 @@ class ResNet34_Weights(WeightsEnum): "acc@5": 91.420, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class ResNet50_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/resnet50-0676ba61.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -108,7 +108,7 @@ class ResNet50_Weights(WeightsEnum): "acc@5": 92.862, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/resnet50-11ad3fa6.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -121,11 +121,11 @@ class ResNet50_Weights(WeightsEnum): "acc@5": 95.434, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class ResNet101_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/resnet101-63fe2227.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -138,7 +138,7 @@ class ResNet101_Weights(WeightsEnum): "acc@5": 93.546, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/resnet101-cd907fc2.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -151,11 +151,11 @@ class ResNet101_Weights(WeightsEnum): "acc@5": 95.780, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class ResNet152_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/resnet152-394f9c45.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -168,7 +168,7 @@ class ResNet152_Weights(WeightsEnum): "acc@5": 94.046, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/resnet152-f82ba261.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -181,11 +181,11 @@ class ResNet152_Weights(WeightsEnum): "acc@5": 96.002, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class ResNeXt50_32X4D_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -198,7 +198,7 @@ class ResNeXt50_32X4D_Weights(WeightsEnum): "acc@5": 93.698, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/resnext50_32x4d-1a0047aa.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -211,11 +211,11 @@ class ResNeXt50_32X4D_Weights(WeightsEnum): "acc@5": 95.340, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class ResNeXt101_32X8D_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -228,7 +228,7 @@ class ResNeXt101_32X8D_Weights(WeightsEnum): "acc@5": 94.526, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/resnext101_32x8d-110c445d.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -241,11 +241,11 @@ class ResNeXt101_32X8D_Weights(WeightsEnum): "acc@5": 96.228, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class Wide_ResNet50_2_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/wide_resnet50_2-95faca4d.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -258,7 +258,7 @@ class Wide_ResNet50_2_Weights(WeightsEnum): "acc@5": 94.086, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/wide_resnet50_2-9ba9bcbe.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -271,11 +271,11 @@ class Wide_ResNet50_2_Weights(WeightsEnum): "acc@5": 95.758, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 class Wide_ResNet101_2_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/wide_resnet101_2-32ee1156.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -288,7 +288,7 @@ class Wide_ResNet101_2_Weights(WeightsEnum): "acc@5": 94.284, }, ) - ImageNet1K_V2 = Weights( + IMAGENET1K_V2 = Weights( url="https://download.pytorch.org/models/wide_resnet101_2-d733dc28.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=232), meta={ @@ -301,45 +301,45 @@ class Wide_ResNet101_2_Weights(WeightsEnum): "acc@5": 96.020, }, ) - default = ImageNet1K_V2 + default = IMAGENET1K_V2 -@handle_legacy_interface(weights=("pretrained", ResNet18_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ResNet18_Weights.IMAGENET1K_V1)) def resnet18(*, weights: Optional[ResNet18_Weights] = None, progress: bool = True, **kwargs: Any) -> ResNet: weights = ResNet18_Weights.verify(weights) return _resnet(BasicBlock, [2, 2, 2, 2], weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", ResNet34_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ResNet34_Weights.IMAGENET1K_V1)) def resnet34(*, weights: Optional[ResNet34_Weights] = None, progress: bool = True, **kwargs: Any) -> ResNet: weights = ResNet34_Weights.verify(weights) return _resnet(BasicBlock, [3, 4, 6, 3], weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", ResNet50_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ResNet50_Weights.IMAGENET1K_V1)) def resnet50(*, weights: Optional[ResNet50_Weights] = None, progress: bool = True, **kwargs: Any) -> ResNet: weights = ResNet50_Weights.verify(weights) return _resnet(Bottleneck, [3, 4, 6, 3], weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", ResNet101_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ResNet101_Weights.IMAGENET1K_V1)) def resnet101(*, weights: Optional[ResNet101_Weights] = None, progress: bool = True, **kwargs: Any) -> ResNet: weights = ResNet101_Weights.verify(weights) return _resnet(Bottleneck, [3, 4, 23, 3], weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", ResNet152_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ResNet152_Weights.IMAGENET1K_V1)) def resnet152(*, weights: Optional[ResNet152_Weights] = None, progress: bool = True, **kwargs: Any) -> ResNet: weights = ResNet152_Weights.verify(weights) return _resnet(Bottleneck, [3, 8, 36, 3], weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", ResNeXt50_32X4D_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ResNeXt50_32X4D_Weights.IMAGENET1K_V1)) def resnext50_32x4d( *, weights: Optional[ResNeXt50_32X4D_Weights] = None, progress: bool = True, **kwargs: Any ) -> ResNet: @@ -350,7 +350,7 @@ def resnext50_32x4d( return _resnet(Bottleneck, [3, 4, 6, 3], weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", ResNeXt101_32X8D_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ResNeXt101_32X8D_Weights.IMAGENET1K_V1)) def resnext101_32x8d( *, weights: Optional[ResNeXt101_32X8D_Weights] = None, progress: bool = True, **kwargs: Any ) -> ResNet: @@ -361,7 +361,7 @@ def resnext101_32x8d( return _resnet(Bottleneck, [3, 4, 23, 3], weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", Wide_ResNet50_2_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", Wide_ResNet50_2_Weights.IMAGENET1K_V1)) def wide_resnet50_2( *, weights: Optional[Wide_ResNet50_2_Weights] = None, progress: bool = True, **kwargs: Any ) -> ResNet: @@ -371,7 +371,7 @@ def wide_resnet50_2( return _resnet(Bottleneck, [3, 4, 6, 3], weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", Wide_ResNet101_2_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", Wide_ResNet101_2_Weights.IMAGENET1K_V1)) def wide_resnet101_2( *, weights: Optional[Wide_ResNet101_2_Weights] = None, progress: bool = True, **kwargs: Any ) -> ResNet: diff --git a/torchvision/prototype/models/segmentation/deeplabv3.py b/torchvision/prototype/models/segmentation/deeplabv3.py index 778b5b96ec7..fa680237eee 100644 --- a/torchvision/prototype/models/segmentation/deeplabv3.py +++ b/torchvision/prototype/models/segmentation/deeplabv3.py @@ -80,7 +80,7 @@ class DeepLabV3_MobileNet_V3_Large_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", DeepLabV3_ResNet50_Weights.CocoWithVocLabels_V1), - weights_backbone=("pretrained_backbone", ResNet50_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def deeplabv3_resnet50( *, @@ -112,7 +112,7 @@ def deeplabv3_resnet50( @handle_legacy_interface( weights=("pretrained", DeepLabV3_ResNet101_Weights.CocoWithVocLabels_V1), - weights_backbone=("pretrained_backbone", ResNet101_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet101_Weights.IMAGENET1K_V1), ) def deeplabv3_resnet101( *, @@ -144,7 +144,7 @@ def deeplabv3_resnet101( @handle_legacy_interface( weights=("pretrained", DeepLabV3_MobileNet_V3_Large_Weights.CocoWithVocLabels_V1), - weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def deeplabv3_mobilenet_v3_large( *, diff --git a/torchvision/prototype/models/segmentation/fcn.py b/torchvision/prototype/models/segmentation/fcn.py index b123aafe959..9690ae4a471 100644 --- a/torchvision/prototype/models/segmentation/fcn.py +++ b/torchvision/prototype/models/segmentation/fcn.py @@ -55,7 +55,7 @@ class FCN_ResNet101_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", FCN_ResNet50_Weights.CocoWithVocLabels_V1), - weights_backbone=("pretrained_backbone", ResNet50_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def fcn_resnet50( *, @@ -87,7 +87,7 @@ def fcn_resnet50( @handle_legacy_interface( weights=("pretrained", FCN_ResNet101_Weights.CocoWithVocLabels_V1), - weights_backbone=("pretrained_backbone", ResNet101_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", ResNet101_Weights.IMAGENET1K_V1), ) def fcn_resnet101( *, diff --git a/torchvision/prototype/models/segmentation/lraspp.py b/torchvision/prototype/models/segmentation/lraspp.py index aebd585d112..f89a4cfdebb 100644 --- a/torchvision/prototype/models/segmentation/lraspp.py +++ b/torchvision/prototype/models/segmentation/lraspp.py @@ -35,7 +35,7 @@ class LRASPP_MobileNet_V3_Large_Weights(WeightsEnum): @handle_legacy_interface( weights=("pretrained", LRASPP_MobileNet_V3_Large_Weights.CocoWithVocLabels_V1), - weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.ImageNet1K_V1), + weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def lraspp_mobilenet_v3_large( *, diff --git a/torchvision/prototype/models/shufflenetv2.py b/torchvision/prototype/models/shufflenetv2.py index f256c4f805e..9589345a052 100644 --- a/torchvision/prototype/models/shufflenetv2.py +++ b/torchvision/prototype/models/shufflenetv2.py @@ -53,7 +53,7 @@ def _shufflenetv2( class ShuffleNet_V2_X0_5_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/shufflenetv2_x0.5-f707e7126e.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -63,11 +63,11 @@ class ShuffleNet_V2_X0_5_Weights(WeightsEnum): "acc@5": 88.316, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class ShuffleNet_V2_X1_0_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -77,7 +77,7 @@ class ShuffleNet_V2_X1_0_Weights(WeightsEnum): "acc@5": 81.746, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class ShuffleNet_V2_X1_5_Weights(WeightsEnum): @@ -88,7 +88,7 @@ class ShuffleNet_V2_X2_0_Weights(WeightsEnum): pass -@handle_legacy_interface(weights=("pretrained", ShuffleNet_V2_X0_5_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ShuffleNet_V2_X0_5_Weights.IMAGENET1K_V1)) def shufflenet_v2_x0_5( *, weights: Optional[ShuffleNet_V2_X0_5_Weights] = None, progress: bool = True, **kwargs: Any ) -> ShuffleNetV2: @@ -97,7 +97,7 @@ def shufflenet_v2_x0_5( return _shufflenetv2(weights, progress, [4, 8, 4], [24, 48, 96, 192, 1024], **kwargs) -@handle_legacy_interface(weights=("pretrained", ShuffleNet_V2_X1_0_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ShuffleNet_V2_X1_0_Weights.IMAGENET1K_V1)) def shufflenet_v2_x1_0( *, weights: Optional[ShuffleNet_V2_X1_0_Weights] = None, progress: bool = True, **kwargs: Any ) -> ShuffleNetV2: diff --git a/torchvision/prototype/models/squeezenet.py b/torchvision/prototype/models/squeezenet.py index 3510bd137d0..8b6382616dd 100644 --- a/torchvision/prototype/models/squeezenet.py +++ b/torchvision/prototype/models/squeezenet.py @@ -25,7 +25,7 @@ class SqueezeNet1_0_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/squeezenet1_0-b66bff10.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -36,11 +36,11 @@ class SqueezeNet1_0_Weights(WeightsEnum): "acc@5": 80.420, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class SqueezeNet1_1_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/squeezenet1_1-b8a52dc0.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -51,10 +51,10 @@ class SqueezeNet1_1_Weights(WeightsEnum): "acc@5": 80.624, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", SqueezeNet1_0_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", SqueezeNet1_0_Weights.IMAGENET1K_V1)) def squeezenet1_0( *, weights: Optional[SqueezeNet1_0_Weights] = None, progress: bool = True, **kwargs: Any ) -> SqueezeNet: @@ -71,7 +71,7 @@ def squeezenet1_0( return model -@handle_legacy_interface(weights=("pretrained", SqueezeNet1_1_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", SqueezeNet1_1_Weights.IMAGENET1K_V1)) def squeezenet1_1( *, weights: Optional[SqueezeNet1_1_Weights] = None, progress: bool = True, **kwargs: Any ) -> SqueezeNet: diff --git a/torchvision/prototype/models/vgg.py b/torchvision/prototype/models/vgg.py index e3fd323deef..ff8623e3d23 100644 --- a/torchvision/prototype/models/vgg.py +++ b/torchvision/prototype/models/vgg.py @@ -53,7 +53,7 @@ def _vgg(cfg: str, batch_norm: bool, weights: Optional[WeightsEnum], progress: b class VGG11_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vgg11-8a719046.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -63,11 +63,11 @@ class VGG11_Weights(WeightsEnum): "acc@5": 88.628, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class VGG11_BN_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vgg11_bn-6002323d.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -77,11 +77,11 @@ class VGG11_BN_Weights(WeightsEnum): "acc@5": 89.810, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class VGG13_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vgg13-19584684.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -91,11 +91,11 @@ class VGG13_Weights(WeightsEnum): "acc@5": 89.246, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class VGG13_BN_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vgg13_bn-abd245e5.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -105,11 +105,11 @@ class VGG13_BN_Weights(WeightsEnum): "acc@5": 90.374, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class VGG16_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vgg16-397923af.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -122,7 +122,7 @@ class VGG16_Weights(WeightsEnum): # We port the features of a VGG16 backbone trained by amdegroot because unlike the one on TorchVision, it uses the # same input standardization method as the paper. Only the `features` weights have proper values, those on the # `classifier` module are filled with nans. - ImageNet1K_Features = Weights( + IMAGENET1K_FEATURES = Weights( url="https://download.pytorch.org/models/vgg16_features-amdegroot-88682ab5.pth", transforms=partial( ImageNetEval, crop_size=224, mean=(0.48235, 0.45882, 0.40784), std=(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0) @@ -136,11 +136,11 @@ class VGG16_Weights(WeightsEnum): "acc@5": float("nan"), }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class VGG16_BN_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vgg16_bn-6c64b313.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -150,11 +150,11 @@ class VGG16_BN_Weights(WeightsEnum): "acc@5": 91.516, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class VGG19_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vgg19-dcbb9e9d.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -164,11 +164,11 @@ class VGG19_Weights(WeightsEnum): "acc@5": 90.876, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class VGG19_BN_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vgg19_bn-c79401a0.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -178,59 +178,59 @@ class VGG19_BN_Weights(WeightsEnum): "acc@5": 91.842, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 -@handle_legacy_interface(weights=("pretrained", VGG11_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", VGG11_Weights.IMAGENET1K_V1)) def vgg11(*, weights: Optional[VGG11_Weights] = None, progress: bool = True, **kwargs: Any) -> VGG: weights = VGG11_Weights.verify(weights) return _vgg("A", False, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", VGG11_BN_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", VGG11_BN_Weights.IMAGENET1K_V1)) def vgg11_bn(*, weights: Optional[VGG11_BN_Weights] = None, progress: bool = True, **kwargs: Any) -> VGG: weights = VGG11_BN_Weights.verify(weights) return _vgg("A", True, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", VGG13_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", VGG13_Weights.IMAGENET1K_V1)) def vgg13(*, weights: Optional[VGG13_Weights] = None, progress: bool = True, **kwargs: Any) -> VGG: weights = VGG13_Weights.verify(weights) return _vgg("B", False, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", VGG13_BN_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", VGG13_BN_Weights.IMAGENET1K_V1)) def vgg13_bn(*, weights: Optional[VGG13_BN_Weights] = None, progress: bool = True, **kwargs: Any) -> VGG: weights = VGG13_BN_Weights.verify(weights) return _vgg("B", True, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", VGG16_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", VGG16_Weights.IMAGENET1K_V1)) def vgg16(*, weights: Optional[VGG16_Weights] = None, progress: bool = True, **kwargs: Any) -> VGG: weights = VGG16_Weights.verify(weights) return _vgg("D", False, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", VGG16_BN_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", VGG16_BN_Weights.IMAGENET1K_V1)) def vgg16_bn(*, weights: Optional[VGG16_BN_Weights] = None, progress: bool = True, **kwargs: Any) -> VGG: weights = VGG16_BN_Weights.verify(weights) return _vgg("D", True, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", VGG19_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", VGG19_Weights.IMAGENET1K_V1)) def vgg19(*, weights: Optional[VGG19_Weights] = None, progress: bool = True, **kwargs: Any) -> VGG: weights = VGG19_Weights.verify(weights) return _vgg("E", False, weights, progress, **kwargs) -@handle_legacy_interface(weights=("pretrained", VGG19_BN_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", VGG19_BN_Weights.IMAGENET1K_V1)) def vgg19_bn(*, weights: Optional[VGG19_BN_Weights] = None, progress: bool = True, **kwargs: Any) -> VGG: weights = VGG19_BN_Weights.verify(weights) diff --git a/torchvision/prototype/models/vision_transformer.py b/torchvision/prototype/models/vision_transformer.py index 72330fd1191..73955785c90 100644 --- a/torchvision/prototype/models/vision_transformer.py +++ b/torchvision/prototype/models/vision_transformer.py @@ -38,7 +38,7 @@ class ViT_B_16_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vit_b_16-c867db91.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -51,11 +51,11 @@ class ViT_B_16_Weights(WeightsEnum): "acc@5": 95.318, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class ViT_B_32_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vit_b_32-d86f8d99.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -68,11 +68,11 @@ class ViT_B_32_Weights(WeightsEnum): "acc@5": 92.466, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class ViT_L_16_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vit_l_16-852ce7e3.pth", transforms=partial(ImageNetEval, crop_size=224, resize_size=242), meta={ @@ -85,11 +85,11 @@ class ViT_L_16_Weights(WeightsEnum): "acc@5": 94.638, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class ViT_L_32_Weights(WeightsEnum): - ImageNet1K_V1 = Weights( + IMAGENET1K_V1 = Weights( url="https://download.pytorch.org/models/vit_l_32-c7638314.pth", transforms=partial(ImageNetEval, crop_size=224), meta={ @@ -102,7 +102,7 @@ class ViT_L_32_Weights(WeightsEnum): "acc@5": 93.07, }, ) - default = ImageNet1K_V1 + default = IMAGENET1K_V1 class ViT_H_14_Weights(WeightsEnum): @@ -141,7 +141,7 @@ def _vision_transformer( return model -@handle_legacy_interface(weights=("pretrained", ViT_B_16_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ViT_B_16_Weights.IMAGENET1K_V1)) def vit_b_16(*, weights: Optional[ViT_B_16_Weights] = None, progress: bool = True, **kwargs: Any) -> VisionTransformer: weights = ViT_B_16_Weights.verify(weights) @@ -157,7 +157,7 @@ def vit_b_16(*, weights: Optional[ViT_B_16_Weights] = None, progress: bool = Tru ) -@handle_legacy_interface(weights=("pretrained", ViT_B_32_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ViT_B_32_Weights.IMAGENET1K_V1)) def vit_b_32(*, weights: Optional[ViT_B_32_Weights] = None, progress: bool = True, **kwargs: Any) -> VisionTransformer: weights = ViT_B_32_Weights.verify(weights) @@ -173,7 +173,7 @@ def vit_b_32(*, weights: Optional[ViT_B_32_Weights] = None, progress: bool = Tru ) -@handle_legacy_interface(weights=("pretrained", ViT_L_16_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ViT_L_16_Weights.IMAGENET1K_V1)) def vit_l_16(*, weights: Optional[ViT_L_16_Weights] = None, progress: bool = True, **kwargs: Any) -> VisionTransformer: weights = ViT_L_16_Weights.verify(weights) @@ -189,7 +189,7 @@ def vit_l_16(*, weights: Optional[ViT_L_16_Weights] = None, progress: bool = Tru ) -@handle_legacy_interface(weights=("pretrained", ViT_L_32_Weights.ImageNet1K_V1)) +@handle_legacy_interface(weights=("pretrained", ViT_L_32_Weights.IMAGENET1K_V1)) def vit_l_32(*, weights: Optional[ViT_L_32_Weights] = None, progress: bool = True, **kwargs: Any) -> VisionTransformer: weights = ViT_L_32_Weights.verify(weights) From e17da80493388e0b7be19cb4e2e3a6a70c69bd27 Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Fri, 21 Jan 2022 16:45:25 -0800 Subject: [PATCH 02/13] renamed COCO weights --- .../prototype/models/detection/faster_rcnn.py | 20 +++++++++---------- .../models/detection/keypoint_rcnn.py | 12 +++++------ .../prototype/models/detection/mask_rcnn.py | 8 ++++---- .../prototype/models/detection/retinanet.py | 8 ++++---- torchvision/prototype/models/detection/ssd.py | 6 +++--- .../prototype/models/detection/ssdlite.py | 6 +++--- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/torchvision/prototype/models/detection/faster_rcnn.py b/torchvision/prototype/models/detection/faster_rcnn.py index 657d2b31733..828c37975b8 100644 --- a/torchvision/prototype/models/detection/faster_rcnn.py +++ b/torchvision/prototype/models/detection/faster_rcnn.py @@ -40,7 +40,7 @@ class FasterRCNN_ResNet50_FPN_Weights(WeightsEnum): - Coco_V1 = Weights( + COCO_V1 = Weights( url="https://download.pytorch.org/models/fasterrcnn_resnet50_fpn_coco-258fb6c6.pth", transforms=CocoEval, meta={ @@ -50,11 +50,11 @@ class FasterRCNN_ResNet50_FPN_Weights(WeightsEnum): "map": 37.0, }, ) - default = Coco_V1 + default = COCO_V1 class FasterRCNN_MobileNet_V3_Large_FPN_Weights(WeightsEnum): - Coco_V1 = Weights( + COCO_V1 = Weights( url="https://download.pytorch.org/models/fasterrcnn_mobilenet_v3_large_fpn-fb6a3cc7.pth", transforms=CocoEval, meta={ @@ -64,11 +64,11 @@ class FasterRCNN_MobileNet_V3_Large_FPN_Weights(WeightsEnum): "map": 32.8, }, ) - default = Coco_V1 + default = COCO_V1 class FasterRCNN_MobileNet_V3_Large_320_FPN_Weights(WeightsEnum): - Coco_V1 = Weights( + COCO_V1 = Weights( url="https://download.pytorch.org/models/fasterrcnn_mobilenet_v3_large_320_fpn-907ea3f9.pth", transforms=CocoEval, meta={ @@ -78,11 +78,11 @@ class FasterRCNN_MobileNet_V3_Large_320_FPN_Weights(WeightsEnum): "map": 22.8, }, ) - default = Coco_V1 + default = COCO_V1 @handle_legacy_interface( - weights=("pretrained", FasterRCNN_ResNet50_FPN_Weights.Coco_V1), + weights=("pretrained", FasterRCNN_ResNet50_FPN_Weights.COCO_V1), weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def fasterrcnn_resnet50_fpn( @@ -113,7 +113,7 @@ def fasterrcnn_resnet50_fpn( if weights is not None: model.load_state_dict(weights.get_state_dict(progress=progress)) - if weights == FasterRCNN_ResNet50_FPN_Weights.Coco_V1: + if weights == FasterRCNN_ResNet50_FPN_Weights.COCO_V1: overwrite_eps(model, 0.0) return model @@ -161,7 +161,7 @@ def _fasterrcnn_mobilenet_v3_large_fpn( @handle_legacy_interface( - weights=("pretrained", FasterRCNN_MobileNet_V3_Large_FPN_Weights.Coco_V1), + weights=("pretrained", FasterRCNN_MobileNet_V3_Large_FPN_Weights.COCO_V1), weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def fasterrcnn_mobilenet_v3_large_fpn( @@ -192,7 +192,7 @@ def fasterrcnn_mobilenet_v3_large_fpn( @handle_legacy_interface( - weights=("pretrained", FasterRCNN_MobileNet_V3_Large_320_FPN_Weights.Coco_V1), + weights=("pretrained", FasterRCNN_MobileNet_V3_Large_320_FPN_Weights.COCO_V1), weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def fasterrcnn_mobilenet_v3_large_320_fpn( diff --git a/torchvision/prototype/models/detection/keypoint_rcnn.py b/torchvision/prototype/models/detection/keypoint_rcnn.py index c0acdd47d63..60817b533a3 100644 --- a/torchvision/prototype/models/detection/keypoint_rcnn.py +++ b/torchvision/prototype/models/detection/keypoint_rcnn.py @@ -34,7 +34,7 @@ class KeypointRCNN_ResNet50_FPN_Weights(WeightsEnum): - Coco_Legacy = Weights( + COCO_LEGACY = Weights( url="https://download.pytorch.org/models/keypointrcnn_resnet50_fpn_coco-9f466800.pth", transforms=CocoEval, meta={ @@ -45,7 +45,7 @@ class KeypointRCNN_ResNet50_FPN_Weights(WeightsEnum): "map_kp": 61.1, }, ) - Coco_V1 = Weights( + COCO_V1 = Weights( url="https://download.pytorch.org/models/keypointrcnn_resnet50_fpn_coco-fc266e95.pth", transforms=CocoEval, meta={ @@ -56,15 +56,15 @@ class KeypointRCNN_ResNet50_FPN_Weights(WeightsEnum): "map_kp": 65.0, }, ) - default = Coco_V1 + default = COCO_V1 @handle_legacy_interface( weights=( "pretrained", - lambda kwargs: KeypointRCNN_ResNet50_FPN_Weights.Coco_Legacy + lambda kwargs: KeypointRCNN_ResNet50_FPN_Weights.COCO_LEGACY if kwargs["pretrained"] == "legacy" - else KeypointRCNN_ResNet50_FPN_Weights.Coco_V1, + else KeypointRCNN_ResNet50_FPN_Weights.COCO_V1, ), weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) @@ -101,7 +101,7 @@ def keypointrcnn_resnet50_fpn( if weights is not None: model.load_state_dict(weights.get_state_dict(progress=progress)) - if weights == KeypointRCNN_ResNet50_FPN_Weights.Coco_V1: + if weights == KeypointRCNN_ResNet50_FPN_Weights.COCO_V1: overwrite_eps(model, 0.0) return model diff --git a/torchvision/prototype/models/detection/mask_rcnn.py b/torchvision/prototype/models/detection/mask_rcnn.py index 107d9f14068..b6b71f0d9dc 100644 --- a/torchvision/prototype/models/detection/mask_rcnn.py +++ b/torchvision/prototype/models/detection/mask_rcnn.py @@ -24,7 +24,7 @@ class MaskRCNN_ResNet50_FPN_Weights(WeightsEnum): - Coco_V1 = Weights( + COCO_V1 = Weights( url="https://download.pytorch.org/models/maskrcnn_resnet50_fpn_coco-bf2d0c1e.pth", transforms=CocoEval, meta={ @@ -39,11 +39,11 @@ class MaskRCNN_ResNet50_FPN_Weights(WeightsEnum): "map_mask": 34.6, }, ) - default = Coco_V1 + default = COCO_V1 @handle_legacy_interface( - weights=("pretrained", MaskRCNN_ResNet50_FPN_Weights.Coco_V1), + weights=("pretrained", MaskRCNN_ResNet50_FPN_Weights.COCO_V1), weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def maskrcnn_resnet50_fpn( @@ -74,7 +74,7 @@ def maskrcnn_resnet50_fpn( if weights is not None: model.load_state_dict(weights.get_state_dict(progress=progress)) - if weights == MaskRCNN_ResNet50_FPN_Weights.Coco_V1: + if weights == MaskRCNN_ResNet50_FPN_Weights.COCO_V1: overwrite_eps(model, 0.0) return model diff --git a/torchvision/prototype/models/detection/retinanet.py b/torchvision/prototype/models/detection/retinanet.py index 6ed07355528..b1a770ba7a7 100644 --- a/torchvision/prototype/models/detection/retinanet.py +++ b/torchvision/prototype/models/detection/retinanet.py @@ -25,7 +25,7 @@ class RetinaNet_ResNet50_FPN_Weights(WeightsEnum): - Coco_V1 = Weights( + COCO_V1 = Weights( url="https://download.pytorch.org/models/retinanet_resnet50_fpn_coco-eeacb38b.pth", transforms=CocoEval, meta={ @@ -39,11 +39,11 @@ class RetinaNet_ResNet50_FPN_Weights(WeightsEnum): "map": 36.4, }, ) - default = Coco_V1 + default = COCO_V1 @handle_legacy_interface( - weights=("pretrained", RetinaNet_ResNet50_FPN_Weights.Coco_V1), + weights=("pretrained", RetinaNet_ResNet50_FPN_Weights.COCO_V1), weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def retinanet_resnet50_fpn( @@ -77,7 +77,7 @@ def retinanet_resnet50_fpn( if weights is not None: model.load_state_dict(weights.get_state_dict(progress=progress)) - if weights == RetinaNet_ResNet50_FPN_Weights.Coco_V1: + if weights == RetinaNet_ResNet50_FPN_Weights.COCO_V1: overwrite_eps(model, 0.0) return model diff --git a/torchvision/prototype/models/detection/ssd.py b/torchvision/prototype/models/detection/ssd.py index 12eed9139f9..b88cd81ca1a 100644 --- a/torchvision/prototype/models/detection/ssd.py +++ b/torchvision/prototype/models/detection/ssd.py @@ -23,7 +23,7 @@ class SSD300_VGG16_Weights(WeightsEnum): - Coco_V1 = Weights( + COCO_V1 = Weights( url="https://download.pytorch.org/models/ssd300_vgg16_coco-b556d3b4.pth", transforms=CocoEval, meta={ @@ -38,11 +38,11 @@ class SSD300_VGG16_Weights(WeightsEnum): "map": 25.1, }, ) - default = Coco_V1 + default = COCO_V1 @handle_legacy_interface( - weights=("pretrained", SSD300_VGG16_Weights.Coco_V1), + weights=("pretrained", SSD300_VGG16_Weights.COCO_V1), weights_backbone=("pretrained_backbone", VGG16_Weights.IMAGENET1K_FEATURES), ) def ssd300_vgg16( diff --git a/torchvision/prototype/models/detection/ssdlite.py b/torchvision/prototype/models/detection/ssdlite.py index e082e6f4a54..4fa43bedbf8 100644 --- a/torchvision/prototype/models/detection/ssdlite.py +++ b/torchvision/prototype/models/detection/ssdlite.py @@ -28,7 +28,7 @@ class SSDLite320_MobileNet_V3_Large_Weights(WeightsEnum): - Coco_V1 = Weights( + COCO_V1 = Weights( url="https://download.pytorch.org/models/ssdlite320_mobilenet_v3_large_coco-a79551df.pth", transforms=CocoEval, meta={ @@ -43,11 +43,11 @@ class SSDLite320_MobileNet_V3_Large_Weights(WeightsEnum): "map": 21.3, }, ) - default = Coco_V1 + default = COCO_V1 @handle_legacy_interface( - weights=("pretrained", SSDLite320_MobileNet_V3_Large_Weights.Coco_V1), + weights=("pretrained", SSDLite320_MobileNet_V3_Large_Weights.COCO_V1), weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def ssdlite320_mobilenet_v3_large( From c47e7897987f8660d817120666153d3d623891eb Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Fri, 21 Jan 2022 16:47:09 -0800 Subject: [PATCH 03/13] renamed COCO with VOC labels weights --- .../prototype/models/segmentation/deeplabv3.py | 18 +++++++++--------- .../prototype/models/segmentation/fcn.py | 12 ++++++------ .../prototype/models/segmentation/lraspp.py | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/torchvision/prototype/models/segmentation/deeplabv3.py b/torchvision/prototype/models/segmentation/deeplabv3.py index fa680237eee..18ca4ae8eeb 100644 --- a/torchvision/prototype/models/segmentation/deeplabv3.py +++ b/torchvision/prototype/models/segmentation/deeplabv3.py @@ -34,7 +34,7 @@ class DeepLabV3_ResNet50_Weights(WeightsEnum): - CocoWithVocLabels_V1 = Weights( + COCO_WITH_VOC_LABELS_V1 = Weights( url="https://download.pytorch.org/models/deeplabv3_resnet50_coco-cd0a2569.pth", transforms=partial(VocEval, resize_size=520), meta={ @@ -45,11 +45,11 @@ class DeepLabV3_ResNet50_Weights(WeightsEnum): "acc": 92.4, }, ) - default = CocoWithVocLabels_V1 + default = COCO_WITH_VOC_LABELS_V1 class DeepLabV3_ResNet101_Weights(WeightsEnum): - CocoWithVocLabels_V1 = Weights( + COCO_WITH_VOC_LABELS_V1 = Weights( url="https://download.pytorch.org/models/deeplabv3_resnet101_coco-586e9e4e.pth", transforms=partial(VocEval, resize_size=520), meta={ @@ -60,11 +60,11 @@ class DeepLabV3_ResNet101_Weights(WeightsEnum): "acc": 92.4, }, ) - default = CocoWithVocLabels_V1 + default = COCO_WITH_VOC_LABELS_V1 class DeepLabV3_MobileNet_V3_Large_Weights(WeightsEnum): - CocoWithVocLabels_V1 = Weights( + COCO_WITH_VOC_LABELS_V1 = Weights( url="https://download.pytorch.org/models/deeplabv3_mobilenet_v3_large-fc3c493d.pth", transforms=partial(VocEval, resize_size=520), meta={ @@ -75,11 +75,11 @@ class DeepLabV3_MobileNet_V3_Large_Weights(WeightsEnum): "acc": 91.2, }, ) - default = CocoWithVocLabels_V1 + default = COCO_WITH_VOC_LABELS_V1 @handle_legacy_interface( - weights=("pretrained", DeepLabV3_ResNet50_Weights.CocoWithVocLabels_V1), + weights=("pretrained", DeepLabV3_ResNet50_Weights.COCO_WITH_VOC_LABELS_V1), weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def deeplabv3_resnet50( @@ -111,7 +111,7 @@ def deeplabv3_resnet50( @handle_legacy_interface( - weights=("pretrained", DeepLabV3_ResNet101_Weights.CocoWithVocLabels_V1), + weights=("pretrained", DeepLabV3_ResNet101_Weights.COCO_WITH_VOC_LABELS_V1), weights_backbone=("pretrained_backbone", ResNet101_Weights.IMAGENET1K_V1), ) def deeplabv3_resnet101( @@ -143,7 +143,7 @@ def deeplabv3_resnet101( @handle_legacy_interface( - weights=("pretrained", DeepLabV3_MobileNet_V3_Large_Weights.CocoWithVocLabels_V1), + weights=("pretrained", DeepLabV3_MobileNet_V3_Large_Weights.COCO_WITH_VOC_LABELS_V1), weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def deeplabv3_mobilenet_v3_large( diff --git a/torchvision/prototype/models/segmentation/fcn.py b/torchvision/prototype/models/segmentation/fcn.py index 9690ae4a471..17af99c10c6 100644 --- a/torchvision/prototype/models/segmentation/fcn.py +++ b/torchvision/prototype/models/segmentation/fcn.py @@ -24,7 +24,7 @@ class FCN_ResNet50_Weights(WeightsEnum): - CocoWithVocLabels_V1 = Weights( + COCO_WITH_VOC_LABELS_V1 = Weights( url="https://download.pytorch.org/models/fcn_resnet50_coco-1167a1af.pth", transforms=partial(VocEval, resize_size=520), meta={ @@ -35,11 +35,11 @@ class FCN_ResNet50_Weights(WeightsEnum): "acc": 91.4, }, ) - default = CocoWithVocLabels_V1 + default = COCO_WITH_VOC_LABELS_V1 class FCN_ResNet101_Weights(WeightsEnum): - CocoWithVocLabels_V1 = Weights( + COCO_WITH_VOC_LABELS_V1 = Weights( url="https://download.pytorch.org/models/fcn_resnet101_coco-7ecb50ca.pth", transforms=partial(VocEval, resize_size=520), meta={ @@ -50,11 +50,11 @@ class FCN_ResNet101_Weights(WeightsEnum): "acc": 91.9, }, ) - default = CocoWithVocLabels_V1 + default = COCO_WITH_VOC_LABELS_V1 @handle_legacy_interface( - weights=("pretrained", FCN_ResNet50_Weights.CocoWithVocLabels_V1), + weights=("pretrained", FCN_ResNet50_Weights.COCO_WITH_VOC_LABELS_V1), weights_backbone=("pretrained_backbone", ResNet50_Weights.IMAGENET1K_V1), ) def fcn_resnet50( @@ -86,7 +86,7 @@ def fcn_resnet50( @handle_legacy_interface( - weights=("pretrained", FCN_ResNet101_Weights.CocoWithVocLabels_V1), + weights=("pretrained", FCN_ResNet101_Weights.COCO_WITH_VOC_LABELS_V1), weights_backbone=("pretrained_backbone", ResNet101_Weights.IMAGENET1K_V1), ) def fcn_resnet101( diff --git a/torchvision/prototype/models/segmentation/lraspp.py b/torchvision/prototype/models/segmentation/lraspp.py index f89a4cfdebb..ad1560ae508 100644 --- a/torchvision/prototype/models/segmentation/lraspp.py +++ b/torchvision/prototype/models/segmentation/lraspp.py @@ -15,7 +15,7 @@ class LRASPP_MobileNet_V3_Large_Weights(WeightsEnum): - CocoWithVocLabels_V1 = Weights( + COCO_WITH_VOC_LABELS_V1 = Weights( url="https://download.pytorch.org/models/lraspp_mobilenet_v3_large-d234d4ea.pth", transforms=partial(VocEval, resize_size=520), meta={ @@ -30,11 +30,11 @@ class LRASPP_MobileNet_V3_Large_Weights(WeightsEnum): "acc": 91.2, }, ) - default = CocoWithVocLabels_V1 + default = COCO_WITH_VOC_LABELS_V1 @handle_legacy_interface( - weights=("pretrained", LRASPP_MobileNet_V3_Large_Weights.CocoWithVocLabels_V1), + weights=("pretrained", LRASPP_MobileNet_V3_Large_Weights.COCO_WITH_VOC_LABELS_V1), weights_backbone=("pretrained_backbone", MobileNet_V3_Large_Weights.IMAGENET1K_V1), ) def lraspp_mobilenet_v3_large( From 505e812770668a2d83b25ca91113eff5b6d395a2 Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Fri, 21 Jan 2022 16:48:07 -0800 Subject: [PATCH 04/13] renamed Kinetics 400 weights --- torchvision/prototype/models/video/resnet.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/torchvision/prototype/models/video/resnet.py b/torchvision/prototype/models/video/resnet.py index e26762d6580..06ca4eaa211 100644 --- a/torchvision/prototype/models/video/resnet.py +++ b/torchvision/prototype/models/video/resnet.py @@ -63,7 +63,7 @@ def _video_resnet( class R3D_18_Weights(WeightsEnum): - Kinetics400_V1 = Weights( + KINETICS400_V1 = Weights( url="https://download.pytorch.org/models/r3d_18-b3b3357e.pth", transforms=partial(Kinect400Eval, crop_size=(112, 112), resize_size=(128, 171)), meta={ @@ -74,11 +74,11 @@ class R3D_18_Weights(WeightsEnum): "acc@5": 75.45, }, ) - default = Kinetics400_V1 + default = KINETICS400_V1 class MC3_18_Weights(WeightsEnum): - Kinetics400_V1 = Weights( + KINETICS400_V1 = Weights( url="https://download.pytorch.org/models/mc3_18-a90a0ba3.pth", transforms=partial(Kinect400Eval, crop_size=(112, 112), resize_size=(128, 171)), meta={ @@ -89,11 +89,11 @@ class MC3_18_Weights(WeightsEnum): "acc@5": 76.29, }, ) - default = Kinetics400_V1 + default = KINETICS400_V1 class R2Plus1D_18_Weights(WeightsEnum): - Kinetics400_V1 = Weights( + KINETICS400_V1 = Weights( url="https://download.pytorch.org/models/r2plus1d_18-91a641e6.pth", transforms=partial(Kinect400Eval, crop_size=(112, 112), resize_size=(128, 171)), meta={ @@ -104,10 +104,10 @@ class R2Plus1D_18_Weights(WeightsEnum): "acc@5": 78.81, }, ) - default = Kinetics400_V1 + default = KINETICS400_V1 -@handle_legacy_interface(weights=("pretrained", R3D_18_Weights.Kinetics400_V1)) +@handle_legacy_interface(weights=("pretrained", R3D_18_Weights.KINETICS400_V1)) def r3d_18(*, weights: Optional[R3D_18_Weights] = None, progress: bool = True, **kwargs: Any) -> VideoResNet: weights = R3D_18_Weights.verify(weights) @@ -122,7 +122,7 @@ def r3d_18(*, weights: Optional[R3D_18_Weights] = None, progress: bool = True, * ) -@handle_legacy_interface(weights=("pretrained", MC3_18_Weights.Kinetics400_V1)) +@handle_legacy_interface(weights=("pretrained", MC3_18_Weights.KINETICS400_V1)) def mc3_18(*, weights: Optional[MC3_18_Weights] = None, progress: bool = True, **kwargs: Any) -> VideoResNet: weights = MC3_18_Weights.verify(weights) @@ -137,7 +137,7 @@ def mc3_18(*, weights: Optional[MC3_18_Weights] = None, progress: bool = True, * ) -@handle_legacy_interface(weights=("pretrained", R2Plus1D_18_Weights.Kinetics400_V1)) +@handle_legacy_interface(weights=("pretrained", R2Plus1D_18_Weights.KINETICS400_V1)) def r2plus1d_18(*, weights: Optional[R2Plus1D_18_Weights] = None, progress: bool = True, **kwargs: Any) -> VideoResNet: weights = R2Plus1D_18_Weights.verify(weights) From e55fb61e9d1ddc44c8c49e38fef0b604a1bc75b8 Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Sat, 22 Jan 2022 14:28:48 -0800 Subject: [PATCH 05/13] rename default with DEFAULT --- torchvision/prototype/models/_utils.py | 2 +- torchvision/prototype/models/alexnet.py | 2 +- torchvision/prototype/models/convnext.py | 2 +- torchvision/prototype/models/densenet.py | 8 +++--- .../prototype/models/detection/faster_rcnn.py | 6 ++-- .../prototype/models/detection/fcos.py | 2 +- .../models/detection/keypoint_rcnn.py | 2 +- .../prototype/models/detection/mask_rcnn.py | 2 +- .../prototype/models/detection/retinanet.py | 2 +- torchvision/prototype/models/detection/ssd.py | 2 +- .../prototype/models/detection/ssdlite.py | 2 +- torchvision/prototype/models/efficientnet.py | 16 +++++------ torchvision/prototype/models/googlenet.py | 2 +- torchvision/prototype/models/inception.py | 2 +- torchvision/prototype/models/mnasnet.py | 4 +-- torchvision/prototype/models/mobilenetv2.py | 2 +- torchvision/prototype/models/mobilenetv3.py | 4 +-- .../prototype/models/optical_flow/raft.py | 4 +-- .../models/quantization/googlenet.py | 2 +- .../models/quantization/inception.py | 2 +- .../models/quantization/mobilenetv2.py | 2 +- .../models/quantization/mobilenetv3.py | 2 +- .../prototype/models/quantization/resnet.py | 6 ++-- .../models/quantization/shufflenetv2.py | 4 +-- torchvision/prototype/models/regnet.py | 28 +++++++++---------- torchvision/prototype/models/resnet.py | 18 ++++++------ .../models/segmentation/deeplabv3.py | 6 ++-- .../prototype/models/segmentation/fcn.py | 4 +-- .../prototype/models/segmentation/lraspp.py | 2 +- torchvision/prototype/models/shufflenetv2.py | 4 +-- torchvision/prototype/models/squeezenet.py | 4 +-- torchvision/prototype/models/vgg.py | 16 +++++------ torchvision/prototype/models/video/resnet.py | 6 ++-- .../prototype/models/vision_transformer.py | 8 +++--- 34 files changed, 90 insertions(+), 90 deletions(-) diff --git a/torchvision/prototype/models/_utils.py b/torchvision/prototype/models/_utils.py index d3d0d659668..cc9f7dcfc36 100644 --- a/torchvision/prototype/models/_utils.py +++ b/torchvision/prototype/models/_utils.py @@ -78,7 +78,7 @@ def inner_wrapper(*args: Any, **kwargs: Any) -> M: ) if pretrained_arg: msg = ( - f"{msg} You can also use `{weights_param}={type(default_weights_arg).__name__}.default` " + f"{msg} You can also use `{weights_param}={type(default_weights_arg).__name__}.DEFAULT` " f"to get the most up-to-date weights." ) warnings.warn(msg) diff --git a/torchvision/prototype/models/alexnet.py b/torchvision/prototype/models/alexnet.py index a6f2af81064..091205d0872 100644 --- a/torchvision/prototype/models/alexnet.py +++ b/torchvision/prototype/models/alexnet.py @@ -31,7 +31,7 @@ class AlexNet_Weights(WeightsEnum): "acc@5": 79.066, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", AlexNet_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/convnext.py b/torchvision/prototype/models/convnext.py index 800556ca8a2..7fb3026b4e0 100644 --- a/torchvision/prototype/models/convnext.py +++ b/torchvision/prototype/models/convnext.py @@ -195,7 +195,7 @@ class ConvNeXt_Tiny_Weights(WeightsEnum): "acc@5": 96.146, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", ConvNeXt_Tiny_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/densenet.py b/torchvision/prototype/models/densenet.py index 65cdc808c66..248f0977b3b 100644 --- a/torchvision/prototype/models/densenet.py +++ b/torchvision/prototype/models/densenet.py @@ -86,7 +86,7 @@ class DenseNet121_Weights(WeightsEnum): "acc@5": 91.972, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class DenseNet161_Weights(WeightsEnum): @@ -100,7 +100,7 @@ class DenseNet161_Weights(WeightsEnum): "acc@5": 93.560, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class DenseNet169_Weights(WeightsEnum): @@ -114,7 +114,7 @@ class DenseNet169_Weights(WeightsEnum): "acc@5": 92.806, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class DenseNet201_Weights(WeightsEnum): @@ -128,7 +128,7 @@ class DenseNet201_Weights(WeightsEnum): "acc@5": 93.370, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", DenseNet121_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/detection/faster_rcnn.py b/torchvision/prototype/models/detection/faster_rcnn.py index 828c37975b8..764cc3fe042 100644 --- a/torchvision/prototype/models/detection/faster_rcnn.py +++ b/torchvision/prototype/models/detection/faster_rcnn.py @@ -50,7 +50,7 @@ class FasterRCNN_ResNet50_FPN_Weights(WeightsEnum): "map": 37.0, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 class FasterRCNN_MobileNet_V3_Large_FPN_Weights(WeightsEnum): @@ -64,7 +64,7 @@ class FasterRCNN_MobileNet_V3_Large_FPN_Weights(WeightsEnum): "map": 32.8, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 class FasterRCNN_MobileNet_V3_Large_320_FPN_Weights(WeightsEnum): @@ -78,7 +78,7 @@ class FasterRCNN_MobileNet_V3_Large_320_FPN_Weights(WeightsEnum): "map": 22.8, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/detection/fcos.py b/torchvision/prototype/models/detection/fcos.py index c99a4089f9a..cf3007290a8 100644 --- a/torchvision/prototype/models/detection/fcos.py +++ b/torchvision/prototype/models/detection/fcos.py @@ -38,7 +38,7 @@ class FCOS_ResNet50_FPN_Weights(WeightsEnum): "map": 39.2, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/detection/keypoint_rcnn.py b/torchvision/prototype/models/detection/keypoint_rcnn.py index 60817b533a3..976cccadd39 100644 --- a/torchvision/prototype/models/detection/keypoint_rcnn.py +++ b/torchvision/prototype/models/detection/keypoint_rcnn.py @@ -56,7 +56,7 @@ class KeypointRCNN_ResNet50_FPN_Weights(WeightsEnum): "map_kp": 65.0, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/detection/mask_rcnn.py b/torchvision/prototype/models/detection/mask_rcnn.py index b6b71f0d9dc..af67f21c3e1 100644 --- a/torchvision/prototype/models/detection/mask_rcnn.py +++ b/torchvision/prototype/models/detection/mask_rcnn.py @@ -39,7 +39,7 @@ class MaskRCNN_ResNet50_FPN_Weights(WeightsEnum): "map_mask": 34.6, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/detection/retinanet.py b/torchvision/prototype/models/detection/retinanet.py index b1a770ba7a7..b0c02b1e30c 100644 --- a/torchvision/prototype/models/detection/retinanet.py +++ b/torchvision/prototype/models/detection/retinanet.py @@ -39,7 +39,7 @@ class RetinaNet_ResNet50_FPN_Weights(WeightsEnum): "map": 36.4, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/detection/ssd.py b/torchvision/prototype/models/detection/ssd.py index b88cd81ca1a..40568535277 100644 --- a/torchvision/prototype/models/detection/ssd.py +++ b/torchvision/prototype/models/detection/ssd.py @@ -38,7 +38,7 @@ class SSD300_VGG16_Weights(WeightsEnum): "map": 25.1, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/detection/ssdlite.py b/torchvision/prototype/models/detection/ssdlite.py index 4fa43bedbf8..6bc542df5b3 100644 --- a/torchvision/prototype/models/detection/ssdlite.py +++ b/torchvision/prototype/models/detection/ssdlite.py @@ -43,7 +43,7 @@ class SSDLite320_MobileNet_V3_Large_Weights(WeightsEnum): "map": 21.3, }, ) - default = COCO_V1 + DEFAULT = COCO_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/efficientnet.py b/torchvision/prototype/models/efficientnet.py index 3e34ee8c3bb..1fa2ea4d294 100644 --- a/torchvision/prototype/models/efficientnet.py +++ b/torchvision/prototype/models/efficientnet.py @@ -85,7 +85,7 @@ class EfficientNet_B0_Weights(WeightsEnum): "acc@5": 93.532, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class EfficientNet_B1_Weights(WeightsEnum): @@ -113,7 +113,7 @@ class EfficientNet_B1_Weights(WeightsEnum): "acc@5": 94.934, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class EfficientNet_B2_Weights(WeightsEnum): @@ -128,7 +128,7 @@ class EfficientNet_B2_Weights(WeightsEnum): "acc@5": 95.310, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class EfficientNet_B3_Weights(WeightsEnum): @@ -143,7 +143,7 @@ class EfficientNet_B3_Weights(WeightsEnum): "acc@5": 96.054, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class EfficientNet_B4_Weights(WeightsEnum): @@ -158,7 +158,7 @@ class EfficientNet_B4_Weights(WeightsEnum): "acc@5": 96.594, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class EfficientNet_B5_Weights(WeightsEnum): @@ -173,7 +173,7 @@ class EfficientNet_B5_Weights(WeightsEnum): "acc@5": 96.628, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class EfficientNet_B6_Weights(WeightsEnum): @@ -188,7 +188,7 @@ class EfficientNet_B6_Weights(WeightsEnum): "acc@5": 96.916, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class EfficientNet_B7_Weights(WeightsEnum): @@ -203,7 +203,7 @@ class EfficientNet_B7_Weights(WeightsEnum): "acc@5": 96.908, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", EfficientNet_B0_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/googlenet.py b/torchvision/prototype/models/googlenet.py index b2841ddf07d..9a561e51390 100644 --- a/torchvision/prototype/models/googlenet.py +++ b/torchvision/prototype/models/googlenet.py @@ -32,7 +32,7 @@ class GoogLeNet_Weights(WeightsEnum): "acc@5": 89.530, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", GoogLeNet_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/inception.py b/torchvision/prototype/models/inception.py index f82c8444718..088062f3010 100644 --- a/torchvision/prototype/models/inception.py +++ b/torchvision/prototype/models/inception.py @@ -31,7 +31,7 @@ class Inception_V3_Weights(WeightsEnum): "acc@5": 93.450, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", Inception_V3_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/mnasnet.py b/torchvision/prototype/models/mnasnet.py index ec9c9e5f53b..90c0a43a5e6 100644 --- a/torchvision/prototype/models/mnasnet.py +++ b/torchvision/prototype/models/mnasnet.py @@ -46,7 +46,7 @@ class MNASNet0_5_Weights(WeightsEnum): "acc@5": 87.490, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class MNASNet0_75_Weights(WeightsEnum): @@ -65,7 +65,7 @@ class MNASNet1_0_Weights(WeightsEnum): "acc@5": 91.510, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class MNASNet1_3_Weights(WeightsEnum): diff --git a/torchvision/prototype/models/mobilenetv2.py b/torchvision/prototype/models/mobilenetv2.py index 1219f94c677..3531394acc8 100644 --- a/torchvision/prototype/models/mobilenetv2.py +++ b/torchvision/prototype/models/mobilenetv2.py @@ -31,7 +31,7 @@ class MobileNet_V2_Weights(WeightsEnum): "acc@5": 90.286, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", MobileNet_V2_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/mobilenetv3.py b/torchvision/prototype/models/mobilenetv3.py index a34324aa327..1e342b83bcc 100644 --- a/torchvision/prototype/models/mobilenetv3.py +++ b/torchvision/prototype/models/mobilenetv3.py @@ -71,7 +71,7 @@ class MobileNet_V3_Large_Weights(WeightsEnum): "acc@5": 92.566, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class MobileNet_V3_Small_Weights(WeightsEnum): @@ -86,7 +86,7 @@ class MobileNet_V3_Small_Weights(WeightsEnum): "acc@5": 87.402, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", MobileNet_V3_Large_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/optical_flow/raft.py b/torchvision/prototype/models/optical_flow/raft.py index 2418d0b5e9b..44ea84deed0 100644 --- a/torchvision/prototype/models/optical_flow/raft.py +++ b/torchvision/prototype/models/optical_flow/raft.py @@ -115,7 +115,7 @@ class Raft_Large_Weights(WeightsEnum): }, ) - default = C_T_V2 + DEFAULT = C_T_V2 class Raft_Small_Weights(WeightsEnum): @@ -148,7 +148,7 @@ class Raft_Small_Weights(WeightsEnum): }, ) - default = C_T_V2 + DEFAULT = C_T_V2 @handle_legacy_interface(weights=("pretrained", Raft_Large_Weights.C_T_V2)) diff --git a/torchvision/prototype/models/quantization/googlenet.py b/torchvision/prototype/models/quantization/googlenet.py index 3af827d230a..71d5cc3f5e0 100644 --- a/torchvision/prototype/models/quantization/googlenet.py +++ b/torchvision/prototype/models/quantization/googlenet.py @@ -44,7 +44,7 @@ class GoogLeNet_QuantizedWeights(WeightsEnum): "acc@5": 89.404, }, ) - default = IMAGENET1K_FBGEMM_V1 + DEFAULT = IMAGENET1K_FBGEMM_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/quantization/inception.py b/torchvision/prototype/models/quantization/inception.py index df3017d0ada..4b820228de2 100644 --- a/torchvision/prototype/models/quantization/inception.py +++ b/torchvision/prototype/models/quantization/inception.py @@ -43,7 +43,7 @@ class Inception_V3_QuantizedWeights(WeightsEnum): "acc@5": 93.354, }, ) - default = IMAGENET1K_FBGEMM_V1 + DEFAULT = IMAGENET1K_FBGEMM_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/quantization/mobilenetv2.py b/torchvision/prototype/models/quantization/mobilenetv2.py index 723e55c5de4..d3fabc44beb 100644 --- a/torchvision/prototype/models/quantization/mobilenetv2.py +++ b/torchvision/prototype/models/quantization/mobilenetv2.py @@ -44,7 +44,7 @@ class MobileNet_V2_QuantizedWeights(WeightsEnum): "acc@5": 90.150, }, ) - default = IMAGENET1K_QNNPACK_V1 + DEFAULT = IMAGENET1K_QNNPACK_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/quantization/mobilenetv3.py b/torchvision/prototype/models/quantization/mobilenetv3.py index b1918e4c8cc..24355b08779 100644 --- a/torchvision/prototype/models/quantization/mobilenetv3.py +++ b/torchvision/prototype/models/quantization/mobilenetv3.py @@ -77,7 +77,7 @@ class MobileNet_V3_Large_QuantizedWeights(WeightsEnum): "acc@5": 90.858, }, ) - default = IMAGENET1K_QNNPACK_V1 + DEFAULT = IMAGENET1K_QNNPACK_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/quantization/resnet.py b/torchvision/prototype/models/quantization/resnet.py index 51624303a6a..61f7dbbeda0 100644 --- a/torchvision/prototype/models/quantization/resnet.py +++ b/torchvision/prototype/models/quantization/resnet.py @@ -79,7 +79,7 @@ class ResNet18_QuantizedWeights(WeightsEnum): "acc@5": 88.882, }, ) - default = IMAGENET1K_FBGEMM_V1 + DEFAULT = IMAGENET1K_FBGEMM_V1 class ResNet50_QuantizedWeights(WeightsEnum): @@ -109,7 +109,7 @@ class ResNet50_QuantizedWeights(WeightsEnum): "acc@5": 94.976, }, ) - default = IMAGENET1K_FBGEMM_V2 + DEFAULT = IMAGENET1K_FBGEMM_V2 class ResNeXt101_32X8D_QuantizedWeights(WeightsEnum): @@ -139,7 +139,7 @@ class ResNeXt101_32X8D_QuantizedWeights(WeightsEnum): "acc@5": 96.132, }, ) - default = IMAGENET1K_FBGEMM_V2 + DEFAULT = IMAGENET1K_FBGEMM_V2 @handle_legacy_interface( diff --git a/torchvision/prototype/models/quantization/shufflenetv2.py b/torchvision/prototype/models/quantization/shufflenetv2.py index e0aacc77aca..7c550bb2d7b 100644 --- a/torchvision/prototype/models/quantization/shufflenetv2.py +++ b/torchvision/prototype/models/quantization/shufflenetv2.py @@ -76,7 +76,7 @@ class ShuffleNet_V2_X0_5_QuantizedWeights(WeightsEnum): "acc@5": 79.780, }, ) - default = IMAGENET1K_FBGEMM_V1 + DEFAULT = IMAGENET1K_FBGEMM_V1 class ShuffleNet_V2_X1_0_QuantizedWeights(WeightsEnum): @@ -91,7 +91,7 @@ class ShuffleNet_V2_X1_0_QuantizedWeights(WeightsEnum): "acc@5": 87.582, }, ) - default = IMAGENET1K_FBGEMM_V1 + DEFAULT = IMAGENET1K_FBGEMM_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/regnet.py b/torchvision/prototype/models/regnet.py index 4cdae5bf75c..44b7678d8e5 100644 --- a/torchvision/prototype/models/regnet.py +++ b/torchvision/prototype/models/regnet.py @@ -97,7 +97,7 @@ class RegNet_Y_400MF_Weights(WeightsEnum): "acc@5": 92.742, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_Y_800MF_Weights(WeightsEnum): @@ -123,7 +123,7 @@ class RegNet_Y_800MF_Weights(WeightsEnum): "acc@5": 94.502, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_Y_1_6GF_Weights(WeightsEnum): @@ -149,7 +149,7 @@ class RegNet_Y_1_6GF_Weights(WeightsEnum): "acc@5": 95.444, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_Y_3_2GF_Weights(WeightsEnum): @@ -175,7 +175,7 @@ class RegNet_Y_3_2GF_Weights(WeightsEnum): "acc@5": 95.972, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_Y_8GF_Weights(WeightsEnum): @@ -201,7 +201,7 @@ class RegNet_Y_8GF_Weights(WeightsEnum): "acc@5": 96.330, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_Y_16GF_Weights(WeightsEnum): @@ -227,7 +227,7 @@ class RegNet_Y_16GF_Weights(WeightsEnum): "acc@5": 96.328, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_Y_32GF_Weights(WeightsEnum): @@ -253,7 +253,7 @@ class RegNet_Y_32GF_Weights(WeightsEnum): "acc@5": 96.498, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_Y_128GF_Weights(WeightsEnum): @@ -284,7 +284,7 @@ class RegNet_X_400MF_Weights(WeightsEnum): "acc@5": 92.322, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_X_800MF_Weights(WeightsEnum): @@ -310,7 +310,7 @@ class RegNet_X_800MF_Weights(WeightsEnum): "acc@5": 93.826, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_X_1_6GF_Weights(WeightsEnum): @@ -336,7 +336,7 @@ class RegNet_X_1_6GF_Weights(WeightsEnum): "acc@5": 94.922, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_X_3_2GF_Weights(WeightsEnum): @@ -362,7 +362,7 @@ class RegNet_X_3_2GF_Weights(WeightsEnum): "acc@5": 95.430, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_X_8GF_Weights(WeightsEnum): @@ -388,7 +388,7 @@ class RegNet_X_8GF_Weights(WeightsEnum): "acc@5": 95.678, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_X_16GF_Weights(WeightsEnum): @@ -414,7 +414,7 @@ class RegNet_X_16GF_Weights(WeightsEnum): "acc@5": 96.196, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class RegNet_X_32GF_Weights(WeightsEnum): @@ -440,7 +440,7 @@ class RegNet_X_32GF_Weights(WeightsEnum): "acc@5": 96.288, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 @handle_legacy_interface(weights=("pretrained", RegNet_Y_400MF_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/resnet.py b/torchvision/prototype/models/resnet.py index e44b6df0367..cf18e03fab9 100644 --- a/torchvision/prototype/models/resnet.py +++ b/torchvision/prototype/models/resnet.py @@ -74,7 +74,7 @@ class ResNet18_Weights(WeightsEnum): "acc@5": 89.078, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class ResNet34_Weights(WeightsEnum): @@ -91,7 +91,7 @@ class ResNet34_Weights(WeightsEnum): "acc@5": 91.420, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class ResNet50_Weights(WeightsEnum): @@ -121,7 +121,7 @@ class ResNet50_Weights(WeightsEnum): "acc@5": 95.434, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class ResNet101_Weights(WeightsEnum): @@ -151,7 +151,7 @@ class ResNet101_Weights(WeightsEnum): "acc@5": 95.780, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class ResNet152_Weights(WeightsEnum): @@ -181,7 +181,7 @@ class ResNet152_Weights(WeightsEnum): "acc@5": 96.002, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class ResNeXt50_32X4D_Weights(WeightsEnum): @@ -211,7 +211,7 @@ class ResNeXt50_32X4D_Weights(WeightsEnum): "acc@5": 95.340, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class ResNeXt101_32X8D_Weights(WeightsEnum): @@ -241,7 +241,7 @@ class ResNeXt101_32X8D_Weights(WeightsEnum): "acc@5": 96.228, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class Wide_ResNet50_2_Weights(WeightsEnum): @@ -271,7 +271,7 @@ class Wide_ResNet50_2_Weights(WeightsEnum): "acc@5": 95.758, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 class Wide_ResNet101_2_Weights(WeightsEnum): @@ -301,7 +301,7 @@ class Wide_ResNet101_2_Weights(WeightsEnum): "acc@5": 96.020, }, ) - default = IMAGENET1K_V2 + DEFAULT = IMAGENET1K_V2 @handle_legacy_interface(weights=("pretrained", ResNet18_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/segmentation/deeplabv3.py b/torchvision/prototype/models/segmentation/deeplabv3.py index 18ca4ae8eeb..43d3ab131b3 100644 --- a/torchvision/prototype/models/segmentation/deeplabv3.py +++ b/torchvision/prototype/models/segmentation/deeplabv3.py @@ -45,7 +45,7 @@ class DeepLabV3_ResNet50_Weights(WeightsEnum): "acc": 92.4, }, ) - default = COCO_WITH_VOC_LABELS_V1 + DEFAULT = COCO_WITH_VOC_LABELS_V1 class DeepLabV3_ResNet101_Weights(WeightsEnum): @@ -60,7 +60,7 @@ class DeepLabV3_ResNet101_Weights(WeightsEnum): "acc": 92.4, }, ) - default = COCO_WITH_VOC_LABELS_V1 + DEFAULT = COCO_WITH_VOC_LABELS_V1 class DeepLabV3_MobileNet_V3_Large_Weights(WeightsEnum): @@ -75,7 +75,7 @@ class DeepLabV3_MobileNet_V3_Large_Weights(WeightsEnum): "acc": 91.2, }, ) - default = COCO_WITH_VOC_LABELS_V1 + DEFAULT = COCO_WITH_VOC_LABELS_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/segmentation/fcn.py b/torchvision/prototype/models/segmentation/fcn.py index 17af99c10c6..6b3a672de48 100644 --- a/torchvision/prototype/models/segmentation/fcn.py +++ b/torchvision/prototype/models/segmentation/fcn.py @@ -35,7 +35,7 @@ class FCN_ResNet50_Weights(WeightsEnum): "acc": 91.4, }, ) - default = COCO_WITH_VOC_LABELS_V1 + DEFAULT = COCO_WITH_VOC_LABELS_V1 class FCN_ResNet101_Weights(WeightsEnum): @@ -50,7 +50,7 @@ class FCN_ResNet101_Weights(WeightsEnum): "acc": 91.9, }, ) - default = COCO_WITH_VOC_LABELS_V1 + DEFAULT = COCO_WITH_VOC_LABELS_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/segmentation/lraspp.py b/torchvision/prototype/models/segmentation/lraspp.py index ad1560ae508..7359e08102e 100644 --- a/torchvision/prototype/models/segmentation/lraspp.py +++ b/torchvision/prototype/models/segmentation/lraspp.py @@ -30,7 +30,7 @@ class LRASPP_MobileNet_V3_Large_Weights(WeightsEnum): "acc": 91.2, }, ) - default = COCO_WITH_VOC_LABELS_V1 + DEFAULT = COCO_WITH_VOC_LABELS_V1 @handle_legacy_interface( diff --git a/torchvision/prototype/models/shufflenetv2.py b/torchvision/prototype/models/shufflenetv2.py index 9589345a052..41fa64c14e7 100644 --- a/torchvision/prototype/models/shufflenetv2.py +++ b/torchvision/prototype/models/shufflenetv2.py @@ -63,7 +63,7 @@ class ShuffleNet_V2_X0_5_Weights(WeightsEnum): "acc@5": 88.316, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class ShuffleNet_V2_X1_0_Weights(WeightsEnum): @@ -77,7 +77,7 @@ class ShuffleNet_V2_X1_0_Weights(WeightsEnum): "acc@5": 81.746, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class ShuffleNet_V2_X1_5_Weights(WeightsEnum): diff --git a/torchvision/prototype/models/squeezenet.py b/torchvision/prototype/models/squeezenet.py index 8b6382616dd..5d26466f92d 100644 --- a/torchvision/prototype/models/squeezenet.py +++ b/torchvision/prototype/models/squeezenet.py @@ -36,7 +36,7 @@ class SqueezeNet1_0_Weights(WeightsEnum): "acc@5": 80.420, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class SqueezeNet1_1_Weights(WeightsEnum): @@ -51,7 +51,7 @@ class SqueezeNet1_1_Weights(WeightsEnum): "acc@5": 80.624, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", SqueezeNet1_0_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/vgg.py b/torchvision/prototype/models/vgg.py index ff8623e3d23..de0ce518629 100644 --- a/torchvision/prototype/models/vgg.py +++ b/torchvision/prototype/models/vgg.py @@ -63,7 +63,7 @@ class VGG11_Weights(WeightsEnum): "acc@5": 88.628, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class VGG11_BN_Weights(WeightsEnum): @@ -77,7 +77,7 @@ class VGG11_BN_Weights(WeightsEnum): "acc@5": 89.810, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class VGG13_Weights(WeightsEnum): @@ -91,7 +91,7 @@ class VGG13_Weights(WeightsEnum): "acc@5": 89.246, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class VGG13_BN_Weights(WeightsEnum): @@ -105,7 +105,7 @@ class VGG13_BN_Weights(WeightsEnum): "acc@5": 90.374, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class VGG16_Weights(WeightsEnum): @@ -136,7 +136,7 @@ class VGG16_Weights(WeightsEnum): "acc@5": float("nan"), }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class VGG16_BN_Weights(WeightsEnum): @@ -150,7 +150,7 @@ class VGG16_BN_Weights(WeightsEnum): "acc@5": 91.516, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class VGG19_Weights(WeightsEnum): @@ -164,7 +164,7 @@ class VGG19_Weights(WeightsEnum): "acc@5": 90.876, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class VGG19_BN_Weights(WeightsEnum): @@ -178,7 +178,7 @@ class VGG19_BN_Weights(WeightsEnum): "acc@5": 91.842, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 @handle_legacy_interface(weights=("pretrained", VGG11_Weights.IMAGENET1K_V1)) diff --git a/torchvision/prototype/models/video/resnet.py b/torchvision/prototype/models/video/resnet.py index 06ca4eaa211..90c3d605232 100644 --- a/torchvision/prototype/models/video/resnet.py +++ b/torchvision/prototype/models/video/resnet.py @@ -74,7 +74,7 @@ class R3D_18_Weights(WeightsEnum): "acc@5": 75.45, }, ) - default = KINETICS400_V1 + DEFAULT = KINETICS400_V1 class MC3_18_Weights(WeightsEnum): @@ -89,7 +89,7 @@ class MC3_18_Weights(WeightsEnum): "acc@5": 76.29, }, ) - default = KINETICS400_V1 + DEFAULT = KINETICS400_V1 class R2Plus1D_18_Weights(WeightsEnum): @@ -104,7 +104,7 @@ class R2Plus1D_18_Weights(WeightsEnum): "acc@5": 78.81, }, ) - default = KINETICS400_V1 + DEFAULT = KINETICS400_V1 @handle_legacy_interface(weights=("pretrained", R3D_18_Weights.KINETICS400_V1)) diff --git a/torchvision/prototype/models/vision_transformer.py b/torchvision/prototype/models/vision_transformer.py index 73955785c90..6a5eaa4a96b 100644 --- a/torchvision/prototype/models/vision_transformer.py +++ b/torchvision/prototype/models/vision_transformer.py @@ -51,7 +51,7 @@ class ViT_B_16_Weights(WeightsEnum): "acc@5": 95.318, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class ViT_B_32_Weights(WeightsEnum): @@ -68,7 +68,7 @@ class ViT_B_32_Weights(WeightsEnum): "acc@5": 92.466, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class ViT_L_16_Weights(WeightsEnum): @@ -85,7 +85,7 @@ class ViT_L_16_Weights(WeightsEnum): "acc@5": 94.638, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class ViT_L_32_Weights(WeightsEnum): @@ -102,7 +102,7 @@ class ViT_L_32_Weights(WeightsEnum): "acc@5": 93.07, }, ) - default = IMAGENET1K_V1 + DEFAULT = IMAGENET1K_V1 class ViT_H_14_Weights(WeightsEnum): From 111dba2a4c068e8a9237883c5cb6074400e091ce Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Sat, 22 Jan 2022 14:31:07 -0800 Subject: [PATCH 06/13] update test --- test/test_prototype_models.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index 6f9c3b0e42d..52597432203 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -55,9 +55,9 @@ def _build_model(fn, **kwargs): "name, weight", [ ("ResNet50_Weights.IMAGENET1K_V1", models.ResNet50_Weights.IMAGENET1K_V1), - ("ResNet50_Weights.default", models.ResNet50_Weights.IMAGENET1K_V2), + ("ResNet50_Weights.DEFAULT", models.ResNet50_Weights.IMAGENET1K_V2), ( - "ResNet50_QuantizedWeights.default", + "ResNet50_QuantizedWeights.DEFAULT", models.quantization.ResNet50_QuantizedWeights.IMAGENET1K_FBGEMM_V2, ), ( @@ -121,7 +121,7 @@ def test_schema_meta_validation(model_fn): missing_fields = fields - set(w.meta.keys()) if missing_fields: problematic_weights[w] = missing_fields - if w == weights_enum.default: + if w == weights_enum.DEFAULT: if module_name == "quantization": # parametes() cound doesn't work well with quantization, so we check against the non-quantized unquantized_w = w.meta.get("unquantized") @@ -131,9 +131,15 @@ def test_schema_meta_validation(model_fn): if w.meta.get("num_params") != sum(p.numel() for p in model_fn(weights=w).parameters()): incorrect_params.append(w) else: - if w.meta.get("num_params") != weights_enum.default.meta.get("num_params"): + if w.meta.get("num_params") != weights_enum.DEFAULT.meta.get("num_params"): incorrect_params.append(w) + bad_names = [] + for k, v in weights_enum.__members__.item(): + # Weights are constant members, thus should be all capital + if isinstance(v, Weights) and not k.isupper(): + bad_names.append(k) + assert not problematic_weights assert not incorrect_params From f6037e49ad91b76f56ff94f5d33bbff1889d2546 Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Sat, 22 Jan 2022 14:31:37 -0800 Subject: [PATCH 07/13] fix typos --- test/test_prototype_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index 52597432203..372576097c1 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -123,7 +123,7 @@ def test_schema_meta_validation(model_fn): problematic_weights[w] = missing_fields if w == weights_enum.DEFAULT: if module_name == "quantization": - # parametes() cound doesn't work well with quantization, so we check against the non-quantized + # parameters() count doesn't work well with quantization, so we check against the non-quantized unquantized_w = w.meta.get("unquantized") if unquantized_w is not None and w.meta.get("num_params") != unquantized_w.meta.get("num_params"): incorrect_params.append(w) From 2c94f0182babe9083cafaf9fe2a117cd45e9851b Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Sat, 22 Jan 2022 14:33:01 -0800 Subject: [PATCH 08/13] update test --- test/test_prototype_models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index 372576097c1..77742ad6d61 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -142,6 +142,7 @@ def test_schema_meta_validation(model_fn): assert not problematic_weights assert not incorrect_params + assert not bad_names @pytest.mark.parametrize("model_fn", TM.get_models_from_module(models)) From 7b9845f84287d7ca7ced840f2f4c278592569d69 Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Sat, 22 Jan 2022 14:53:09 -0800 Subject: [PATCH 09/13] update test --- test/test_prototype_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index 77742ad6d61..b3be6cc1c69 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -83,7 +83,7 @@ def test_naming_conventions(model_fn): weights_enum = _get_model_weights(model_fn) print(weights_enum) assert weights_enum is not None - assert len(weights_enum) == 0 or hasattr(weights_enum, "default") + assert len(weights_enum) == 0 or hasattr(weights_enum, "DEFAULT") @pytest.mark.parametrize( From a5c836751de843a4dde2d1d3c3033d0b9ea5edbb Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Sat, 22 Jan 2022 17:24:29 -0800 Subject: [PATCH 10/13] update test --- test/test_prototype_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index b3be6cc1c69..97b4def38b7 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -135,7 +135,7 @@ def test_schema_meta_validation(model_fn): incorrect_params.append(w) bad_names = [] - for k, v in weights_enum.__members__.item(): + for k, v in weights_enum.__members__.items(): # Weights are constant members, thus should be all capital if isinstance(v, Weights) and not k.isupper(): bad_names.append(k) From a0964137b40c3c736208d076286d3a80b899e969 Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Sun, 23 Jan 2022 10:12:35 -0800 Subject: [PATCH 11/13] indent as w was weight_enum --- test/test_prototype_models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index 97b4def38b7..ae94e8bcaa0 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -117,6 +117,7 @@ def test_schema_meta_validation(model_fn): problematic_weights = {} incorrect_params = [] + bad_names = [] for w in weights_enum: missing_fields = fields - set(w.meta.keys()) if missing_fields: @@ -134,11 +135,10 @@ def test_schema_meta_validation(model_fn): if w.meta.get("num_params") != weights_enum.DEFAULT.meta.get("num_params"): incorrect_params.append(w) - bad_names = [] - for k, v in weights_enum.__members__.items(): - # Weights are constant members, thus should be all capital - if isinstance(v, Weights) and not k.isupper(): - bad_names.append(k) + for k, v in w.__members__.items(): + # Weights are constant members, thus should be all capital + if isinstance(v, Weights) and not k.isupper(): + bad_names.append(k) assert not problematic_weights assert not incorrect_params From 4921d945613cf34af18eede13b0eddad5ed277a8 Mon Sep 17 00:00:00 2001 From: Yoshitomo Matsubara Date: Sun, 23 Jan 2022 19:26:16 -0800 Subject: [PATCH 12/13] revert --- test/test_prototype_models.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index ae94e8bcaa0..d9d9b46aeef 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -117,7 +117,6 @@ def test_schema_meta_validation(model_fn): problematic_weights = {} incorrect_params = [] - bad_names = [] for w in weights_enum: missing_fields = fields - set(w.meta.keys()) if missing_fields: @@ -135,14 +134,8 @@ def test_schema_meta_validation(model_fn): if w.meta.get("num_params") != weights_enum.DEFAULT.meta.get("num_params"): incorrect_params.append(w) - for k, v in w.__members__.items(): - # Weights are constant members, thus should be all capital - if isinstance(v, Weights) and not k.isupper(): - bad_names.append(k) - assert not problematic_weights assert not incorrect_params - assert not bad_names @pytest.mark.parametrize("model_fn", TM.get_models_from_module(models)) From 5effa366e59b91c436b3be11d7141a6494046796 Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Mon, 24 Jan 2022 09:03:57 +0000 Subject: [PATCH 13/13] Adding back the capitalization test --- test/test_prototype_models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test_prototype_models.py b/test/test_prototype_models.py index d9d9b46aeef..6c7234e2ef0 100644 --- a/test/test_prototype_models.py +++ b/test/test_prototype_models.py @@ -117,6 +117,7 @@ def test_schema_meta_validation(model_fn): problematic_weights = {} incorrect_params = [] + bad_names = [] for w in weights_enum: missing_fields = fields - set(w.meta.keys()) if missing_fields: @@ -133,9 +134,12 @@ def test_schema_meta_validation(model_fn): else: if w.meta.get("num_params") != weights_enum.DEFAULT.meta.get("num_params"): incorrect_params.append(w) + if not w.name.isupper(): + bad_names.append(w) assert not problematic_weights assert not incorrect_params + assert not bad_names @pytest.mark.parametrize("model_fn", TM.get_models_from_module(models))