Instructions to use zeromodels/res2net50_26w_8s_in1k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/res2net50_26w_8s_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/res2net50_26w_8s_in1k") - Keras
How to use zeromodels/res2net50_26w_8s_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/res2net50_26w_8s_in1k") - Notebooks
- Google Colab
- Kaggle
Migrate to zeromodels (rename kf_*.json -> zm_*.json, fix refs in config + README, ensure tag + badge)
d60066e verified | pipeline_tag: image-classification | |
| license: unknown | |
| base_model: timm/res2net50_26w_8s.in1k | |
| library_name: zeromodels | |
| tags: | |
| - keras | |
| - zeromodels | |
| - image-classification | |
| - res2net | |
| - backbone | |
| - arxiv:1904.01169 | |
| - pytorch | |
| - jax | |
| - tf | |
| ## ***See [our collection](https://huggingface.co/collections/zeromodels/res2net-6a6bda790be5abb92d20d85f) for all versions of Res2Net.*** | |
| # Run Res2Net with Keras 3: JAX, PyTorch, or TensorFlow | |
| [](https://github.com/IMvision12/ZeroModels) [](https://imvision12.github.io/ZeroModels/classification_backbones/) [](https://huggingface.co/collections/zeromodels/res2net-6a6bda790be5abb92d20d85f) | |
| # zeromodels/res2net50_26w_8s_in1k | |
| Paper: [Res2Net: A New Multi-scale Backbone Architecture (arXiv:1904.01169)](https://arxiv.org/abs/1904.01169) · [HF Papers](https://huggingface.co/papers/1904.01169) | |
| Res2Net represents multi-scale features at a granular level inside residual blocks. Available as classifier and feature backbone. | |
| For more details on the model, please go to the upstream [model card](https://huggingface.co/timm/res2net50_26w_8s.in1k). | |
| Pure-**Keras 3** conversion of [`timm/res2net50_26w_8s.in1k`](https://huggingface.co/timm/res2net50_26w_8s.in1k) for [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on **TensorFlow / Torch / JAX**. | |
| This is an **image-classification / backbone** checkpoint (`Res2NetImageClassify` / `Res2NetModel`). | |
| ## ✨ Quick start | |
| ```python | |
| import os | |
| os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow" | |
| from PIL import Image | |
| import numpy as np | |
| from zeromodels.models.res2net import Res2NetImageClassify, Res2NetModel | |
| model = Res2NetImageClassify.from_weights("zeromodels/res2net50_26w_8s_in1k") | |
| backbone = Res2NetModel.from_weights( | |
| "zeromodels/res2net50_26w_8s_in1k", as_backbone=True | |
| ) | |
| image = Image.open("your_image.jpg").convert("RGB") | |
| image = image.resize((224, 224)) | |
| x = np.asarray(image, dtype="float32")[None] # (1, H, W, 3) | |
| print(model(x).shape) # (1, num_classes) | |
| feats = backbone(x) | |
| print(len(feats), [tuple(f.shape) for f in feats]) | |
| ``` | |
| Load any Res2Net variant the same way with `from_weights("zeromodels/<variant>")`: | |
| | Variant | Hub | | |
| |---|---| | |
| | `res2net101_26w_4s_in1k` | [`zeromodels/res2net101_26w_4s_in1k`](https://huggingface.co/zeromodels/res2net101_26w_4s_in1k) | | |
| | `res2net50_14w_8s_in1k` | [`zeromodels/res2net50_14w_8s_in1k`](https://huggingface.co/zeromodels/res2net50_14w_8s_in1k) | | |
| | `res2net50_26w_4s_in1k` | [`zeromodels/res2net50_26w_4s_in1k`](https://huggingface.co/zeromodels/res2net50_26w_4s_in1k) | | |
| | `res2net50_26w_6s_in1k` | [`zeromodels/res2net50_26w_6s_in1k`](https://huggingface.co/zeromodels/res2net50_26w_6s_in1k) | | |
| | `res2net50_26w_8s_in1k` | [`zeromodels/res2net50_26w_8s_in1k`](https://huggingface.co/zeromodels/res2net50_26w_8s_in1k) | | |
| | `res2net50_48w_2s_in1k` | [`zeromodels/res2net50_48w_2s_in1k`](https://huggingface.co/zeromodels/res2net50_48w_2s_in1k) | | |
| | `res2next50_in1k` | [`zeromodels/res2next50_in1k`](https://huggingface.co/zeromodels/res2next50_in1k) | | |
| ## Tips | |
| - Set `KERAS_BACKEND` **before** importing Keras / zeromodels. | |
| - `Res2NetImageClassify` returns class logits; `Res2NetModel` returns features (`as_backbone=True` for multi-scale stages). | |
| - See [docs](https://imvision12.github.io/ZeroModels/classification_backbones/) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/). | |
| - Upstream / timm checkpoints: `Res2NetImageClassify.from_weights("hf:timm/res2net50_26w_8s.in1k")`. | |
| ## Special Thanks | |
| A huge thank you to the Res2Net authors and the timm / Hub communities for creating and releasing these models. | |
| License: see YAML `license` (usually matches the upstream checkpoint). | |