Skip to content

Commit c53f5b7

Browse files
datumboxfacebook-github-bot
authored andcommitted
[fbsync] Add regnet model from SWAG (#5722)
Summary: * Add regnet_y_16gf and regnet_y_32gf from swag * Format with ufmt * Add the experiment accuracy Reviewed By: NicolasHug Differential Revision: D35393157 fbshipit-source-id: 81a26e937296567eca829c25b31026a9662b7d16 Co-authored-by: Vasilis Vryniotis <[email protected]>
1 parent b4d5946 commit c53f5b7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

torchvision/models/regnet.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,15 @@ def _regnet(
412412
"interpolation": InterpolationMode.BILINEAR,
413413
}
414414

415+
_COMMON_SWAG_META = {
416+
**_COMMON_META,
417+
"publication_year": 2022,
418+
"size": (384, 384),
419+
"recipe": "https://github.com/facebookresearch/SWAG",
420+
"license": "https://github.com/facebookresearch/SWAG/blob/main/LICENSE",
421+
"interpolation": InterpolationMode.BICUBIC,
422+
}
423+
415424

416425
class RegNet_Y_400MF_Weights(WeightsEnum):
417426
IMAGENET1K_V1 = Weights(
@@ -566,6 +575,18 @@ class RegNet_Y_16GF_Weights(WeightsEnum):
566575
"acc@5": 96.328,
567576
},
568577
)
578+
IMAGENET1K_SWAG_V1 = Weights(
579+
url="https://download.pytorch.org/models/regnet_y_16gf_swag-43afe44d.pth",
580+
transforms=partial(
581+
ImageClassification, crop_size=384, resize_size=384, interpolation=InterpolationMode.BICUBIC
582+
),
583+
meta={
584+
**_COMMON_SWAG_META,
585+
"num_params": 83590140,
586+
"acc@1": 86.012,
587+
"acc@5": 98.054,
588+
},
589+
)
569590
DEFAULT = IMAGENET1K_V2
570591

571592

@@ -592,6 +613,18 @@ class RegNet_Y_32GF_Weights(WeightsEnum):
592613
"acc@5": 96.498,
593614
},
594615
)
616+
IMAGENET1K_SWAG_V1 = Weights(
617+
url="https://download.pytorch.org/models/regnet_y_32gf_swag-04fdfa75.pth",
618+
transforms=partial(
619+
ImageClassification, crop_size=384, resize_size=384, interpolation=InterpolationMode.BICUBIC
620+
),
621+
meta={
622+
**_COMMON_SWAG_META,
623+
"num_params": 145046770,
624+
"acc@1": 86.838,
625+
"acc@5": 98.362,
626+
},
627+
)
595628
DEFAULT = IMAGENET1K_V2
596629

597630

0 commit comments

Comments
 (0)