3131 'mnasnet_050' , 'mnasnet_075' , 'mnasnet_100' , 'mnasnet_b1' , 'mnasnet_140' , 'semnasnet_050' , 'semnasnet_075' ,
3232 'semnasnet_100' , 'mnasnet_a1' , 'semnasnet_140' , 'mnasnet_small' , 'mobilenetv1_100' , 'mobilenetv2_100' ,
3333 'mobilenetv3_050' , 'mobilenetv3_075' , 'mobilenetv3_100' , 'chamnetv1_100' , 'chamnetv2_100' ,
34- 'fbnetc_100' , 'spnasnet_100' , 'tflite_mnasnet_100' , 'tflite_semnasnet_100' , 'efficientnet_b0' ,
35- 'efficientnet_b1 ' , 'efficientnet_b2 ' , 'efficientnet_b3 ' , 'efficientnet_b4 ' , 'tf_efficientnet_b0' ,
36- 'tf_efficientnet_b1' , 'tf_efficientnet_b2' , 'tf_efficientnet_b3' ]
34+ 'fbnetc_100' , 'spnasnet_100' , 'tflite_mnasnet_100' , 'tflite_semnasnet_100' , 'efficientnet_b0' , 'efficientnet_b1' ,
35+ 'efficientnet_b2 ' , 'efficientnet_b3 ' , 'efficientnet_b4 ' , 'efficientnet_b5 ' , 'tf_efficientnet_b0' ,
36+ 'tf_efficientnet_b1' , 'tf_efficientnet_b2' , 'tf_efficientnet_b3' , 'tf_efficientnet_b4' , 'tf_efficientnet_b5' ]
3737__all__ = ['GenEfficientNet' , 'gen_efficientnet_model_names' ] + _models
3838
3939
@@ -91,6 +91,8 @@ def _cfg(url='', **kwargs):
9191 url = '' , input_size = (3 , 300 , 300 ), pool_size = (10 , 10 )),
9292 'efficientnet_b4' : _cfg (
9393 url = '' , input_size = (3 , 380 , 380 ), pool_size = (12 , 12 )),
94+ 'efficientnet_b5' : _cfg (
95+ url = '' , input_size = (3 , 456 , 456 ), pool_size = (15 , 15 )),
9496 'tf_efficientnet_b0' : _cfg (
9597 url = 'https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_b0-0af12548.pth' ,
9698 input_size = (3 , 224 , 224 ), interpolation = 'bicubic' ),
@@ -103,8 +105,15 @@ def _cfg(url='', **kwargs):
103105 'tf_efficientnet_b3' : _cfg (
104106 url = 'https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_b3-e3bd6955.pth' ,
105107 input_size = (3 , 300 , 300 ), pool_size = (10 , 10 ), interpolation = 'bicubic' , crop_pct = 0.904 ),
108+ 'tf_efficientnet_b4' : _cfg (
109+ url = 'https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_b4-74ee3bed.pth' ,
110+ input_size = (3 , 380 , 380 ), pool_size = (12 , 12 ), interpolation = 'bicubic' , crop_pct = 0.922 ),
111+ 'tf_efficientnet_b5' : _cfg (
112+ url = 'https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_b5-c6949ce9.pth' ,
113+ input_size = (3 , 456 , 456 ), pool_size = (15 , 15 ), interpolation = 'bicubic' , crop_pct = 0.934 )
106114}
107115
116+
108117_DEBUG = False
109118
110119# Default args for PyTorch BN impl
@@ -1436,6 +1445,19 @@ def efficientnet_b4(num_classes, in_chans=3, pretrained=False, **kwargs):
14361445 return model
14371446
14381447
1448+ def efficientnet_b5 (num_classes , in_chans = 3 , pretrained = False , ** kwargs ):
1449+ """ EfficientNet-B5 """
1450+ # NOTE for train, drop_rate should be 0.4
1451+ default_cfg = default_cfgs ['efficientnet_b5' ]
1452+ model = _gen_efficientnet (
1453+ channel_multiplier = 1.6 , depth_multiplier = 2.2 ,
1454+ num_classes = num_classes , in_chans = in_chans , ** kwargs )
1455+ model .default_cfg = default_cfg
1456+ if pretrained :
1457+ load_pretrained (model , default_cfg , num_classes , in_chans )
1458+ return model
1459+
1460+
14391461def tf_efficientnet_b0 (num_classes , in_chans = 3 , pretrained = False , ** kwargs ):
14401462 """ EfficientNet-B0. Tensorflow compatible variant """
14411463 default_cfg = default_cfgs ['tf_efficientnet_b0' ]
@@ -1492,5 +1514,33 @@ def tf_efficientnet_b3(num_classes, in_chans=3, pretrained=False, **kwargs):
14921514 return model
14931515
14941516
1517+ def tf_efficientnet_b4 (num_classes , in_chans = 3 , pretrained = False , ** kwargs ):
1518+ """ EfficientNet-B4. Tensorflow compatible variant """
1519+ default_cfg = default_cfgs ['tf_efficientnet_b4' ]
1520+ kwargs ['bn_eps' ] = _BN_EPS_TF_DEFAULT
1521+ kwargs ['padding_same' ] = True
1522+ model = _gen_efficientnet (
1523+ channel_multiplier = 1.4 , depth_multiplier = 1.8 ,
1524+ num_classes = num_classes , in_chans = in_chans , ** kwargs )
1525+ model .default_cfg = default_cfg
1526+ if pretrained :
1527+ load_pretrained (model , default_cfg , num_classes , in_chans )
1528+ return model
1529+
1530+
1531+ def tf_efficientnet_b5 (num_classes , in_chans = 3 , pretrained = False , ** kwargs ):
1532+ """ EfficientNet-B5. Tensorflow compatible variant """
1533+ default_cfg = default_cfgs ['tf_efficientnet_b5' ]
1534+ kwargs ['bn_eps' ] = _BN_EPS_TF_DEFAULT
1535+ kwargs ['padding_same' ] = True
1536+ model = _gen_efficientnet (
1537+ channel_multiplier = 1.6 , depth_multiplier = 2.2 ,
1538+ num_classes = num_classes , in_chans = in_chans , ** kwargs )
1539+ model .default_cfg = default_cfg
1540+ if pretrained :
1541+ load_pretrained (model , default_cfg , num_classes , in_chans )
1542+ return model
1543+
1544+
14951545def gen_efficientnet_model_names ():
14961546 return set (_models )
0 commit comments