Instructions to use zeromodels/tf_efficientnet_b5_in1k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use zeromodels/tf_efficientnet_b5_in1k with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/tf_efficientnet_b5_in1k") - Notebooks
- Google Colab
- Kaggle
Migrate to zeromodels (rename kf_*.json -> zm_*.json, fix refs in config + README, ensure tag + badge)
Browse files- README.md +45 -45
- kf_config.json → zm_config.json +18 -18
README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
| 2 |
pipeline_tag: image-classification
|
| 3 |
license: apache-2.0
|
| 4 |
base_model: timm/tf_efficientnet_b5.in1k
|
| 5 |
-
library_name:
|
| 6 |
tags:
|
| 7 |
- keras
|
| 8 |
-
-
|
| 9 |
- image-classification
|
| 10 |
- efficientnet
|
| 11 |
- backbone
|
|
@@ -15,13 +15,13 @@ tags:
|
|
| 15 |
- tf
|
| 16 |
---
|
| 17 |
|
| 18 |
-
## ***See [our collection](https://huggingface.co/collections/
|
| 19 |
|
| 20 |
# Run EfficientNet with Keras 3: JAX, PyTorch, or TensorFlow
|
| 21 |
|
| 22 |
-
[](https://arxiv.org/abs/1905.11946) · [HF Papers](https://huggingface.co/papers/1905.11946)
|
| 27 |
|
|
@@ -29,7 +29,7 @@ EfficientNet compound-scales depth/width/resolution for strong accuracy/efficien
|
|
| 29 |
|
| 30 |
For more details on the model, please go to the upstream [model card](https://huggingface.co/timm/tf_efficientnet_b5.in1k).
|
| 31 |
|
| 32 |
-
Pure-**Keras 3** conversion of [`timm/tf_efficientnet_b5.in1k`](https://huggingface.co/timm/tf_efficientnet_b5.in1k) for [
|
| 33 |
|
| 34 |
This is an **image-classification / backbone** checkpoint (`EfficientNetImageClassify` / `EfficientNetModel`).
|
| 35 |
|
|
@@ -41,11 +41,11 @@ os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
|
|
| 41 |
|
| 42 |
from PIL import Image
|
| 43 |
import numpy as np
|
| 44 |
-
from
|
| 45 |
|
| 46 |
-
model = EfficientNetImageClassify.from_weights("
|
| 47 |
backbone = EfficientNetModel.from_weights(
|
| 48 |
-
"
|
| 49 |
)
|
| 50 |
|
| 51 |
image = Image.open("your_image.jpg").convert("RGB")
|
|
@@ -56,49 +56,49 @@ feats = backbone(x)
|
|
| 56 |
print(len(feats), [tuple(f.shape) for f in feats])
|
| 57 |
```
|
| 58 |
|
| 59 |
-
Load any EfficientNet variant the same way with `from_weights("
|
| 60 |
|
| 61 |
| Variant | Hub |
|
| 62 |
|---|---|
|
| 63 |
-
| `tf_efficientnet_b0_aa_in1k` | [`
|
| 64 |
-
| `tf_efficientnet_b0_ap_in1k` | [`
|
| 65 |
-
| `tf_efficientnet_b0_in1k` | [`
|
| 66 |
-
| `tf_efficientnet_b0_ns_jft_in1k` | [`
|
| 67 |
-
| `tf_efficientnet_b1_aa_in1k` | [`
|
| 68 |
-
| `tf_efficientnet_b1_ap_in1k` | [`
|
| 69 |
-
| `tf_efficientnet_b1_in1k` | [`
|
| 70 |
-
| `tf_efficientnet_b1_ns_jft_in1k` | [`
|
| 71 |
-
| `tf_efficientnet_b2_aa_in1k` | [`
|
| 72 |
-
| `tf_efficientnet_b2_ap_in1k` | [`
|
| 73 |
-
| `tf_efficientnet_b2_in1k` | [`
|
| 74 |
-
| `tf_efficientnet_b2_ns_jft_in1k` | [`
|
| 75 |
-
| `tf_efficientnet_b3_aa_in1k` | [`
|
| 76 |
-
| `tf_efficientnet_b3_ap_in1k` | [`
|
| 77 |
-
| `tf_efficientnet_b3_in1k` | [`
|
| 78 |
-
| `tf_efficientnet_b3_ns_jft_in1k` | [`
|
| 79 |
-
| `tf_efficientnet_b4_aa_in1k` | [`
|
| 80 |
-
| `tf_efficientnet_b4_ap_in1k` | [`
|
| 81 |
-
| `tf_efficientnet_b4_in1k` | [`
|
| 82 |
-
| `tf_efficientnet_b4_ns_jft_in1k` | [`
|
| 83 |
-
| `tf_efficientnet_b5_aa_in1k` | [`
|
| 84 |
-
| `tf_efficientnet_b5_ap_in1k` | [`
|
| 85 |
-
| `tf_efficientnet_b5_in1k` | [`
|
| 86 |
-
| `tf_efficientnet_b5_ns_jft_in1k` | [`
|
| 87 |
-
| `tf_efficientnet_b6_aa_in1k` | [`
|
| 88 |
-
| `tf_efficientnet_b6_ap_in1k` | [`
|
| 89 |
-
| `tf_efficientnet_b6_ns_jft_in1k` | [`
|
| 90 |
-
| `tf_efficientnet_b7_aa_in1k` | [`
|
| 91 |
-
| `tf_efficientnet_b7_ap_in1k` | [`
|
| 92 |
-
| `tf_efficientnet_b7_ns_jft_in1k` | [`
|
| 93 |
-
| `tf_efficientnet_b8_ap_in1k` | [`
|
| 94 |
-
| `tf_efficientnet_l2_ns_jft_in1k` | [`
|
| 95 |
-
| `tf_efficientnet_l2_ns_jft_in1k_475` | [`
|
| 96 |
|
| 97 |
## Tips
|
| 98 |
|
| 99 |
-
- Set `KERAS_BACKEND` **before** importing Keras /
|
| 100 |
- `EfficientNetImageClassify` returns class logits; `EfficientNetModel` returns features (`as_backbone=True` for multi-scale stages).
|
| 101 |
-
- See [docs](https://imvision12.github.io/
|
| 102 |
- Upstream / timm checkpoints: `EfficientNetImageClassify.from_weights("hf:timm/tf_efficientnet_b5.in1k")`.
|
| 103 |
|
| 104 |
## Special Thanks
|
|
|
|
| 2 |
pipeline_tag: image-classification
|
| 3 |
license: apache-2.0
|
| 4 |
base_model: timm/tf_efficientnet_b5.in1k
|
| 5 |
+
library_name: zeromodels
|
| 6 |
tags:
|
| 7 |
- keras
|
| 8 |
+
- zeromodels
|
| 9 |
- image-classification
|
| 10 |
- efficientnet
|
| 11 |
- backbone
|
|
|
|
| 15 |
- tf
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## ***See [our collection](https://huggingface.co/collections/zeromodels/efficientnet-6a6d0d5e9b3756eaaca7dbe4) for all versions of EfficientNet.***
|
| 19 |
|
| 20 |
# Run EfficientNet with Keras 3: JAX, PyTorch, or TensorFlow
|
| 21 |
|
| 22 |
+
[](https://github.com/IMvision12/ZeroModels) [](https://imvision12.github.io/ZeroModels/classification_backbones/) [](https://huggingface.co/collections/zeromodels/efficientnet-6a6d0d5e9b3756eaaca7dbe4)
|
| 23 |
|
| 24 |
+
# zeromodels/tf_efficientnet_b5_in1k
|
| 25 |
|
| 26 |
Paper: [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks (arXiv:1905.11946)](https://arxiv.org/abs/1905.11946) · [HF Papers](https://huggingface.co/papers/1905.11946)
|
| 27 |
|
|
|
|
| 29 |
|
| 30 |
For more details on the model, please go to the upstream [model card](https://huggingface.co/timm/tf_efficientnet_b5.in1k).
|
| 31 |
|
| 32 |
+
Pure-**Keras 3** conversion of [`timm/tf_efficientnet_b5.in1k`](https://huggingface.co/timm/tf_efficientnet_b5.in1k) for [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
|
| 33 |
|
| 34 |
This is an **image-classification / backbone** checkpoint (`EfficientNetImageClassify` / `EfficientNetModel`).
|
| 35 |
|
|
|
|
| 41 |
|
| 42 |
from PIL import Image
|
| 43 |
import numpy as np
|
| 44 |
+
from zeromodels.models.efficientnet import EfficientNetImageClassify, EfficientNetModel
|
| 45 |
|
| 46 |
+
model = EfficientNetImageClassify.from_weights("zeromodels/tf_efficientnet_b5_in1k")
|
| 47 |
backbone = EfficientNetModel.from_weights(
|
| 48 |
+
"zeromodels/tf_efficientnet_b5_in1k", as_backbone=True
|
| 49 |
)
|
| 50 |
|
| 51 |
image = Image.open("your_image.jpg").convert("RGB")
|
|
|
|
| 56 |
print(len(feats), [tuple(f.shape) for f in feats])
|
| 57 |
```
|
| 58 |
|
| 59 |
+
Load any EfficientNet variant the same way with `from_weights("zeromodels/<variant>")`:
|
| 60 |
|
| 61 |
| Variant | Hub |
|
| 62 |
|---|---|
|
| 63 |
+
| `tf_efficientnet_b0_aa_in1k` | [`zeromodels/tf_efficientnet_b0_aa_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b0_aa_in1k) |
|
| 64 |
+
| `tf_efficientnet_b0_ap_in1k` | [`zeromodels/tf_efficientnet_b0_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b0_ap_in1k) |
|
| 65 |
+
| `tf_efficientnet_b0_in1k` | [`zeromodels/tf_efficientnet_b0_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b0_in1k) |
|
| 66 |
+
| `tf_efficientnet_b0_ns_jft_in1k` | [`zeromodels/tf_efficientnet_b0_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b0_ns_jft_in1k) |
|
| 67 |
+
| `tf_efficientnet_b1_aa_in1k` | [`zeromodels/tf_efficientnet_b1_aa_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b1_aa_in1k) |
|
| 68 |
+
| `tf_efficientnet_b1_ap_in1k` | [`zeromodels/tf_efficientnet_b1_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b1_ap_in1k) |
|
| 69 |
+
| `tf_efficientnet_b1_in1k` | [`zeromodels/tf_efficientnet_b1_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b1_in1k) |
|
| 70 |
+
| `tf_efficientnet_b1_ns_jft_in1k` | [`zeromodels/tf_efficientnet_b1_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b1_ns_jft_in1k) |
|
| 71 |
+
| `tf_efficientnet_b2_aa_in1k` | [`zeromodels/tf_efficientnet_b2_aa_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b2_aa_in1k) |
|
| 72 |
+
| `tf_efficientnet_b2_ap_in1k` | [`zeromodels/tf_efficientnet_b2_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b2_ap_in1k) |
|
| 73 |
+
| `tf_efficientnet_b2_in1k` | [`zeromodels/tf_efficientnet_b2_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b2_in1k) |
|
| 74 |
+
| `tf_efficientnet_b2_ns_jft_in1k` | [`zeromodels/tf_efficientnet_b2_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b2_ns_jft_in1k) |
|
| 75 |
+
| `tf_efficientnet_b3_aa_in1k` | [`zeromodels/tf_efficientnet_b3_aa_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b3_aa_in1k) |
|
| 76 |
+
| `tf_efficientnet_b3_ap_in1k` | [`zeromodels/tf_efficientnet_b3_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b3_ap_in1k) |
|
| 77 |
+
| `tf_efficientnet_b3_in1k` | [`zeromodels/tf_efficientnet_b3_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b3_in1k) |
|
| 78 |
+
| `tf_efficientnet_b3_ns_jft_in1k` | [`zeromodels/tf_efficientnet_b3_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b3_ns_jft_in1k) |
|
| 79 |
+
| `tf_efficientnet_b4_aa_in1k` | [`zeromodels/tf_efficientnet_b4_aa_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b4_aa_in1k) |
|
| 80 |
+
| `tf_efficientnet_b4_ap_in1k` | [`zeromodels/tf_efficientnet_b4_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b4_ap_in1k) |
|
| 81 |
+
| `tf_efficientnet_b4_in1k` | [`zeromodels/tf_efficientnet_b4_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b4_in1k) |
|
| 82 |
+
| `tf_efficientnet_b4_ns_jft_in1k` | [`zeromodels/tf_efficientnet_b4_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b4_ns_jft_in1k) |
|
| 83 |
+
| `tf_efficientnet_b5_aa_in1k` | [`zeromodels/tf_efficientnet_b5_aa_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b5_aa_in1k) |
|
| 84 |
+
| `tf_efficientnet_b5_ap_in1k` | [`zeromodels/tf_efficientnet_b5_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b5_ap_in1k) |
|
| 85 |
+
| `tf_efficientnet_b5_in1k` | [`zeromodels/tf_efficientnet_b5_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b5_in1k) |
|
| 86 |
+
| `tf_efficientnet_b5_ns_jft_in1k` | [`zeromodels/tf_efficientnet_b5_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b5_ns_jft_in1k) |
|
| 87 |
+
| `tf_efficientnet_b6_aa_in1k` | [`zeromodels/tf_efficientnet_b6_aa_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b6_aa_in1k) |
|
| 88 |
+
| `tf_efficientnet_b6_ap_in1k` | [`zeromodels/tf_efficientnet_b6_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b6_ap_in1k) |
|
| 89 |
+
| `tf_efficientnet_b6_ns_jft_in1k` | [`zeromodels/tf_efficientnet_b6_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b6_ns_jft_in1k) |
|
| 90 |
+
| `tf_efficientnet_b7_aa_in1k` | [`zeromodels/tf_efficientnet_b7_aa_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b7_aa_in1k) |
|
| 91 |
+
| `tf_efficientnet_b7_ap_in1k` | [`zeromodels/tf_efficientnet_b7_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b7_ap_in1k) |
|
| 92 |
+
| `tf_efficientnet_b7_ns_jft_in1k` | [`zeromodels/tf_efficientnet_b7_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b7_ns_jft_in1k) |
|
| 93 |
+
| `tf_efficientnet_b8_ap_in1k` | [`zeromodels/tf_efficientnet_b8_ap_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_b8_ap_in1k) |
|
| 94 |
+
| `tf_efficientnet_l2_ns_jft_in1k` | [`zeromodels/tf_efficientnet_l2_ns_jft_in1k`](https://huggingface.co/zeromodels/tf_efficientnet_l2_ns_jft_in1k) |
|
| 95 |
+
| `tf_efficientnet_l2_ns_jft_in1k_475` | [`zeromodels/tf_efficientnet_l2_ns_jft_in1k_475`](https://huggingface.co/zeromodels/tf_efficientnet_l2_ns_jft_in1k_475) |
|
| 96 |
|
| 97 |
## Tips
|
| 98 |
|
| 99 |
+
- Set `KERAS_BACKEND` **before** importing Keras / zeromodels.
|
| 100 |
- `EfficientNetImageClassify` returns class logits; `EfficientNetModel` returns features (`as_backbone=True` for multi-scale stages).
|
| 101 |
+
- See [docs](https://imvision12.github.io/ZeroModels/classification_backbones/) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).
|
| 102 |
- Upstream / timm checkpoints: `EfficientNetImageClassify.from_weights("hf:timm/tf_efficientnet_b5.in1k")`.
|
| 103 |
|
| 104 |
## Special Thanks
|
kf_config.json → zm_config.json
RENAMED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
-
{
|
| 2 |
-
"library_name": "
|
| 3 |
-
"
|
| 4 |
-
"model_module": "
|
| 5 |
-
"model_class": "EfficientNetImageClassify",
|
| 6 |
-
"variant": "tf_efficientnet_b5_in1k",
|
| 7 |
-
"weights": "model.weights.h5",
|
| 8 |
-
"schema_version": 2,
|
| 9 |
-
"weight_dtype": "float32",
|
| 10 |
-
"model_type": "efficientnet",
|
| 11 |
-
"vision_config": {
|
| 12 |
-
"width_coefficient": 1.6,
|
| 13 |
-
"depth_coefficient": 2.2,
|
| 14 |
-
"dropout_rate": 0.4,
|
| 15 |
-
"default_size": 456,
|
| 16 |
-
"image_size": 456,
|
| 17 |
-
"num_classes": 1000
|
| 18 |
-
}
|
| 19 |
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"library_name": "zeromodels",
|
| 3 |
+
"zeromodels_version": "1.2.1",
|
| 4 |
+
"model_module": "zeromodels.models.efficientnet",
|
| 5 |
+
"model_class": "EfficientNetImageClassify",
|
| 6 |
+
"variant": "tf_efficientnet_b5_in1k",
|
| 7 |
+
"weights": "model.weights.h5",
|
| 8 |
+
"schema_version": 2,
|
| 9 |
+
"weight_dtype": "float32",
|
| 10 |
+
"model_type": "efficientnet",
|
| 11 |
+
"vision_config": {
|
| 12 |
+
"width_coefficient": 1.6,
|
| 13 |
+
"depth_coefficient": 2.2,
|
| 14 |
+
"dropout_rate": 0.4,
|
| 15 |
+
"default_size": 456,
|
| 16 |
+
"image_size": 456,
|
| 17 |
+
"num_classes": 1000
|
| 18 |
+
}
|
| 19 |
}
|