Instructions to use zeromodels/tf_efficientnetv2_s_in1k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use zeromodels/tf_efficientnetv2_s_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_efficientnetv2_s_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 +28 -28
- kf_config.json → zm_config.json +19 -19
README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
| 2 |
pipeline_tag: image-classification
|
| 3 |
license: apache-2.0
|
| 4 |
base_model: timm/tf_efficientnetv2_s.in1k
|
| 5 |
-
library_name:
|
| 6 |
tags:
|
| 7 |
- keras
|
| 8 |
-
-
|
| 9 |
- image-classification
|
| 10 |
- efficientnetv2
|
| 11 |
- backbone
|
|
@@ -15,13 +15,13 @@ tags:
|
|
| 15 |
- tf
|
| 16 |
---
|
| 17 |
|
| 18 |
-
## ***See [our collection](https://huggingface.co/collections/
|
| 19 |
|
| 20 |
# Run EfficientNetV2 with Keras 3: JAX, PyTorch, or TensorFlow
|
| 21 |
|
| 22 |
-
[](https://arxiv.org/abs/2104.00298) · [HF Papers](https://huggingface.co/papers/2104.00298)
|
| 27 |
|
|
@@ -29,7 +29,7 @@ EfficientNetV2 trains faster with Fused-MBConv and progressive learning. Same Im
|
|
| 29 |
|
| 30 |
For more details on the model, please go to the upstream [model card](https://huggingface.co/timm/tf_efficientnetv2_s.in1k).
|
| 31 |
|
| 32 |
-
Pure-**Keras 3** conversion of [`timm/tf_efficientnetv2_s.in1k`](https://huggingface.co/timm/tf_efficientnetv2_s.in1k) for [
|
| 33 |
|
| 34 |
This is an **image-classification / backbone** checkpoint (`EfficientNetV2ImageClassify` / `EfficientNetV2Model`).
|
| 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 = EfficientNetV2ImageClassify.from_weights("
|
| 47 |
backbone = EfficientNetV2Model.from_weights(
|
| 48 |
-
"
|
| 49 |
)
|
| 50 |
|
| 51 |
image = Image.open("your_image.jpg").convert("RGB")
|
|
@@ -56,32 +56,32 @@ feats = backbone(x)
|
|
| 56 |
print(len(feats), [tuple(f.shape) for f in feats])
|
| 57 |
```
|
| 58 |
|
| 59 |
-
Load any EfficientNetV2 variant the same way with `from_weights("
|
| 60 |
|
| 61 |
| Variant | Hub |
|
| 62 |
|---|---|
|
| 63 |
-
| `tf_efficientnetv2_b0_in1k` | [`
|
| 64 |
-
| `tf_efficientnetv2_b1_in1k` | [`
|
| 65 |
-
| `tf_efficientnetv2_b2_in1k` | [`
|
| 66 |
-
| `tf_efficientnetv2_b3_in1k` | [`
|
| 67 |
-
| `tf_efficientnetv2_b3_in21k_ft_in1k` | [`
|
| 68 |
-
| `tf_efficientnetv2_l_in1k` | [`
|
| 69 |
-
| `tf_efficientnetv2_l_in21k` | [`
|
| 70 |
-
| `tf_efficientnetv2_l_in21k_ft_in1k` | [`
|
| 71 |
-
| `tf_efficientnetv2_m_in1k` | [`
|
| 72 |
-
| `tf_efficientnetv2_m_in21k` | [`
|
| 73 |
-
| `tf_efficientnetv2_m_in21k_ft_in1k` | [`
|
| 74 |
-
| `tf_efficientnetv2_s_in1k` | [`
|
| 75 |
-
| `tf_efficientnetv2_s_in21k` | [`
|
| 76 |
-
| `tf_efficientnetv2_s_in21k_ft_in1k` | [`
|
| 77 |
-
| `tf_efficientnetv2_xl_in21k` | [`
|
| 78 |
-
| `tf_efficientnetv2_xl_in21k_ft_in1k` | [`
|
| 79 |
|
| 80 |
## Tips
|
| 81 |
|
| 82 |
-
- Set `KERAS_BACKEND` **before** importing Keras /
|
| 83 |
- `EfficientNetV2ImageClassify` returns class logits; `EfficientNetV2Model` returns features (`as_backbone=True` for multi-scale stages).
|
| 84 |
-
- See [docs](https://imvision12.github.io/
|
| 85 |
- Upstream / timm checkpoints: `EfficientNetV2ImageClassify.from_weights("hf:timm/tf_efficientnetv2_s.in1k")`.
|
| 86 |
|
| 87 |
## Special Thanks
|
|
|
|
| 2 |
pipeline_tag: image-classification
|
| 3 |
license: apache-2.0
|
| 4 |
base_model: timm/tf_efficientnetv2_s.in1k
|
| 5 |
+
library_name: zeromodels
|
| 6 |
tags:
|
| 7 |
- keras
|
| 8 |
+
- zeromodels
|
| 9 |
- image-classification
|
| 10 |
- efficientnetv2
|
| 11 |
- backbone
|
|
|
|
| 15 |
- tf
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## ***See [our collection](https://huggingface.co/collections/zeromodels/efficientnetv2-6a6d11b8c2748868ecfd4f9e) for all versions of EfficientNetV2.***
|
| 19 |
|
| 20 |
# Run EfficientNetV2 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/efficientnetv2-6a6d11b8c2748868ecfd4f9e)
|
| 23 |
|
| 24 |
+
# zeromodels/tf_efficientnetv2_s_in1k
|
| 25 |
|
| 26 |
Paper: [EfficientNetV2: Smaller Models and Faster Training (arXiv:2104.00298)](https://arxiv.org/abs/2104.00298) · [HF Papers](https://huggingface.co/papers/2104.00298)
|
| 27 |
|
|
|
|
| 29 |
|
| 30 |
For more details on the model, please go to the upstream [model card](https://huggingface.co/timm/tf_efficientnetv2_s.in1k).
|
| 31 |
|
| 32 |
+
Pure-**Keras 3** conversion of [`timm/tf_efficientnetv2_s.in1k`](https://huggingface.co/timm/tf_efficientnetv2_s.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 (`EfficientNetV2ImageClassify` / `EfficientNetV2Model`).
|
| 35 |
|
|
|
|
| 41 |
|
| 42 |
from PIL import Image
|
| 43 |
import numpy as np
|
| 44 |
+
from zeromodels.models.efficientnetv2 import EfficientNetV2ImageClassify, EfficientNetV2Model
|
| 45 |
|
| 46 |
+
model = EfficientNetV2ImageClassify.from_weights("zeromodels/tf_efficientnetv2_s_in1k")
|
| 47 |
backbone = EfficientNetV2Model.from_weights(
|
| 48 |
+
"zeromodels/tf_efficientnetv2_s_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 EfficientNetV2 variant the same way with `from_weights("zeromodels/<variant>")`:
|
| 60 |
|
| 61 |
| Variant | Hub |
|
| 62 |
|---|---|
|
| 63 |
+
| `tf_efficientnetv2_b0_in1k` | [`zeromodels/tf_efficientnetv2_b0_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_b0_in1k) |
|
| 64 |
+
| `tf_efficientnetv2_b1_in1k` | [`zeromodels/tf_efficientnetv2_b1_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_b1_in1k) |
|
| 65 |
+
| `tf_efficientnetv2_b2_in1k` | [`zeromodels/tf_efficientnetv2_b2_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_b2_in1k) |
|
| 66 |
+
| `tf_efficientnetv2_b3_in1k` | [`zeromodels/tf_efficientnetv2_b3_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_b3_in1k) |
|
| 67 |
+
| `tf_efficientnetv2_b3_in21k_ft_in1k` | [`zeromodels/tf_efficientnetv2_b3_in21k_ft_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_b3_in21k_ft_in1k) |
|
| 68 |
+
| `tf_efficientnetv2_l_in1k` | [`zeromodels/tf_efficientnetv2_l_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_l_in1k) |
|
| 69 |
+
| `tf_efficientnetv2_l_in21k` | [`zeromodels/tf_efficientnetv2_l_in21k`](https://huggingface.co/zeromodels/tf_efficientnetv2_l_in21k) |
|
| 70 |
+
| `tf_efficientnetv2_l_in21k_ft_in1k` | [`zeromodels/tf_efficientnetv2_l_in21k_ft_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_l_in21k_ft_in1k) |
|
| 71 |
+
| `tf_efficientnetv2_m_in1k` | [`zeromodels/tf_efficientnetv2_m_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_m_in1k) |
|
| 72 |
+
| `tf_efficientnetv2_m_in21k` | [`zeromodels/tf_efficientnetv2_m_in21k`](https://huggingface.co/zeromodels/tf_efficientnetv2_m_in21k) |
|
| 73 |
+
| `tf_efficientnetv2_m_in21k_ft_in1k` | [`zeromodels/tf_efficientnetv2_m_in21k_ft_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_m_in21k_ft_in1k) |
|
| 74 |
+
| `tf_efficientnetv2_s_in1k` | [`zeromodels/tf_efficientnetv2_s_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_s_in1k) |
|
| 75 |
+
| `tf_efficientnetv2_s_in21k` | [`zeromodels/tf_efficientnetv2_s_in21k`](https://huggingface.co/zeromodels/tf_efficientnetv2_s_in21k) |
|
| 76 |
+
| `tf_efficientnetv2_s_in21k_ft_in1k` | [`zeromodels/tf_efficientnetv2_s_in21k_ft_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_s_in21k_ft_in1k) |
|
| 77 |
+
| `tf_efficientnetv2_xl_in21k` | [`zeromodels/tf_efficientnetv2_xl_in21k`](https://huggingface.co/zeromodels/tf_efficientnetv2_xl_in21k) |
|
| 78 |
+
| `tf_efficientnetv2_xl_in21k_ft_in1k` | [`zeromodels/tf_efficientnetv2_xl_in21k_ft_in1k`](https://huggingface.co/zeromodels/tf_efficientnetv2_xl_in21k_ft_in1k) |
|
| 79 |
|
| 80 |
## Tips
|
| 81 |
|
| 82 |
+
- Set `KERAS_BACKEND` **before** importing Keras / zeromodels.
|
| 83 |
- `EfficientNetV2ImageClassify` returns class logits; `EfficientNetV2Model` returns features (`as_backbone=True` for multi-scale stages).
|
| 84 |
+
- See [docs](https://imvision12.github.io/ZeroModels/classification_backbones/) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).
|
| 85 |
- Upstream / timm checkpoints: `EfficientNetV2ImageClassify.from_weights("hf:timm/tf_efficientnetv2_s.in1k")`.
|
| 86 |
|
| 87 |
## Special Thanks
|
kf_config.json → zm_config.json
RENAMED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
-
{
|
| 2 |
-
"library_name": "
|
| 3 |
-
"
|
| 4 |
-
"model_module": "
|
| 5 |
-
"model_class": "EfficientNetV2ImageClassify",
|
| 6 |
-
"variant": "tf_efficientnetv2_s_in1k",
|
| 7 |
-
"weights": "model.weights.h5",
|
| 8 |
-
"schema_version": 2,
|
| 9 |
-
"weight_dtype": "float32",
|
| 10 |
-
"model_type": "efficientnetv2",
|
| 11 |
-
"vision_config": {
|
| 12 |
-
"width_coefficient": 1.0,
|
| 13 |
-
"depth_coefficient": 1.0,
|
| 14 |
-
"default_size": 300,
|
| 15 |
-
"block_arch": "EfficientNetV2S",
|
| 16 |
-
"head_filters": 1280,
|
| 17 |
-
"image_size": 300,
|
| 18 |
-
"num_classes": 1000
|
| 19 |
-
}
|
| 20 |
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"library_name": "zeromodels",
|
| 3 |
+
"zeromodels_version": "1.2.1",
|
| 4 |
+
"model_module": "zeromodels.models.efficientnetv2",
|
| 5 |
+
"model_class": "EfficientNetV2ImageClassify",
|
| 6 |
+
"variant": "tf_efficientnetv2_s_in1k",
|
| 7 |
+
"weights": "model.weights.h5",
|
| 8 |
+
"schema_version": 2,
|
| 9 |
+
"weight_dtype": "float32",
|
| 10 |
+
"model_type": "efficientnetv2",
|
| 11 |
+
"vision_config": {
|
| 12 |
+
"width_coefficient": 1.0,
|
| 13 |
+
"depth_coefficient": 1.0,
|
| 14 |
+
"default_size": 300,
|
| 15 |
+
"block_arch": "EfficientNetV2S",
|
| 16 |
+
"head_filters": 1280,
|
| 17 |
+
"image_size": 300,
|
| 18 |
+
"num_classes": 1000
|
| 19 |
+
}
|
| 20 |
}
|