Skip to content

Commit

Permalink
EfficientNet: Add lite0 variant (#1968)
Browse files Browse the repository at this point in the history
* add lite0 variant

* format pass

* added to preset file, fix uri

* fix parameter regression

* format fix

* fix merge regression
  • Loading branch information
pkgoogle authored Nov 20, 2024
1 parent 0810a82 commit 4025500
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 16 deletions.
13 changes: 13 additions & 0 deletions keras_hub/src/models/efficientnet/efficientnet_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,17 @@
},
"kaggle_handle": "kaggle://keras/efficientnet/keras/efficientnet_es_ra_imagenet/1",
},
"efficientnet_lite0_ra_imagenet": {
"metadata": {
"description": (
"EfficientNet-Lite model fine-trained on the ImageNet 1k dataset "
"with RandAugment recipe."
),
"params": 4652008,
"official_name": "EfficientNet",
"path": "efficientnet",
"model_card": "https://arxiv.org/abs/1905.11946",
},
"kaggle_handle": "kaggle://keras/efficientnet/keras/efficientnet_lite0_ra_imagenet",
},
}
42 changes: 26 additions & 16 deletions keras_hub/src/utils/timm/convert_efficientnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,32 @@
"depth_coefficient": 1.1,
"stackwise_squeeze_and_excite_ratios": [0.25] * 7,
},
"b2": {
"width_coefficient": 1.1,
"depth_coefficient": 1.2,
"stackwise_squeeze_and_excite_ratios": [0.25] * 7,
},
"b3": {
"width_coefficient": 1.2,
"depth_coefficient": 1.4,
"stackwise_squeeze_and_excite_ratios": [0.25] * 7,
},
"b4": {
"width_coefficient": 1.4,
"depth_coefficient": 1.8,
"stackwise_squeeze_and_excite_ratios": [0.25] * 7,
},
"b5": {
"width_coefficient": 1.6,
"depth_coefficient": 2.2,
"stackwise_squeeze_and_excite_ratios": [0.25] * 7,
},
"lite0": {
"width_coefficient": 1.0,
"depth_coefficient": 1.0,
"stackwise_squeeze_and_excite_ratios": [0] * 7,
"activation": "relu6",
},
"el": {
"width_coefficient": 1.2,
"depth_coefficient": 1.4,
Expand Down Expand Up @@ -65,22 +91,6 @@
"stackwise_nores_option": [True] + [False] * 5,
"activation": "relu",
},
"b2": {
"width_coefficient": 1.1,
"depth_coefficient": 1.2,
},
"b3": {
"width_coefficient": 1.2,
"depth_coefficient": 1.4,
},
"b4": {
"width_coefficient": 1.4,
"depth_coefficient": 1.8,
},
"b5": {
"width_coefficient": 1.6,
"depth_coefficient": 2.2,
},
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
--preset efficientnet_b5_sw_imagenet --upload_uri kaggle://keras/efficientnet/keras/efficientnet_b5_sw_imagenet
python tools/checkpoint_conversion/convert_efficientnet_checkpoints.py \
--preset efficientnet_b5_sw_ft_imagenet --upload_uri kaggle://keras/efficientnet/keras/efficientnet_b5_sw_ft_imagenet
python tools/checkpoint_conversion/convert_efficientnet_checkpoints.py \
--preset efficientnet_lite0_ra_imagenet --upload_uri kaggle://keras/efficientnet/keras/efficientnet_lite0_ra_imagenet
python tools/checkpoint_conversion/convert_efficientnet_checkpoints.py \
--preset efficientnet_el_ra_imagenet --upload_uri kaggle://keras/efficientnet/keras/efficientnet_el_ra_imagenet
python tools/checkpoint_conversion/convert_efficientnet_checkpoints.py \
Expand Down Expand Up @@ -50,6 +52,7 @@
"efficientnet_b4_ra2_imagenet": "timm/efficientnet_b4.ra2_in1k",
"efficientnet_b5_sw_imagenet": "timm/efficientnet_b5.sw_in12k",
"efficientnet_b5_sw_ft_imagenet": "timm/efficientnet_b5.sw_in12k_ft_in1k",
"efficientnet_lite0_ra_imagenet": "timm/efficientnet_lite0.ra_in1k",
"efficientnet_el_ra_imagenet": "timm/efficientnet_el.ra_in1k",
"efficientnet_em_ra2_imagenet": "timm/efficientnet_em.ra2_in1k",
"efficientnet_es_ra_imagenet": "timm/efficientnet_es.ra_in1k",
Expand Down

0 comments on commit 4025500

Please sign in to comment.