@@ -431,24 +431,26 @@ def _efficientnet_conf(
431
431
432
432
_COMMON_META : Dict [str , Any ] = {
433
433
"categories" : _IMAGENET_CATEGORIES ,
434
- "recipe" : "https://github.com/pytorch/vision/tree/main/references/classification#efficientnet" ,
435
434
}
436
435
437
436
438
437
_COMMON_META_V1 = {
439
438
** _COMMON_META ,
440
439
"min_size" : (1 , 1 ),
440
+ "recipe" : "https://github.com/pytorch/vision/tree/main/references/classification#efficientnet-v1" ,
441
441
}
442
442
443
443
444
444
_COMMON_META_V2 = {
445
445
** _COMMON_META ,
446
446
"min_size" : (33 , 33 ),
447
+ "recipe" : "https://github.com/pytorch/vision/tree/main/references/classification#efficientnet-v2" ,
447
448
}
448
449
449
450
450
451
class EfficientNet_B0_Weights (WeightsEnum ):
451
452
IMAGENET1K_V1 = Weights (
453
+ # Weights ported from https://github.com/rwightman/pytorch-image-models/
452
454
url = "https://download.pytorch.org/models/efficientnet_b0_rwightman-3dd342df.pth" ,
453
455
transforms = partial (
454
456
ImageClassification , crop_size = 224 , resize_size = 256 , interpolation = InterpolationMode .BICUBIC
@@ -460,13 +462,15 @@ class EfficientNet_B0_Weights(WeightsEnum):
460
462
"acc@1" : 77.692 ,
461
463
"acc@5" : 93.532 ,
462
464
},
465
+ "_docs" : """These weights are ported from the original paper.""" ,
463
466
},
464
467
)
465
468
DEFAULT = IMAGENET1K_V1
466
469
467
470
468
471
class EfficientNet_B1_Weights (WeightsEnum ):
469
472
IMAGENET1K_V1 = Weights (
473
+ # Weights ported from https://github.com/rwightman/pytorch-image-models/
470
474
url = "https://download.pytorch.org/models/efficientnet_b1_rwightman-533bc792.pth" ,
471
475
transforms = partial (
472
476
ImageClassification , crop_size = 240 , resize_size = 256 , interpolation = InterpolationMode .BICUBIC
@@ -478,6 +482,7 @@ class EfficientNet_B1_Weights(WeightsEnum):
478
482
"acc@1" : 78.642 ,
479
483
"acc@5" : 94.186 ,
480
484
},
485
+ "_docs" : """These weights are ported from the original paper.""" ,
481
486
},
482
487
)
483
488
IMAGENET1K_V2 = Weights (
@@ -493,13 +498,19 @@ class EfficientNet_B1_Weights(WeightsEnum):
493
498
"acc@1" : 79.838 ,
494
499
"acc@5" : 94.934 ,
495
500
},
501
+ "_docs" : """
502
+ These weights improve upon the results of the original paper by using a modified version of TorchVision's
503
+ `new training recipe
504
+ <https://pytorch.org/blog/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives/>`_.
505
+ """ ,
496
506
},
497
507
)
498
508
DEFAULT = IMAGENET1K_V2
499
509
500
510
501
511
class EfficientNet_B2_Weights (WeightsEnum ):
502
512
IMAGENET1K_V1 = Weights (
513
+ # Weights ported from https://github.com/rwightman/pytorch-image-models/
503
514
url = "https://download.pytorch.org/models/efficientnet_b2_rwightman-bcdf34b7.pth" ,
504
515
transforms = partial (
505
516
ImageClassification , crop_size = 288 , resize_size = 288 , interpolation = InterpolationMode .BICUBIC
@@ -511,13 +522,15 @@ class EfficientNet_B2_Weights(WeightsEnum):
511
522
"acc@1" : 80.608 ,
512
523
"acc@5" : 95.310 ,
513
524
},
525
+ "_docs" : """These weights are ported from the original paper.""" ,
514
526
},
515
527
)
516
528
DEFAULT = IMAGENET1K_V1
517
529
518
530
519
531
class EfficientNet_B3_Weights (WeightsEnum ):
520
532
IMAGENET1K_V1 = Weights (
533
+ # Weights ported from https://github.com/rwightman/pytorch-image-models/
521
534
url = "https://download.pytorch.org/models/efficientnet_b3_rwightman-cf984f9c.pth" ,
522
535
transforms = partial (
523
536
ImageClassification , crop_size = 300 , resize_size = 320 , interpolation = InterpolationMode .BICUBIC
@@ -529,13 +542,15 @@ class EfficientNet_B3_Weights(WeightsEnum):
529
542
"acc@1" : 82.008 ,
530
543
"acc@5" : 96.054 ,
531
544
},
545
+ "_docs" : """These weights are ported from the original paper.""" ,
532
546
},
533
547
)
534
548
DEFAULT = IMAGENET1K_V1
535
549
536
550
537
551
class EfficientNet_B4_Weights (WeightsEnum ):
538
552
IMAGENET1K_V1 = Weights (
553
+ # Weights ported from https://github.com/rwightman/pytorch-image-models/
539
554
url = "https://download.pytorch.org/models/efficientnet_b4_rwightman-7eb33cd5.pth" ,
540
555
transforms = partial (
541
556
ImageClassification , crop_size = 380 , resize_size = 384 , interpolation = InterpolationMode .BICUBIC
@@ -547,13 +562,15 @@ class EfficientNet_B4_Weights(WeightsEnum):
547
562
"acc@1" : 83.384 ,
548
563
"acc@5" : 96.594 ,
549
564
},
565
+ "_docs" : """These weights are ported from the original paper.""" ,
550
566
},
551
567
)
552
568
DEFAULT = IMAGENET1K_V1
553
569
554
570
555
571
class EfficientNet_B5_Weights (WeightsEnum ):
556
572
IMAGENET1K_V1 = Weights (
573
+ # Weights ported from https://github.com/lukemelas/EfficientNet-PyTorch/
557
574
url = "https://download.pytorch.org/models/efficientnet_b5_lukemelas-b6417697.pth" ,
558
575
transforms = partial (
559
576
ImageClassification , crop_size = 456 , resize_size = 456 , interpolation = InterpolationMode .BICUBIC
@@ -565,13 +582,15 @@ class EfficientNet_B5_Weights(WeightsEnum):
565
582
"acc@1" : 83.444 ,
566
583
"acc@5" : 96.628 ,
567
584
},
585
+ "_docs" : """These weights are ported from the original paper.""" ,
568
586
},
569
587
)
570
588
DEFAULT = IMAGENET1K_V1
571
589
572
590
573
591
class EfficientNet_B6_Weights (WeightsEnum ):
574
592
IMAGENET1K_V1 = Weights (
593
+ # Weights ported from https://github.com/lukemelas/EfficientNet-PyTorch/
575
594
url = "https://download.pytorch.org/models/efficientnet_b6_lukemelas-c76e70fd.pth" ,
576
595
transforms = partial (
577
596
ImageClassification , crop_size = 528 , resize_size = 528 , interpolation = InterpolationMode .BICUBIC
@@ -583,13 +602,15 @@ class EfficientNet_B6_Weights(WeightsEnum):
583
602
"acc@1" : 84.008 ,
584
603
"acc@5" : 96.916 ,
585
604
},
605
+ "_docs" : """These weights are ported from the original paper.""" ,
586
606
},
587
607
)
588
608
DEFAULT = IMAGENET1K_V1
589
609
590
610
591
611
class EfficientNet_B7_Weights (WeightsEnum ):
592
612
IMAGENET1K_V1 = Weights (
613
+ # Weights ported from https://github.com/lukemelas/EfficientNet-PyTorch/
593
614
url = "https://download.pytorch.org/models/efficientnet_b7_lukemelas-dcc49843.pth" ,
594
615
transforms = partial (
595
616
ImageClassification , crop_size = 600 , resize_size = 600 , interpolation = InterpolationMode .BICUBIC
@@ -601,6 +622,7 @@ class EfficientNet_B7_Weights(WeightsEnum):
601
622
"acc@1" : 84.122 ,
602
623
"acc@5" : 96.908 ,
603
624
},
625
+ "_docs" : """These weights are ported from the original paper.""" ,
604
626
},
605
627
)
606
628
DEFAULT = IMAGENET1K_V1
@@ -622,6 +644,11 @@ class EfficientNet_V2_S_Weights(WeightsEnum):
622
644
"acc@1" : 84.228 ,
623
645
"acc@5" : 96.878 ,
624
646
},
647
+ "_docs" : """
648
+ These weights improve upon the results of the original paper by using a modified version of TorchVision's
649
+ `new training recipe
650
+ <https://pytorch.org/blog/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives/>`_.
651
+ """ ,
625
652
},
626
653
)
627
654
DEFAULT = IMAGENET1K_V1
@@ -643,12 +670,18 @@ class EfficientNet_V2_M_Weights(WeightsEnum):
643
670
"acc@1" : 85.112 ,
644
671
"acc@5" : 97.156 ,
645
672
},
673
+ "_docs" : """
674
+ These weights improve upon the results of the original paper by using a modified version of TorchVision's
675
+ `new training recipe
676
+ <https://pytorch.org/blog/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives/>`_.
677
+ """ ,
646
678
},
647
679
)
648
680
DEFAULT = IMAGENET1K_V1
649
681
650
682
651
683
class EfficientNet_V2_L_Weights (WeightsEnum ):
684
+ # Weights ported from https://github.com/google/automl/tree/master/efficientnetv2
652
685
IMAGENET1K_V1 = Weights (
653
686
url = "https://download.pytorch.org/models/efficientnet_v2_l-59c71312.pth" ,
654
687
transforms = partial (
@@ -666,6 +699,7 @@ class EfficientNet_V2_L_Weights(WeightsEnum):
666
699
"acc@1" : 85.808 ,
667
700
"acc@5" : 97.788 ,
668
701
},
702
+ "_docs" : """These weights are ported from the original paper.""" ,
669
703
},
670
704
)
671
705
DEFAULT = IMAGENET1K_V1
@@ -1036,13 +1070,11 @@ def efficientnet_v2_l(
1036
1070
1037
1071
model_urls = _ModelURLs (
1038
1072
{
1039
- # Weights ported from https://github.com/rwightman/pytorch-image-models/
1040
1073
"efficientnet_b0" : EfficientNet_B0_Weights .IMAGENET1K_V1 .url ,
1041
1074
"efficientnet_b1" : EfficientNet_B1_Weights .IMAGENET1K_V1 .url ,
1042
1075
"efficientnet_b2" : EfficientNet_B2_Weights .IMAGENET1K_V1 .url ,
1043
1076
"efficientnet_b3" : EfficientNet_B3_Weights .IMAGENET1K_V1 .url ,
1044
1077
"efficientnet_b4" : EfficientNet_B4_Weights .IMAGENET1K_V1 .url ,
1045
- # Weights ported from https://github.com/lukemelas/EfficientNet-PyTorch/
1046
1078
"efficientnet_b5" : EfficientNet_B5_Weights .IMAGENET1K_V1 .url ,
1047
1079
"efficientnet_b6" : EfficientNet_B6_Weights .IMAGENET1K_V1 .url ,
1048
1080
"efficientnet_b7" : EfficientNet_B7_Weights .IMAGENET1K_V1 .url ,
0 commit comments