Instructions to use zeromodels/resnet101_tv_in1k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/resnet101_tv_in1k with ZeroModels:
# pip install -U zeromodels # ZeroModels is pure Keras 3, so pick a backend: "jax", "torch" or "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" from zeromodels import AutoZModel # AutoZModel reads the repo's model_type and loads the matching class. # For a task head use the matching loader, e.g. AutoZMImageClassify / AutoZMDetect / # AutoZMSemanticSegment / AutoZMTextGenerate (see zeromodels.auto). model = AutoZModel.from_weights("zeromodels/resnet101_tv_in1k") - Keras
How to use zeromodels/resnet101_tv_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/resnet101_tv_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 +21 -21
- kf_config.json → zm_config.json +25 -25
README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
| 2 |
pipeline_tag: image-classification
|
| 3 |
license: bsd-3-clause
|
| 4 |
base_model: timm/resnet101.tv_in1k
|
| 5 |
-
library_name:
|
| 6 |
tags:
|
| 7 |
- keras
|
| 8 |
-
-
|
| 9 |
- image-classification
|
| 10 |
- resnet
|
| 11 |
- backbone
|
|
@@ -15,13 +15,13 @@ tags:
|
|
| 15 |
- tf
|
| 16 |
---
|
| 17 |
|
| 18 |
-
## ***See [our collection](https://huggingface.co/collections/
|
| 19 |
|
| 20 |
# Run ResNet with Keras 3: JAX, PyTorch, or TensorFlow
|
| 21 |
|
| 22 |
-
[](https://arxiv.org/abs/1512.03385) · [HF Papers](https://huggingface.co/papers/1512.03385)
|
| 27 |
|
|
@@ -29,7 +29,7 @@ ResNet is the residual CNN backbone that introduced skip connections. Use `ResNe
|
|
| 29 |
|
| 30 |
For more details on the model, please go to the upstream [model card](https://huggingface.co/timm/resnet101.tv_in1k).
|
| 31 |
|
| 32 |
-
Pure-**Keras 3** conversion of [`timm/resnet101.tv_in1k`](https://huggingface.co/timm/resnet101.tv_in1k) for [
|
| 33 |
|
| 34 |
This is an **image-classification / backbone** checkpoint (`ResNetImageClassify` / `ResNetModel`).
|
| 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 = ResNetImageClassify.from_weights("
|
| 47 |
backbone = ResNetModel.from_weights(
|
| 48 |
-
"
|
| 49 |
)
|
| 50 |
|
| 51 |
image = Image.open("your_image.jpg").convert("RGB")
|
|
@@ -56,25 +56,25 @@ feats = backbone(x)
|
|
| 56 |
print(len(feats), [tuple(f.shape) for f in feats])
|
| 57 |
```
|
| 58 |
|
| 59 |
-
Load any ResNet variant the same way with `from_weights("
|
| 60 |
|
| 61 |
| Variant | Hub |
|
| 62 |
|---|---|
|
| 63 |
-
| `resnet101_a1_in1k` | [`
|
| 64 |
-
| `resnet101_gluon_in1k` | [`
|
| 65 |
-
| `resnet101_tv_in1k` | [`
|
| 66 |
-
| `resnet152_a1_in1k` | [`
|
| 67 |
-
| `resnet152_gluon_in1k` | [`
|
| 68 |
-
| `resnet152_tv_in1k` | [`
|
| 69 |
-
| `resnet50_a1_in1k` | [`
|
| 70 |
-
| `resnet50_gluon_in1k` | [`
|
| 71 |
-
| `resnet50_tv_in1k` | [`
|
| 72 |
|
| 73 |
## Tips
|
| 74 |
|
| 75 |
-
- Set `KERAS_BACKEND` **before** importing Keras /
|
| 76 |
- `ResNetImageClassify` returns class logits; `ResNetModel` returns features (`as_backbone=True` for multi-scale stages).
|
| 77 |
-
- See [docs](https://imvision12.github.io/
|
| 78 |
- Upstream / timm checkpoints: `ResNetImageClassify.from_weights("hf:timm/resnet101.tv_in1k")`.
|
| 79 |
|
| 80 |
## Special Thanks
|
|
|
|
| 2 |
pipeline_tag: image-classification
|
| 3 |
license: bsd-3-clause
|
| 4 |
base_model: timm/resnet101.tv_in1k
|
| 5 |
+
library_name: zeromodels
|
| 6 |
tags:
|
| 7 |
- keras
|
| 8 |
+
- zeromodels
|
| 9 |
- image-classification
|
| 10 |
- resnet
|
| 11 |
- backbone
|
|
|
|
| 15 |
- tf
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## ***See [our collection](https://huggingface.co/collections/zeromodels/resnet-6a6bdb1828cbb9f69b42cde0) for all versions of ResNet.***
|
| 19 |
|
| 20 |
# Run ResNet 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/resnet-6a6bdb1828cbb9f69b42cde0)
|
| 23 |
|
| 24 |
+
# zeromodels/resnet101_tv_in1k
|
| 25 |
|
| 26 |
Paper: [Deep Residual Learning for Image Recognition (arXiv:1512.03385)](https://arxiv.org/abs/1512.03385) · [HF Papers](https://huggingface.co/papers/1512.03385)
|
| 27 |
|
|
|
|
| 29 |
|
| 30 |
For more details on the model, please go to the upstream [model card](https://huggingface.co/timm/resnet101.tv_in1k).
|
| 31 |
|
| 32 |
+
Pure-**Keras 3** conversion of [`timm/resnet101.tv_in1k`](https://huggingface.co/timm/resnet101.tv_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 (`ResNetImageClassify` / `ResNetModel`).
|
| 35 |
|
|
|
|
| 41 |
|
| 42 |
from PIL import Image
|
| 43 |
import numpy as np
|
| 44 |
+
from zeromodels.models.resnet import ResNetImageClassify, ResNetModel
|
| 45 |
|
| 46 |
+
model = ResNetImageClassify.from_weights("zeromodels/resnet101_tv_in1k")
|
| 47 |
backbone = ResNetModel.from_weights(
|
| 48 |
+
"zeromodels/resnet101_tv_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 ResNet variant the same way with `from_weights("zeromodels/<variant>")`:
|
| 60 |
|
| 61 |
| Variant | Hub |
|
| 62 |
|---|---|
|
| 63 |
+
| `resnet101_a1_in1k` | [`zeromodels/resnet101_a1_in1k`](https://huggingface.co/zeromodels/resnet101_a1_in1k) |
|
| 64 |
+
| `resnet101_gluon_in1k` | [`zeromodels/resnet101_gluon_in1k`](https://huggingface.co/zeromodels/resnet101_gluon_in1k) |
|
| 65 |
+
| `resnet101_tv_in1k` | [`zeromodels/resnet101_tv_in1k`](https://huggingface.co/zeromodels/resnet101_tv_in1k) |
|
| 66 |
+
| `resnet152_a1_in1k` | [`zeromodels/resnet152_a1_in1k`](https://huggingface.co/zeromodels/resnet152_a1_in1k) |
|
| 67 |
+
| `resnet152_gluon_in1k` | [`zeromodels/resnet152_gluon_in1k`](https://huggingface.co/zeromodels/resnet152_gluon_in1k) |
|
| 68 |
+
| `resnet152_tv_in1k` | [`zeromodels/resnet152_tv_in1k`](https://huggingface.co/zeromodels/resnet152_tv_in1k) |
|
| 69 |
+
| `resnet50_a1_in1k` | [`zeromodels/resnet50_a1_in1k`](https://huggingface.co/zeromodels/resnet50_a1_in1k) |
|
| 70 |
+
| `resnet50_gluon_in1k` | [`zeromodels/resnet50_gluon_in1k`](https://huggingface.co/zeromodels/resnet50_gluon_in1k) |
|
| 71 |
+
| `resnet50_tv_in1k` | [`zeromodels/resnet50_tv_in1k`](https://huggingface.co/zeromodels/resnet50_tv_in1k) |
|
| 72 |
|
| 73 |
## Tips
|
| 74 |
|
| 75 |
+
- Set `KERAS_BACKEND` **before** importing Keras / zeromodels.
|
| 76 |
- `ResNetImageClassify` returns class logits; `ResNetModel` returns features (`as_backbone=True` for multi-scale stages).
|
| 77 |
+
- See [docs](https://imvision12.github.io/ZeroModels/classification_backbones/) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).
|
| 78 |
- Upstream / timm checkpoints: `ResNetImageClassify.from_weights("hf:timm/resnet101.tv_in1k")`.
|
| 79 |
|
| 80 |
## Special Thanks
|
kf_config.json → zm_config.json
RENAMED
|
@@ -1,26 +1,26 @@
|
|
| 1 |
-
{
|
| 2 |
-
"library_name": "
|
| 3 |
-
"
|
| 4 |
-
"model_module": "
|
| 5 |
-
"model_class": "ResNetImageClassify",
|
| 6 |
-
"variant": "resnet101_tv_in1k",
|
| 7 |
-
"weights": "model.weights.h5",
|
| 8 |
-
"schema_version": 2,
|
| 9 |
-
"weight_dtype": "float32",
|
| 10 |
-
"model_type": "resnet",
|
| 11 |
-
"vision_config": {
|
| 12 |
-
"depths": [
|
| 13 |
-
3,
|
| 14 |
-
4,
|
| 15 |
-
23,
|
| 16 |
-
3
|
| 17 |
-
],
|
| 18 |
-
"filters": [
|
| 19 |
-
64,
|
| 20 |
-
128,
|
| 21 |
-
256,
|
| 22 |
-
512
|
| 23 |
-
],
|
| 24 |
-
"num_classes": 1000
|
| 25 |
-
}
|
| 26 |
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"library_name": "zeromodels",
|
| 3 |
+
"zeromodels_version": "1.2.1",
|
| 4 |
+
"model_module": "zeromodels.models.resnet",
|
| 5 |
+
"model_class": "ResNetImageClassify",
|
| 6 |
+
"variant": "resnet101_tv_in1k",
|
| 7 |
+
"weights": "model.weights.h5",
|
| 8 |
+
"schema_version": 2,
|
| 9 |
+
"weight_dtype": "float32",
|
| 10 |
+
"model_type": "resnet",
|
| 11 |
+
"vision_config": {
|
| 12 |
+
"depths": [
|
| 13 |
+
3,
|
| 14 |
+
4,
|
| 15 |
+
23,
|
| 16 |
+
3
|
| 17 |
+
],
|
| 18 |
+
"filters": [
|
| 19 |
+
64,
|
| 20 |
+
128,
|
| 21 |
+
256,
|
| 22 |
+
512
|
| 23 |
+
],
|
| 24 |
+
"num_classes": 1000
|
| 25 |
+
}
|
| 26 |
}
|