@@ -57,17 +57,30 @@ def _efficientnet(
57
57
return model
58
58
59
59
60
- _COMMON_META_V1 = {
60
+ _COMMON_META = {
61
61
"task" : "image_classification" ,
62
- "architecture" : "EfficientNet" ,
63
- "publication_year" : 2019 ,
64
- "min_size" : (1 , 1 ),
65
62
"categories" : _IMAGENET_CATEGORIES ,
66
63
"interpolation" : InterpolationMode .BICUBIC ,
67
64
"recipe" : "https://github.com/pytorch/vision/tree/main/references/classification#efficientnet" ,
68
65
}
69
66
70
67
68
+ _COMMON_META_V1 = {
69
+ ** _COMMON_META ,
70
+ "architecture" : "EfficientNet" ,
71
+ "publication_year" : 2019 ,
72
+ "min_size" : (1 , 1 ),
73
+ }
74
+
75
+
76
+ _COMMON_META_V2 = {
77
+ ** _COMMON_META ,
78
+ "architecture" : "EfficientNetV2" ,
79
+ "publication_year" : 2021 ,
80
+ "min_size" : (33 , 33 ),
81
+ }
82
+
83
+
71
84
class EfficientNet_B0_Weights (WeightsEnum ):
72
85
IMAGENET1K_V1 = Weights (
73
86
url = "https://download.pytorch.org/models/efficientnet_b0_rwightman-3dd342df.pth" ,
@@ -202,7 +215,25 @@ class EfficientNet_B7_Weights(WeightsEnum):
202
215
203
216
204
217
class EfficientNet_V2_S_Weights (WeightsEnum ):
205
- pass
218
+ IMAGENET1K_V1 = Weights (
219
+ url = "https://download.pytorch.org/models/efficientnet_v2_s-tmp.pth" ,
220
+ transforms = partial (
221
+ ImageNetEval ,
222
+ crop_size = 384 ,
223
+ resize_size = 384 ,
224
+ interpolation = InterpolationMode .BICUBIC ,
225
+ mean = (0.5 , 0.5 , 0.5 ),
226
+ std = (0.5 , 0.5 , 0.5 ),
227
+ ),
228
+ meta = {
229
+ ** _COMMON_META_V2 ,
230
+ "num_params" : 21458488 ,
231
+ "size" : (384 , 384 ),
232
+ "acc@1" : 83.152 ,
233
+ "acc@5" : 96.400 ,
234
+ },
235
+ )
236
+ DEFAULT = IMAGENET1K_V1
206
237
207
238
208
239
class EfficientNet_V2_M_Weights (WeightsEnum ):
@@ -317,7 +348,7 @@ def efficientnet_b7(
317
348
)
318
349
319
350
320
- @handle_legacy_interface (weights = ("pretrained" , None ))
351
+ @handle_legacy_interface (weights = ("pretrained" , EfficientNet_V2_S_Weights . IMAGENET1K_V1 ))
321
352
def efficientnet_v2_s (
322
353
* , weights : Optional [EfficientNet_V2_S_Weights ] = None , progress : bool = True , ** kwargs : Any
323
354
) -> EfficientNet :
0 commit comments