diff --git a/docs/source/conf.py b/docs/source/conf.py index 231d3cad416..2d1eb2d7a19 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -362,6 +362,14 @@ def inject_weight_metadata(app, what, name, obj, options, lines): max_visible = 3 v_sample = ", ".join(v[:max_visible]) v = f"{v_sample}, ... ({len(v)-max_visible} omitted)" if len(v) > max_visible else v_sample + elif k == "_ops": + if obj.__name__.endswith("_QuantizedWeights"): + v = f"{v} giga instructions per sec" + else: + v = f"{v} giga floating-point operations per sec" + elif k == "_weight_size": + v = f"{v} MB (file size)" + table.append((str(k), str(v))) table = tabulate(table, tablefmt="rst") lines += [".. rst-class:: table-weights"] # Custom CSS class, see custom_torchvision.css @@ -385,19 +393,30 @@ def generate_weights_table(module, table_name, metrics, dataset, include_pattern if exclude_patterns is not None: weights = [w for w in weights if all(p not in str(w) for p in exclude_patterns)] + ops_name = "GIPS" if "QuantizedWeights" in weights_endswith else "GFLOPS" + metrics_keys, metrics_names = zip(*metrics) - column_names = ["Weight"] + list(metrics_names) + ["Params", "Recipe"] + column_names = ( + ["Weight"] + list(metrics_names) + ["Params"] + [ops_name, "Size (MB)", "Recipe"] + ) # Final column order column_names = [f"**{name}**" for name in column_names] # Add bold - content = [ - ( + content = [] + for w in weights: + row = [ f":class:`{w} <{type(w).__name__}>`", *(w.meta["_metrics"][dataset][metric] for metric in metrics_keys), f"{w.meta['num_params']/1e6:.1f}M", + f"{w.meta['_ops']:.3f}", + f"{round(w.meta['_weight_size'], 1):.1f}", f"`link <{w.meta['recipe']}>`__", - ) - for w in weights - ] + ] + + content.append(row) + + column_widths = ["110"] + ["18"] * len(metrics_names) + ["18"] * 3 + ["10"] + widths_table = " ".join(column_widths) + table = tabulate(content, headers=column_names, tablefmt="rst") generated_dir = Path("generated") @@ -405,7 +424,7 @@ def generate_weights_table(module, table_name, metrics, dataset, include_pattern with open(generated_dir / f"{table_name}_table.rst", "w+") as table_file: table_file.write(".. rst-class:: table-weights\n") # Custom CSS class, see custom_torchvision.css table_file.write(".. table::\n") - table_file.write(f" :widths: 100 {'20 ' * len(metrics_names)} 20 10\n\n") + table_file.write(f" :widths: {widths_table} \n\n") table_file.write(f"{textwrap.indent(table, ' ' * 4)}\n\n") diff --git a/test/test_extended_models.py b/test/test_extended_models.py index 2cd8a568113..c3bb5d65396 100644 --- a/test/test_extended_models.py +++ b/test/test_extended_models.py @@ -155,11 +155,13 @@ def test_schema_meta_validation(model_fn): "recipe", "unquantized", "_docs", + "_ops", + "_weight_size", } # mandatory fields for each computer vision task classification_fields = {"categories", ("_metrics", "ImageNet-1K", "acc@1"), ("_metrics", "ImageNet-1K", "acc@5")} defaults = { - "all": {"_metrics", "min_size", "num_params", "recipe", "_docs"}, + "all": {"_metrics", "min_size", "num_params", "recipe", "_docs", "_weight_size", "_ops"}, "models": classification_fields, "detection": {"categories", ("_metrics", "COCO-val2017", "box_map")}, "quantization": classification_fields | {"backend", "unquantized"}, diff --git a/torchvision/models/alexnet.py b/torchvision/models/alexnet.py index 328f978ba11..50179d07cf8 100644 --- a/torchvision/models/alexnet.py +++ b/torchvision/models/alexnet.py @@ -67,6 +67,8 @@ class AlexNet_Weights(WeightsEnum): "acc@5": 79.066, } }, + "_ops": 0.714, + "_weight_size": 233.087, "_docs": """ These weights reproduce closely the results of the paper using a simplified training recipe. """, diff --git a/torchvision/models/convnext.py b/torchvision/models/convnext.py index 025baa3d148..21e36b06335 100644 --- a/torchvision/models/convnext.py +++ b/torchvision/models/convnext.py @@ -219,6 +219,8 @@ class ConvNeXt_Tiny_Weights(WeightsEnum): "acc@5": 96.146, } }, + "_ops": 4.456, + "_weight_size": 109.119, }, ) DEFAULT = IMAGENET1K_V1 @@ -237,6 +239,8 @@ class ConvNeXt_Small_Weights(WeightsEnum): "acc@5": 96.650, } }, + "_ops": 8.684, + "_weight_size": 191.703, }, ) DEFAULT = IMAGENET1K_V1 @@ -255,6 +259,8 @@ class ConvNeXt_Base_Weights(WeightsEnum): "acc@5": 96.870, } }, + "_ops": 15.355, + "_weight_size": 338.064, }, ) DEFAULT = IMAGENET1K_V1 @@ -273,6 +279,8 @@ class ConvNeXt_Large_Weights(WeightsEnum): "acc@5": 96.976, } }, + "_ops": 34.361, + "_weight_size": 754.537, }, ) DEFAULT = IMAGENET1K_V1 diff --git a/torchvision/models/densenet.py b/torchvision/models/densenet.py index 9aa5ed176a0..575d123c4e1 100644 --- a/torchvision/models/densenet.py +++ b/torchvision/models/densenet.py @@ -15,7 +15,6 @@ from ._meta import _IMAGENET_CATEGORIES from ._utils import _ovewrite_named_param, handle_legacy_interface - __all__ = [ "DenseNet", "DenseNet121_Weights", @@ -278,6 +277,8 @@ class DenseNet121_Weights(WeightsEnum): "acc@5": 91.972, } }, + "_ops": 2.834, + "_weight_size": 30.845, }, ) DEFAULT = IMAGENET1K_V1 @@ -296,6 +297,8 @@ class DenseNet161_Weights(WeightsEnum): "acc@5": 93.560, } }, + "_ops": 7.728, + "_weight_size": 110.369, }, ) DEFAULT = IMAGENET1K_V1 @@ -314,6 +317,8 @@ class DenseNet169_Weights(WeightsEnum): "acc@5": 92.806, } }, + "_ops": 3.36, + "_weight_size": 54.708, }, ) DEFAULT = IMAGENET1K_V1 @@ -332,6 +337,8 @@ class DenseNet201_Weights(WeightsEnum): "acc@5": 93.370, } }, + "_ops": 4.291, + "_weight_size": 77.373, }, ) DEFAULT = IMAGENET1K_V1 @@ -444,7 +451,6 @@ def densenet201(*, weights: Optional[DenseNet201_Weights] = None, progress: bool # The dictionary below is internal implementation detail and will be removed in v0.15 from ._utils import _ModelURLs - model_urls = _ModelURLs( { "densenet121": DenseNet121_Weights.IMAGENET1K_V1.url, diff --git a/torchvision/models/detection/faster_rcnn.py b/torchvision/models/detection/faster_rcnn.py index 9d99fd236c7..5b97c8fc28a 100644 --- a/torchvision/models/detection/faster_rcnn.py +++ b/torchvision/models/detection/faster_rcnn.py @@ -388,6 +388,8 @@ class FasterRCNN_ResNet50_FPN_Weights(WeightsEnum): "box_map": 37.0, } }, + "_ops": 134.38, + "_weight_size": 159.743, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) @@ -407,6 +409,8 @@ class FasterRCNN_ResNet50_FPN_V2_Weights(WeightsEnum): "box_map": 46.7, } }, + "_ops": 280.371, + "_weight_size": 167.104, "_docs": """These weights were produced using an enhanced training recipe to boost the model accuracy.""", }, ) @@ -426,6 +430,8 @@ class FasterRCNN_MobileNet_V3_Large_FPN_Weights(WeightsEnum): "box_map": 32.8, } }, + "_ops": 4.494, + "_weight_size": 74.239, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) @@ -445,6 +451,8 @@ class FasterRCNN_MobileNet_V3_Large_320_FPN_Weights(WeightsEnum): "box_map": 22.8, } }, + "_ops": 0.719, + "_weight_size": 74.239, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) diff --git a/torchvision/models/detection/fcos.py b/torchvision/models/detection/fcos.py index 2ac71c339a4..535518f821c 100644 --- a/torchvision/models/detection/fcos.py +++ b/torchvision/models/detection/fcos.py @@ -662,6 +662,8 @@ class FCOS_ResNet50_FPN_Weights(WeightsEnum): "box_map": 39.2, } }, + "_ops": 128.207, + "_weight_size": 123.608, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) diff --git a/torchvision/models/detection/keypoint_rcnn.py b/torchvision/models/detection/keypoint_rcnn.py index c19dd21a5ce..6964389f190 100644 --- a/torchvision/models/detection/keypoint_rcnn.py +++ b/torchvision/models/detection/keypoint_rcnn.py @@ -328,6 +328,8 @@ class KeypointRCNN_ResNet50_FPN_Weights(WeightsEnum): "kp_map": 61.1, } }, + "_ops": 133.924, + "_weight_size": 226.054, "_docs": """ These weights were produced by following a similar training recipe as on the paper but use a checkpoint from an early epoch. @@ -347,6 +349,8 @@ class KeypointRCNN_ResNet50_FPN_Weights(WeightsEnum): "kp_map": 65.0, } }, + "_ops": 137.42, + "_weight_size": 226.054, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) diff --git a/torchvision/models/detection/mask_rcnn.py b/torchvision/models/detection/mask_rcnn.py index 795f9b8f79c..f8a13a6587b 100644 --- a/torchvision/models/detection/mask_rcnn.py +++ b/torchvision/models/detection/mask_rcnn.py @@ -370,6 +370,8 @@ class MaskRCNN_ResNet50_FPN_Weights(WeightsEnum): "mask_map": 34.6, } }, + "_ops": 134.38, + "_weight_size": 169.84, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) @@ -390,6 +392,8 @@ class MaskRCNN_ResNet50_FPN_V2_Weights(WeightsEnum): "mask_map": 41.8, } }, + "_ops": 333.577, + "_weight_size": 177.219, "_docs": """These weights were produced using an enhanced training recipe to boost the model accuracy.""", }, ) diff --git a/torchvision/models/detection/retinanet.py b/torchvision/models/detection/retinanet.py index ffa21b14f70..498ff22071f 100644 --- a/torchvision/models/detection/retinanet.py +++ b/torchvision/models/detection/retinanet.py @@ -690,6 +690,8 @@ class RetinaNet_ResNet50_FPN_Weights(WeightsEnum): "box_map": 36.4, } }, + "_ops": 151.54, + "_weight_size": 130.267, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) @@ -709,6 +711,8 @@ class RetinaNet_ResNet50_FPN_V2_Weights(WeightsEnum): "box_map": 41.5, } }, + "_ops": 152.238, + "_weight_size": 146.037, "_docs": """These weights were produced using an enhanced training recipe to boost the model accuracy.""", }, ) diff --git a/torchvision/models/detection/ssd.py b/torchvision/models/detection/ssd.py index 44102f7ac5a..5ec27f45fc4 100644 --- a/torchvision/models/detection/ssd.py +++ b/torchvision/models/detection/ssd.py @@ -39,6 +39,8 @@ class SSD300_VGG16_Weights(WeightsEnum): "box_map": 25.1, } }, + "_ops": 34.858, + "_weight_size": 135.988, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) diff --git a/torchvision/models/detection/ssdlite.py b/torchvision/models/detection/ssdlite.py index d34795d7286..10e32d248ce 100644 --- a/torchvision/models/detection/ssdlite.py +++ b/torchvision/models/detection/ssdlite.py @@ -198,6 +198,8 @@ class SSDLite320_MobileNet_V3_Large_Weights(WeightsEnum): "box_map": 21.3, } }, + "_ops": 0.583, + "_weight_size": 13.418, "_docs": """These weights were produced by following a similar training recipe as on the paper.""", }, ) diff --git a/torchvision/models/efficientnet.py b/torchvision/models/efficientnet.py index c98eb37f935..05414c93150 100644 --- a/torchvision/models/efficientnet.py +++ b/torchvision/models/efficientnet.py @@ -464,6 +464,8 @@ class EfficientNet_B0_Weights(WeightsEnum): "acc@5": 93.532, } }, + "_ops": 0.386, + "_weight_size": 20.451, "_docs": """These weights are ported from the original paper.""", }, ) @@ -486,6 +488,8 @@ class EfficientNet_B1_Weights(WeightsEnum): "acc@5": 94.186, } }, + "_ops": 0.687, + "_weight_size": 30.134, "_docs": """These weights are ported from the original paper.""", }, ) @@ -504,6 +508,8 @@ class EfficientNet_B1_Weights(WeightsEnum): "acc@5": 94.934, } }, + "_ops": 0.687, + "_weight_size": 30.136, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -530,6 +536,8 @@ class EfficientNet_B2_Weights(WeightsEnum): "acc@5": 95.310, } }, + "_ops": 1.088, + "_weight_size": 35.174, "_docs": """These weights are ported from the original paper.""", }, ) @@ -552,6 +560,8 @@ class EfficientNet_B3_Weights(WeightsEnum): "acc@5": 96.054, } }, + "_ops": 1.827, + "_weight_size": 47.184, "_docs": """These weights are ported from the original paper.""", }, ) @@ -574,6 +584,8 @@ class EfficientNet_B4_Weights(WeightsEnum): "acc@5": 96.594, } }, + "_ops": 4.394, + "_weight_size": 74.489, "_docs": """These weights are ported from the original paper.""", }, ) @@ -596,6 +608,8 @@ class EfficientNet_B5_Weights(WeightsEnum): "acc@5": 96.628, } }, + "_ops": 10.266, + "_weight_size": 116.864, "_docs": """These weights are ported from the original paper.""", }, ) @@ -618,6 +632,8 @@ class EfficientNet_B6_Weights(WeightsEnum): "acc@5": 96.916, } }, + "_ops": 19.068, + "_weight_size": 165.362, "_docs": """These weights are ported from the original paper.""", }, ) @@ -640,6 +656,8 @@ class EfficientNet_B7_Weights(WeightsEnum): "acc@5": 96.908, } }, + "_ops": 37.746, + "_weight_size": 254.675, "_docs": """These weights are ported from the original paper.""", }, ) @@ -664,6 +682,8 @@ class EfficientNet_V2_S_Weights(WeightsEnum): "acc@5": 96.878, } }, + "_ops": 8.366, + "_weight_size": 82.704, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -692,6 +712,8 @@ class EfficientNet_V2_M_Weights(WeightsEnum): "acc@5": 97.156, } }, + "_ops": 24.582, + "_weight_size": 208.01, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -723,6 +745,8 @@ class EfficientNet_V2_L_Weights(WeightsEnum): "acc@5": 97.788, } }, + "_ops": 56.08, + "_weight_size": 454.573, "_docs": """These weights are ported from the original paper.""", }, ) diff --git a/torchvision/models/googlenet.py b/torchvision/models/googlenet.py index 0ea3dd5d0b9..b5435c7bda4 100644 --- a/torchvision/models/googlenet.py +++ b/torchvision/models/googlenet.py @@ -290,6 +290,8 @@ class GoogLeNet_Weights(WeightsEnum): "acc@5": 89.530, } }, + "_ops": 1.498, + "_weight_size": 49.731, "_docs": """These weights are ported from the original paper.""", }, ) diff --git a/torchvision/models/inception.py b/torchvision/models/inception.py index 928c07ac843..d2adb0842d7 100644 --- a/torchvision/models/inception.py +++ b/torchvision/models/inception.py @@ -422,6 +422,8 @@ class Inception_V3_Weights(WeightsEnum): "acc@5": 93.450, } }, + "_ops": 5.713, + "_weight_size": 103.903, "_docs": """These weights are ported from the original paper.""", }, ) diff --git a/torchvision/models/maxvit.py b/torchvision/models/maxvit.py index 7bf92876385..96c39513278 100644 --- a/torchvision/models/maxvit.py +++ b/torchvision/models/maxvit.py @@ -785,6 +785,8 @@ class MaxVit_T_Weights(WeightsEnum): "acc@5": 96.722, } }, + "_ops": 5.558, + "_weight_size": 118.769, "_docs": """These weights reproduce closely the results of the paper using a similar training recipe.""", }, ) diff --git a/torchvision/models/mnasnet.py b/torchvision/models/mnasnet.py index 48103f11585..bf94b9630f6 100644 --- a/torchvision/models/mnasnet.py +++ b/torchvision/models/mnasnet.py @@ -231,6 +231,8 @@ class MNASNet0_5_Weights(WeightsEnum): "acc@5": 87.490, } }, + "_ops": 0.104, + "_weight_size": 8.591, "_docs": """These weights reproduce closely the results of the paper.""", }, ) @@ -251,6 +253,8 @@ class MNASNet0_75_Weights(WeightsEnum): "acc@5": 90.496, } }, + "_ops": 0.215, + "_weight_size": 12.303, "_docs": """ These weights were trained from scratch by using TorchVision's `new training recipe `_. @@ -273,6 +277,8 @@ class MNASNet1_0_Weights(WeightsEnum): "acc@5": 91.510, } }, + "_ops": 0.314, + "_weight_size": 16.915, "_docs": """These weights reproduce closely the results of the paper.""", }, ) @@ -293,6 +299,8 @@ class MNASNet1_3_Weights(WeightsEnum): "acc@5": 93.522, } }, + "_ops": 0.526, + "_weight_size": 24.246, "_docs": """ These weights were trained from scratch by using TorchVision's `new training recipe `_. diff --git a/torchvision/models/mobilenetv2.py b/torchvision/models/mobilenetv2.py index 86b659ebd05..7920b906c57 100644 --- a/torchvision/models/mobilenetv2.py +++ b/torchvision/models/mobilenetv2.py @@ -194,6 +194,8 @@ class MobileNet_V2_Weights(WeightsEnum): "acc@5": 90.286, } }, + "_ops": 0.301, + "_weight_size": 13.555, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -209,6 +211,8 @@ class MobileNet_V2_Weights(WeightsEnum): "acc@5": 90.822, } }, + "_ops": 0.301, + "_weight_size": 13.598, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe diff --git a/torchvision/models/mobilenetv3.py b/torchvision/models/mobilenetv3.py index 715fc822ed3..8ae4b7d602d 100644 --- a/torchvision/models/mobilenetv3.py +++ b/torchvision/models/mobilenetv3.py @@ -307,6 +307,8 @@ class MobileNet_V3_Large_Weights(WeightsEnum): "acc@5": 91.340, } }, + "_ops": 0.217, + "_weight_size": 21.114, "_docs": """These weights were trained from scratch by using a simple training recipe.""", }, ) @@ -323,6 +325,8 @@ class MobileNet_V3_Large_Weights(WeightsEnum): "acc@5": 92.566, } }, + "_ops": 0.217, + "_weight_size": 21.107, "_docs": """ These weights improve marginally upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -347,6 +351,8 @@ class MobileNet_V3_Small_Weights(WeightsEnum): "acc@5": 87.402, } }, + "_ops": 0.057, + "_weight_size": 9.829, "_docs": """ These weights improve upon the results of the original paper by using a simple training recipe. """, diff --git a/torchvision/models/optical_flow/raft.py b/torchvision/models/optical_flow/raft.py index 1773f3d5983..7aa4684929a 100644 --- a/torchvision/models/optical_flow/raft.py +++ b/torchvision/models/optical_flow/raft.py @@ -552,6 +552,8 @@ class Raft_Large_Weights(WeightsEnum): "Sintel-Train-Finalpass": {"epe": 2.7894}, "Kitti-Train": {"per_image_epe": 5.0172, "fl_all": 17.4506}, }, + "_ops": 211.007, + "_weight_size": 20.129, "_docs": """These weights were ported from the original paper. They are trained on :class:`~torchvision.datasets.FlyingChairs` + :class:`~torchvision.datasets.FlyingThings3D`.""", @@ -570,6 +572,8 @@ class Raft_Large_Weights(WeightsEnum): "Sintel-Train-Finalpass": {"epe": 2.7161}, "Kitti-Train": {"per_image_epe": 4.5118, "fl_all": 16.0679}, }, + "_ops": 211.007, + "_weight_size": 20.129, "_docs": """These weights were trained from scratch on :class:`~torchvision.datasets.FlyingChairs` + :class:`~torchvision.datasets.FlyingThings3D`.""", @@ -588,6 +592,8 @@ class Raft_Large_Weights(WeightsEnum): "Sintel-Test-Cleanpass": {"epe": 1.94}, "Sintel-Test-Finalpass": {"epe": 3.18}, }, + "_ops": 211.007, + "_weight_size": 20.129, "_docs": """ These weights were ported from the original paper. They are trained on :class:`~torchvision.datasets.FlyingChairs` + @@ -612,6 +618,8 @@ class Raft_Large_Weights(WeightsEnum): "Sintel-Test-Cleanpass": {"epe": 1.819}, "Sintel-Test-Finalpass": {"epe": 3.067}, }, + "_ops": 211.007, + "_weight_size": 20.129, "_docs": """ These weights were trained from scratch. They are pre-trained on :class:`~torchvision.datasets.FlyingChairs` + @@ -636,6 +644,8 @@ class Raft_Large_Weights(WeightsEnum): "_metrics": { "Kitti-Test": {"fl_all": 5.10}, }, + "_ops": 211.007, + "_weight_size": 20.129, "_docs": """ These weights were ported from the original paper. They are pre-trained on :class:`~torchvision.datasets.FlyingChairs` + @@ -657,6 +667,8 @@ class Raft_Large_Weights(WeightsEnum): "_metrics": { "Kitti-Test": {"fl_all": 5.19}, }, + "_ops": 211.007, + "_weight_size": 20.129, "_docs": """ These weights were trained from scratch. They are pre-trained on :class:`~torchvision.datasets.FlyingChairs` + @@ -698,6 +710,8 @@ class Raft_Small_Weights(WeightsEnum): "Sintel-Train-Finalpass": {"epe": 3.2790}, "Kitti-Train": {"per_image_epe": 7.6557, "fl_all": 25.2801}, }, + "_ops": 47.655, + "_weight_size": 3.821, "_docs": """These weights were ported from the original paper. They are trained on :class:`~torchvision.datasets.FlyingChairs` + :class:`~torchvision.datasets.FlyingThings3D`.""", @@ -715,6 +729,8 @@ class Raft_Small_Weights(WeightsEnum): "Sintel-Train-Finalpass": {"epe": 3.2831}, "Kitti-Train": {"per_image_epe": 7.5978, "fl_all": 25.2369}, }, + "_ops": 47.655, + "_weight_size": 3.821, "_docs": """These weights were trained from scratch on :class:`~torchvision.datasets.FlyingChairs` + :class:`~torchvision.datasets.FlyingThings3D`.""", diff --git a/torchvision/models/quantization/googlenet.py b/torchvision/models/quantization/googlenet.py index abf2184acec..96d3fc2613b 100644 --- a/torchvision/models/quantization/googlenet.py +++ b/torchvision/models/quantization/googlenet.py @@ -123,6 +123,8 @@ class GoogLeNet_QuantizedWeights(WeightsEnum): "acc@5": 89.404, } }, + "_ops": 1.498, + "_weight_size": 12.618, "_docs": """ These weights were produced by doing Post Training Quantization (eager mode) on top of the unquantized weights listed below. diff --git a/torchvision/models/quantization/inception.py b/torchvision/models/quantization/inception.py index 34cd2a0a36a..bb6b5aa5b47 100644 --- a/torchvision/models/quantization/inception.py +++ b/torchvision/models/quantization/inception.py @@ -183,6 +183,8 @@ class Inception_V3_QuantizedWeights(WeightsEnum): "acc@5": 93.354, } }, + "_ops": 5.713, + "_weight_size": 23.146, "_docs": """ These weights were produced by doing Post Training Quantization (eager mode) on top of the unquantized weights listed below. diff --git a/torchvision/models/quantization/mobilenetv2.py b/torchvision/models/quantization/mobilenetv2.py index 1f91967f146..c85c54f33c7 100644 --- a/torchvision/models/quantization/mobilenetv2.py +++ b/torchvision/models/quantization/mobilenetv2.py @@ -80,6 +80,8 @@ class MobileNet_V2_QuantizedWeights(WeightsEnum): "acc@5": 90.150, } }, + "_ops": 0.301, + "_weight_size": 3.423, "_docs": """ These weights were produced by doing Quantization Aware Training (eager mode) on top of the unquantized weights listed below. diff --git a/torchvision/models/quantization/mobilenetv3.py b/torchvision/models/quantization/mobilenetv3.py index 53229c09534..c0a613eddb7 100644 --- a/torchvision/models/quantization/mobilenetv3.py +++ b/torchvision/models/quantization/mobilenetv3.py @@ -175,6 +175,8 @@ class MobileNet_V3_Large_QuantizedWeights(WeightsEnum): "acc@5": 90.858, } }, + "_ops": 0.217, + "_weight_size": 21.554, "_docs": """ These weights were produced by doing Quantization Aware Training (eager mode) on top of the unquantized weights listed below. diff --git a/torchvision/models/quantization/resnet.py b/torchvision/models/quantization/resnet.py index 286c040b006..b6f4165e654 100644 --- a/torchvision/models/quantization/resnet.py +++ b/torchvision/models/quantization/resnet.py @@ -175,6 +175,8 @@ class ResNet18_QuantizedWeights(WeightsEnum): "acc@5": 88.882, } }, + "_ops": 1.814, + "_weight_size": 11.238, }, ) DEFAULT = IMAGENET1K_FBGEMM_V1 @@ -194,6 +196,8 @@ class ResNet50_QuantizedWeights(WeightsEnum): "acc@5": 92.814, } }, + "_ops": 4.089, + "_weight_size": 24.759, }, ) IMAGENET1K_FBGEMM_V2 = Weights( @@ -209,6 +213,8 @@ class ResNet50_QuantizedWeights(WeightsEnum): "acc@5": 94.976, } }, + "_ops": 4.089, + "_weight_size": 24.953, }, ) DEFAULT = IMAGENET1K_FBGEMM_V2 @@ -228,6 +234,8 @@ class ResNeXt101_32X8D_QuantizedWeights(WeightsEnum): "acc@5": 94.480, } }, + "_ops": 16.414, + "_weight_size": 86.034, }, ) IMAGENET1K_FBGEMM_V2 = Weights( @@ -243,6 +251,8 @@ class ResNeXt101_32X8D_QuantizedWeights(WeightsEnum): "acc@5": 96.132, } }, + "_ops": 16.414, + "_weight_size": 86.645, }, ) DEFAULT = IMAGENET1K_FBGEMM_V2 @@ -263,6 +273,8 @@ class ResNeXt101_64X4D_QuantizedWeights(WeightsEnum): "acc@5": 96.326, } }, + "_ops": 15.46, + "_weight_size": 81.556, }, ) DEFAULT = IMAGENET1K_FBGEMM_V1 diff --git a/torchvision/models/quantization/shufflenetv2.py b/torchvision/models/quantization/shufflenetv2.py index a6317e28b23..11d89c0b32d 100644 --- a/torchvision/models/quantization/shufflenetv2.py +++ b/torchvision/models/quantization/shufflenetv2.py @@ -139,6 +139,8 @@ class ShuffleNet_V2_X0_5_QuantizedWeights(WeightsEnum): "acc@5": 79.780, } }, + "_ops": 0.04, + "_weight_size": 1.501, }, ) DEFAULT = IMAGENET1K_FBGEMM_V1 @@ -158,6 +160,8 @@ class ShuffleNet_V2_X1_0_QuantizedWeights(WeightsEnum): "acc@5": 87.582, } }, + "_ops": 0.145, + "_weight_size": 2.334, }, ) DEFAULT = IMAGENET1K_FBGEMM_V1 @@ -178,6 +182,8 @@ class ShuffleNet_V2_X1_5_QuantizedWeights(WeightsEnum): "acc@5": 90.700, } }, + "_ops": 0.296, + "_weight_size": 3.672, }, ) DEFAULT = IMAGENET1K_FBGEMM_V1 @@ -198,6 +204,8 @@ class ShuffleNet_V2_X2_0_QuantizedWeights(WeightsEnum): "acc@5": 92.488, } }, + "_ops": 0.583, + "_weight_size": 7.467, }, ) DEFAULT = IMAGENET1K_FBGEMM_V1 diff --git a/torchvision/models/regnet.py b/torchvision/models/regnet.py index 866e62c164d..a60262c3b34 100644 --- a/torchvision/models/regnet.py +++ b/torchvision/models/regnet.py @@ -428,6 +428,8 @@ class RegNet_Y_400MF_Weights(WeightsEnum): "acc@5": 91.716, } }, + "_ops": 0.402, + "_weight_size": 16.806, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -444,6 +446,8 @@ class RegNet_Y_400MF_Weights(WeightsEnum): "acc@5": 92.742, } }, + "_ops": 0.402, + "_weight_size": 16.806, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -468,6 +472,8 @@ class RegNet_Y_800MF_Weights(WeightsEnum): "acc@5": 93.136, } }, + "_ops": 0.834, + "_weight_size": 24.774, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -484,6 +490,8 @@ class RegNet_Y_800MF_Weights(WeightsEnum): "acc@5": 94.502, } }, + "_ops": 0.834, + "_weight_size": 24.774, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -508,6 +516,8 @@ class RegNet_Y_1_6GF_Weights(WeightsEnum): "acc@5": 93.966, } }, + "_ops": 1.612, + "_weight_size": 43.152, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -524,6 +534,8 @@ class RegNet_Y_1_6GF_Weights(WeightsEnum): "acc@5": 95.444, } }, + "_ops": 1.612, + "_weight_size": 43.152, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -548,6 +560,8 @@ class RegNet_Y_3_2GF_Weights(WeightsEnum): "acc@5": 94.576, } }, + "_ops": 3.176, + "_weight_size": 74.567, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -564,6 +578,8 @@ class RegNet_Y_3_2GF_Weights(WeightsEnum): "acc@5": 95.972, } }, + "_ops": 3.176, + "_weight_size": 74.567, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -588,6 +604,8 @@ class RegNet_Y_8GF_Weights(WeightsEnum): "acc@5": 95.048, } }, + "_ops": 8.473, + "_weight_size": 150.701, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -604,6 +622,8 @@ class RegNet_Y_8GF_Weights(WeightsEnum): "acc@5": 96.330, } }, + "_ops": 8.473, + "_weight_size": 150.701, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -628,6 +648,8 @@ class RegNet_Y_16GF_Weights(WeightsEnum): "acc@5": 95.240, } }, + "_ops": 15.912, + "_weight_size": 319.49, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -644,6 +666,8 @@ class RegNet_Y_16GF_Weights(WeightsEnum): "acc@5": 96.328, } }, + "_ops": 15.912, + "_weight_size": 319.49, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -665,6 +689,8 @@ class RegNet_Y_16GF_Weights(WeightsEnum): "acc@5": 98.054, } }, + "_ops": 46.735, + "_weight_size": 319.49, "_docs": """ These weights are learnt via transfer learning by end-to-end fine-tuning the original `SWAG `_ weights on ImageNet-1K data. @@ -686,6 +712,8 @@ class RegNet_Y_16GF_Weights(WeightsEnum): "acc@5": 97.244, } }, + "_ops": 15.912, + "_weight_size": 319.49, "_docs": """ These weights are composed of the original frozen `SWAG `_ trunk weights and a linear classifier learnt on top of them trained on ImageNet-1K data. @@ -709,6 +737,8 @@ class RegNet_Y_32GF_Weights(WeightsEnum): "acc@5": 95.340, } }, + "_ops": 32.28, + "_weight_size": 554.076, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -725,6 +755,8 @@ class RegNet_Y_32GF_Weights(WeightsEnum): "acc@5": 96.498, } }, + "_ops": 32.28, + "_weight_size": 554.076, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -746,6 +778,8 @@ class RegNet_Y_32GF_Weights(WeightsEnum): "acc@5": 98.362, } }, + "_ops": 94.826, + "_weight_size": 554.076, "_docs": """ These weights are learnt via transfer learning by end-to-end fine-tuning the original `SWAG `_ weights on ImageNet-1K data. @@ -767,6 +801,8 @@ class RegNet_Y_32GF_Weights(WeightsEnum): "acc@5": 97.480, } }, + "_ops": 32.28, + "_weight_size": 554.076, "_docs": """ These weights are composed of the original frozen `SWAG `_ trunk weights and a linear classifier learnt on top of them trained on ImageNet-1K data. @@ -791,6 +827,8 @@ class RegNet_Y_128GF_Weights(WeightsEnum): "acc@5": 98.682, } }, + "_ops": 374.57, + "_weight_size": 2461.564, "_docs": """ These weights are learnt via transfer learning by end-to-end fine-tuning the original `SWAG `_ weights on ImageNet-1K data. @@ -812,6 +850,8 @@ class RegNet_Y_128GF_Weights(WeightsEnum): "acc@5": 97.844, } }, + "_ops": 127.518, + "_weight_size": 2461.564, "_docs": """ These weights are composed of the original frozen `SWAG `_ trunk weights and a linear classifier learnt on top of them trained on ImageNet-1K data. @@ -835,6 +875,8 @@ class RegNet_X_400MF_Weights(WeightsEnum): "acc@5": 90.950, } }, + "_ops": 0.414, + "_weight_size": 21.258, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -851,6 +893,8 @@ class RegNet_X_400MF_Weights(WeightsEnum): "acc@5": 92.322, } }, + "_ops": 0.414, + "_weight_size": 21.257, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -875,6 +919,8 @@ class RegNet_X_800MF_Weights(WeightsEnum): "acc@5": 92.348, } }, + "_ops": 0.8, + "_weight_size": 27.945, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -891,6 +937,8 @@ class RegNet_X_800MF_Weights(WeightsEnum): "acc@5": 93.826, } }, + "_ops": 0.8, + "_weight_size": 27.945, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -915,6 +963,8 @@ class RegNet_X_1_6GF_Weights(WeightsEnum): "acc@5": 93.440, } }, + "_ops": 1.603, + "_weight_size": 35.339, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -931,6 +981,8 @@ class RegNet_X_1_6GF_Weights(WeightsEnum): "acc@5": 94.922, } }, + "_ops": 1.603, + "_weight_size": 35.339, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -955,6 +1007,8 @@ class RegNet_X_3_2GF_Weights(WeightsEnum): "acc@5": 93.992, } }, + "_ops": 3.177, + "_weight_size": 58.756, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -971,6 +1025,8 @@ class RegNet_X_3_2GF_Weights(WeightsEnum): "acc@5": 95.430, } }, + "_ops": 3.177, + "_weight_size": 58.756, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -995,6 +1051,8 @@ class RegNet_X_8GF_Weights(WeightsEnum): "acc@5": 94.686, } }, + "_ops": 7.995, + "_weight_size": 151.456, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -1011,6 +1069,8 @@ class RegNet_X_8GF_Weights(WeightsEnum): "acc@5": 95.678, } }, + "_ops": 7.995, + "_weight_size": 151.456, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -1035,6 +1095,8 @@ class RegNet_X_16GF_Weights(WeightsEnum): "acc@5": 94.944, } }, + "_ops": 15.941, + "_weight_size": 207.627, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -1051,6 +1113,8 @@ class RegNet_X_16GF_Weights(WeightsEnum): "acc@5": 96.196, } }, + "_ops": 15.941, + "_weight_size": 207.627, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe @@ -1075,6 +1139,8 @@ class RegNet_X_32GF_Weights(WeightsEnum): "acc@5": 95.248, } }, + "_ops": 31.736, + "_weight_size": 412.039, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -1091,6 +1157,8 @@ class RegNet_X_32GF_Weights(WeightsEnum): "acc@5": 96.288, } }, + "_ops": 31.736, + "_weight_size": 412.039, "_docs": """ These weights improve upon the results of the original paper by using a modified version of TorchVision's `new training recipe diff --git a/torchvision/models/resnet.py b/torchvision/models/resnet.py index dbf14463eaf..80eb4666907 100644 --- a/torchvision/models/resnet.py +++ b/torchvision/models/resnet.py @@ -323,6 +323,8 @@ class ResNet18_Weights(WeightsEnum): "acc@5": 89.078, } }, + "_ops": 1.814, + "_weight_size": 44.661, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -343,6 +345,8 @@ class ResNet34_Weights(WeightsEnum): "acc@5": 91.420, } }, + "_ops": 3.664, + "_weight_size": 83.275, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -363,6 +367,8 @@ class ResNet50_Weights(WeightsEnum): "acc@5": 92.862, } }, + "_ops": 4.089, + "_weight_size": 97.781, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -379,6 +385,8 @@ class ResNet50_Weights(WeightsEnum): "acc@5": 95.434, } }, + "_ops": 4.089, + "_weight_size": 97.79, "_docs": """ These weights improve upon the results of the original paper by using TorchVision's `new training recipe `_. @@ -402,6 +410,8 @@ class ResNet101_Weights(WeightsEnum): "acc@5": 93.546, } }, + "_ops": 7.801, + "_weight_size": 170.511, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -418,6 +428,8 @@ class ResNet101_Weights(WeightsEnum): "acc@5": 95.780, } }, + "_ops": 7.801, + "_weight_size": 170.53, "_docs": """ These weights improve upon the results of the original paper by using TorchVision's `new training recipe `_. @@ -441,6 +453,8 @@ class ResNet152_Weights(WeightsEnum): "acc@5": 94.046, } }, + "_ops": 11.514, + "_weight_size": 230.434, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -457,6 +471,8 @@ class ResNet152_Weights(WeightsEnum): "acc@5": 96.002, } }, + "_ops": 11.514, + "_weight_size": 230.474, "_docs": """ These weights improve upon the results of the original paper by using TorchVision's `new training recipe `_. @@ -480,6 +496,8 @@ class ResNeXt50_32X4D_Weights(WeightsEnum): "acc@5": 93.698, } }, + "_ops": 4.23, + "_weight_size": 95.789, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -496,6 +514,8 @@ class ResNeXt50_32X4D_Weights(WeightsEnum): "acc@5": 95.340, } }, + "_ops": 4.23, + "_weight_size": 95.833, "_docs": """ These weights improve upon the results of the original paper by using TorchVision's `new training recipe `_. @@ -519,6 +539,8 @@ class ResNeXt101_32X8D_Weights(WeightsEnum): "acc@5": 94.526, } }, + "_ops": 16.414, + "_weight_size": 339.586, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -535,6 +557,8 @@ class ResNeXt101_32X8D_Weights(WeightsEnum): "acc@5": 96.228, } }, + "_ops": 16.414, + "_weight_size": 339.673, "_docs": """ These weights improve upon the results of the original paper by using TorchVision's `new training recipe `_. @@ -558,6 +582,8 @@ class ResNeXt101_64X4D_Weights(WeightsEnum): "acc@5": 96.454, } }, + "_ops": 15.46, + "_weight_size": 319.318, "_docs": """ These weights were trained from scratch by using TorchVision's `new training recipe `_. @@ -581,6 +607,8 @@ class Wide_ResNet50_2_Weights(WeightsEnum): "acc@5": 94.086, } }, + "_ops": 11.398, + "_weight_size": 131.82, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -597,6 +625,8 @@ class Wide_ResNet50_2_Weights(WeightsEnum): "acc@5": 95.758, } }, + "_ops": 11.398, + "_weight_size": 263.124, "_docs": """ These weights improve upon the results of the original paper by using TorchVision's `new training recipe `_. @@ -620,6 +650,8 @@ class Wide_ResNet101_2_Weights(WeightsEnum): "acc@5": 94.284, } }, + "_ops": 22.753, + "_weight_size": 242.896, "_docs": """These weights reproduce closely the results of the paper using a simple training recipe.""", }, ) @@ -636,6 +668,8 @@ class Wide_ResNet101_2_Weights(WeightsEnum): "acc@5": 96.020, } }, + "_ops": 22.753, + "_weight_size": 484.747, "_docs": """ These weights improve upon the results of the original paper by using TorchVision's `new training recipe `_. diff --git a/torchvision/models/segmentation/deeplabv3.py b/torchvision/models/segmentation/deeplabv3.py index 29ab0154807..ce586738089 100644 --- a/torchvision/models/segmentation/deeplabv3.py +++ b/torchvision/models/segmentation/deeplabv3.py @@ -152,6 +152,8 @@ class DeepLabV3_ResNet50_Weights(WeightsEnum): "pixel_acc": 92.4, } }, + "_ops": 178.722, + "_weight_size": 160.515, }, ) DEFAULT = COCO_WITH_VOC_LABELS_V1 @@ -171,6 +173,8 @@ class DeepLabV3_ResNet101_Weights(WeightsEnum): "pixel_acc": 92.4, } }, + "_ops": 258.743, + "_weight_size": 233.217, }, ) DEFAULT = COCO_WITH_VOC_LABELS_V1 @@ -190,6 +194,8 @@ class DeepLabV3_MobileNet_V3_Large_Weights(WeightsEnum): "pixel_acc": 91.2, } }, + "_ops": 10.452, + "_weight_size": 42.301, }, ) DEFAULT = COCO_WITH_VOC_LABELS_V1 diff --git a/torchvision/models/segmentation/fcn.py b/torchvision/models/segmentation/fcn.py index 6f1c9c4b80b..8031a7d0d30 100644 --- a/torchvision/models/segmentation/fcn.py +++ b/torchvision/models/segmentation/fcn.py @@ -71,6 +71,8 @@ class FCN_ResNet50_Weights(WeightsEnum): "pixel_acc": 91.4, } }, + "_ops": 152.717, + "_weight_size": 135.009, }, ) DEFAULT = COCO_WITH_VOC_LABELS_V1 @@ -90,6 +92,8 @@ class FCN_ResNet101_Weights(WeightsEnum): "pixel_acc": 91.9, } }, + "_ops": 232.738, + "_weight_size": 207.711, }, ) DEFAULT = COCO_WITH_VOC_LABELS_V1 diff --git a/torchvision/models/segmentation/lraspp.py b/torchvision/models/segmentation/lraspp.py index 44c96f1c272..e90a2917d40 100644 --- a/torchvision/models/segmentation/lraspp.py +++ b/torchvision/models/segmentation/lraspp.py @@ -108,6 +108,8 @@ class LRASPP_MobileNet_V3_Large_Weights(WeightsEnum): "pixel_acc": 91.2, } }, + "_ops": 2.086, + "_weight_size": 12.49, "_docs": """ These weights were trained on a subset of COCO, using only the 20 categories that are present in the Pascal VOC dataset. diff --git a/torchvision/models/shufflenetv2.py b/torchvision/models/shufflenetv2.py index 159e1be3bc8..005b338b7e6 100644 --- a/torchvision/models/shufflenetv2.py +++ b/torchvision/models/shufflenetv2.py @@ -204,6 +204,8 @@ class ShuffleNet_V2_X0_5_Weights(WeightsEnum): "acc@5": 81.746, } }, + "_ops": 0.04, + "_weight_size": 5.282, "_docs": """These weights were trained from scratch to reproduce closely the results of the paper.""", }, ) @@ -224,6 +226,8 @@ class ShuffleNet_V2_X1_0_Weights(WeightsEnum): "acc@5": 88.316, } }, + "_ops": 0.145, + "_weight_size": 8.791, "_docs": """These weights were trained from scratch to reproduce closely the results of the paper.""", }, ) @@ -244,6 +248,8 @@ class ShuffleNet_V2_X1_5_Weights(WeightsEnum): "acc@5": 91.086, } }, + "_ops": 0.296, + "_weight_size": 13.557, "_docs": """ These weights were trained from scratch by using TorchVision's `new training recipe `_. @@ -267,6 +273,8 @@ class ShuffleNet_V2_X2_0_Weights(WeightsEnum): "acc@5": 93.006, } }, + "_ops": 0.583, + "_weight_size": 28.433, "_docs": """ These weights were trained from scratch by using TorchVision's `new training recipe `_. diff --git a/torchvision/models/squeezenet.py b/torchvision/models/squeezenet.py index 9fe6521e1a1..94f5d50e6e9 100644 --- a/torchvision/models/squeezenet.py +++ b/torchvision/models/squeezenet.py @@ -135,6 +135,8 @@ class SqueezeNet1_0_Weights(WeightsEnum): "acc@5": 80.420, } }, + "_ops": 0.819, + "_weight_size": 4.778, }, ) DEFAULT = IMAGENET1K_V1 @@ -154,6 +156,8 @@ class SqueezeNet1_1_Weights(WeightsEnum): "acc@5": 80.624, } }, + "_ops": 0.349, + "_weight_size": 4.729, }, ) DEFAULT = IMAGENET1K_V1 diff --git a/torchvision/models/swin_transformer.py b/torchvision/models/swin_transformer.py index 64714c3afac..47498e66d7e 100644 --- a/torchvision/models/swin_transformer.py +++ b/torchvision/models/swin_transformer.py @@ -660,6 +660,8 @@ class Swin_T_Weights(WeightsEnum): "acc@5": 95.776, } }, + "_ops": 4.491, + "_weight_size": 108.19, "_docs": """These weights reproduce closely the results of the paper using a similar training recipe.""", }, ) @@ -683,6 +685,8 @@ class Swin_S_Weights(WeightsEnum): "acc@5": 96.360, } }, + "_ops": 8.741, + "_weight_size": 189.786, "_docs": """These weights reproduce closely the results of the paper using a similar training recipe.""", }, ) @@ -706,6 +710,8 @@ class Swin_B_Weights(WeightsEnum): "acc@5": 96.640, } }, + "_ops": 15.431, + "_weight_size": 335.364, "_docs": """These weights reproduce closely the results of the paper using a similar training recipe.""", }, ) @@ -729,6 +735,8 @@ class Swin_V2_T_Weights(WeightsEnum): "acc@5": 96.132, } }, + "_ops": 5.94, + "_weight_size": 108.626, "_docs": """These weights reproduce closely the results of the paper using a similar training recipe.""", }, ) @@ -752,6 +760,8 @@ class Swin_V2_S_Weights(WeightsEnum): "acc@5": 96.816, } }, + "_ops": 11.546, + "_weight_size": 190.675, "_docs": """These weights reproduce closely the results of the paper using a similar training recipe.""", }, ) @@ -775,6 +785,8 @@ class Swin_V2_B_Weights(WeightsEnum): "acc@5": 96.864, } }, + "_ops": 20.325, + "_weight_size": 336.372, "_docs": """These weights reproduce closely the results of the paper using a similar training recipe.""", }, ) diff --git a/torchvision/models/vgg.py b/torchvision/models/vgg.py index dea783c2fb1..6725dedd404 100644 --- a/torchvision/models/vgg.py +++ b/torchvision/models/vgg.py @@ -127,6 +127,8 @@ class VGG11_Weights(WeightsEnum): "acc@5": 88.628, } }, + "_ops": 7.609, + "_weight_size": 506.84, }, ) DEFAULT = IMAGENET1K_V1 @@ -145,6 +147,8 @@ class VGG11_BN_Weights(WeightsEnum): "acc@5": 89.810, } }, + "_ops": 7.609, + "_weight_size": 506.881, }, ) DEFAULT = IMAGENET1K_V1 @@ -163,6 +167,8 @@ class VGG13_Weights(WeightsEnum): "acc@5": 89.246, } }, + "_ops": 11.308, + "_weight_size": 507.545, }, ) DEFAULT = IMAGENET1K_V1 @@ -181,6 +187,8 @@ class VGG13_BN_Weights(WeightsEnum): "acc@5": 90.374, } }, + "_ops": 11.308, + "_weight_size": 507.59, }, ) DEFAULT = IMAGENET1K_V1 @@ -199,6 +207,8 @@ class VGG16_Weights(WeightsEnum): "acc@5": 90.382, } }, + "_ops": 15.47, + "_weight_size": 527.796, }, ) IMAGENET1K_FEATURES = Weights( @@ -221,6 +231,8 @@ class VGG16_Weights(WeightsEnum): "acc@5": float("nan"), } }, + "_ops": 15.47, + "_weight_size": 527.802, "_docs": """ These weights can't be used for classification because they are missing values in the `classifier` module. Only the `features` module has valid values and can be used for feature extraction. The weights @@ -244,6 +256,8 @@ class VGG16_BN_Weights(WeightsEnum): "acc@5": 91.516, } }, + "_ops": 15.47, + "_weight_size": 527.866, }, ) DEFAULT = IMAGENET1K_V1 @@ -262,6 +276,8 @@ class VGG19_Weights(WeightsEnum): "acc@5": 90.876, } }, + "_ops": 19.632, + "_weight_size": 548.051, }, ) DEFAULT = IMAGENET1K_V1 @@ -280,6 +296,8 @@ class VGG19_BN_Weights(WeightsEnum): "acc@5": 91.842, } }, + "_ops": 19.632, + "_weight_size": 548.143, }, ) DEFAULT = IMAGENET1K_V1 diff --git a/torchvision/models/video/mvit.py b/torchvision/models/video/mvit.py index 1b5118b53f5..d20d6e907f1 100644 --- a/torchvision/models/video/mvit.py +++ b/torchvision/models/video/mvit.py @@ -624,6 +624,8 @@ class MViT_V1_B_Weights(WeightsEnum): "acc@5": 93.582, } }, + "_ops": 70.599, + "_weight_size": 139.764, }, ) DEFAULT = KINETICS400_V1 @@ -655,6 +657,8 @@ class MViT_V2_S_Weights(WeightsEnum): "acc@5": 94.665, } }, + "_ops": 64.224, + "_weight_size": 131.884, }, ) DEFAULT = KINETICS400_V1 diff --git a/torchvision/models/video/resnet.py b/torchvision/models/video/resnet.py index 352ae92d194..6f5bd876457 100644 --- a/torchvision/models/video/resnet.py +++ b/torchvision/models/video/resnet.py @@ -332,6 +332,8 @@ class R3D_18_Weights(WeightsEnum): "acc@5": 83.479, } }, + "_ops": 40.697, + "_weight_size": 127.359, }, ) DEFAULT = KINETICS400_V1 @@ -350,6 +352,8 @@ class MC3_18_Weights(WeightsEnum): "acc@5": 84.130, } }, + "_ops": 43.343, + "_weight_size": 44.672, }, ) DEFAULT = KINETICS400_V1 @@ -368,6 +372,8 @@ class R2Plus1D_18_Weights(WeightsEnum): "acc@5": 86.175, } }, + "_ops": 40.519, + "_weight_size": 120.318, }, ) DEFAULT = KINETICS400_V1 diff --git a/torchvision/models/video/s3d.py b/torchvision/models/video/s3d.py index 53e3e841a27..64874712f66 100644 --- a/torchvision/models/video/s3d.py +++ b/torchvision/models/video/s3d.py @@ -175,6 +175,8 @@ class S3D_Weights(WeightsEnum): "acc@5": 88.050, } }, + "_ops": 17.979, + "_weight_size": 31.972, }, ) DEFAULT = KINETICS400_V1 diff --git a/torchvision/models/vision_transformer.py b/torchvision/models/vision_transformer.py index be62ce1ce96..06a47c03ae6 100644 --- a/torchvision/models/vision_transformer.py +++ b/torchvision/models/vision_transformer.py @@ -363,6 +363,8 @@ class ViT_B_16_Weights(WeightsEnum): "acc@5": 95.318, } }, + "_ops": 17.564, + "_weight_size": 330.285, "_docs": """ These weights were trained from scratch by using a modified version of `DeIT `_'s training recipe. @@ -387,6 +389,8 @@ class ViT_B_16_Weights(WeightsEnum): "acc@5": 97.650, } }, + "_ops": 55.484, + "_weight_size": 331.398, "_docs": """ These weights are learnt via transfer learning by end-to-end fine-tuning the original `SWAG `_ weights on ImageNet-1K data. @@ -412,6 +416,8 @@ class ViT_B_16_Weights(WeightsEnum): "acc@5": 96.180, } }, + "_ops": 17.564, + "_weight_size": 330.285, "_docs": """ These weights are composed of the original frozen `SWAG `_ trunk weights and a linear classifier learnt on top of them trained on ImageNet-1K data. @@ -436,6 +442,8 @@ class ViT_B_32_Weights(WeightsEnum): "acc@5": 92.466, } }, + "_ops": 4.409, + "_weight_size": 336.604, "_docs": """ These weights were trained from scratch by using a modified version of `DeIT `_'s training recipe. @@ -460,6 +468,8 @@ class ViT_L_16_Weights(WeightsEnum): "acc@5": 94.638, } }, + "_ops": 61.555, + "_weight_size": 1161.023, "_docs": """ These weights were trained from scratch by using a modified version of TorchVision's `new training recipe @@ -485,6 +495,8 @@ class ViT_L_16_Weights(WeightsEnum): "acc@5": 98.512, } }, + "_ops": 361.986, + "_weight_size": 1164.258, "_docs": """ These weights are learnt via transfer learning by end-to-end fine-tuning the original `SWAG `_ weights on ImageNet-1K data. @@ -510,6 +522,8 @@ class ViT_L_16_Weights(WeightsEnum): "acc@5": 97.422, } }, + "_ops": 61.555, + "_weight_size": 1161.023, "_docs": """ These weights are composed of the original frozen `SWAG `_ trunk weights and a linear classifier learnt on top of them trained on ImageNet-1K data. @@ -534,6 +548,8 @@ class ViT_L_32_Weights(WeightsEnum): "acc@5": 93.07, } }, + "_ops": 15.378, + "_weight_size": 1169.449, "_docs": """ These weights were trained from scratch by using a modified version of `DeIT `_'s training recipe. @@ -562,6 +578,8 @@ class ViT_H_14_Weights(WeightsEnum): "acc@5": 98.694, } }, + "_ops": 1016.717, + "_weight_size": 2416.643, "_docs": """ These weights are learnt via transfer learning by end-to-end fine-tuning the original `SWAG `_ weights on ImageNet-1K data. @@ -587,6 +605,8 @@ class ViT_H_14_Weights(WeightsEnum): "acc@5": 97.730, } }, + "_ops": 167.295, + "_weight_size": 2411.209, "_docs": """ These weights are composed of the original frozen `SWAG `_ trunk weights and a linear classifier learnt on top of them trained on ImageNet-1K data.