Instructions to use zeromodels/convnext_xlarge_fb_in22k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use zeromodels/convnext_xlarge_fb_in22k with KerasFormers:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Keras
How to use zeromodels/convnext_xlarge_fb_in22k 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/convnext_xlarge_fb_in22k") - Notebooks
- Google Colab
- Kaggle
fix readme.md
Browse files
README.md
CHANGED
|
@@ -8,23 +8,92 @@ tags:
|
|
| 8 |
- kerasformers
|
| 9 |
- image-classification
|
| 10 |
- convnext
|
| 11 |
-
-
|
|
|
|
| 12 |
- pytorch
|
|
|
|
| 13 |
- tf
|
| 14 |
---
|
| 15 |
|
| 16 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
Pure-Keras 3
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
```python
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
from
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
model = ConvNeXtImageClassify.from_weights("convnext_xlarge_fb_in22k")
|
|
|
|
|
|
|
|
|
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
```
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
- kerasformers
|
| 9 |
- image-classification
|
| 10 |
- convnext
|
| 11 |
+
- backbone
|
| 12 |
+
- arxiv:2201.03545
|
| 13 |
- pytorch
|
| 14 |
+
- jax
|
| 15 |
- tf
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## ***See [our collection](https://huggingface.co/collections/kerasformers/convnext-6a6bd0f2a94679977d564d48) for all versions of ConvNeXt.***
|
| 19 |
+
|
| 20 |
+
# Run ConvNeXt with Keras 3: JAX, PyTorch, or TensorFlow
|
| 21 |
+
|
| 22 |
+
[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/classification_backbones/) [](https://huggingface.co/collections/kerasformers/convnext-6a6bd0f2a94679977d564d48)
|
| 23 |
+
|
| 24 |
+
# kerasformers/convnext_xlarge_fb_in22k
|
| 25 |
+
|
| 26 |
+
Paper: [A ConvNet for the 2020s (arXiv:2201.03545)](https://arxiv.org/abs/2201.03545) · [HF Papers](https://huggingface.co/papers/2201.03545)
|
| 27 |
+
|
| 28 |
+
ConvNeXt modernizes a ResNet-style CNN with ViT-inspired design choices. Use as ImageNet classifier or 4-stage backbone.
|
| 29 |
+
|
| 30 |
+
For more details on the model, please go to the upstream [model card](https://huggingface.co/timm/convnext_xlarge.fb_in22k).
|
| 31 |
|
| 32 |
+
Pure-**Keras 3** conversion of [`timm/convnext_xlarge.fb_in22k`](https://huggingface.co/timm/convnext_xlarge.fb_in22k) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
|
| 33 |
|
| 34 |
+
This is an **image-classification / backbone** checkpoint (`ConvNeXtImageClassify` / `ConvNeXtModel`).
|
| 35 |
+
|
| 36 |
+
## ✨ Quick start
|
| 37 |
|
| 38 |
```python
|
| 39 |
+
import os
|
| 40 |
+
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
|
| 41 |
|
| 42 |
+
from PIL import Image
|
| 43 |
+
import numpy as np
|
| 44 |
+
from kerasformers.models.convnext import ConvNeXtImageClassify, ConvNeXtModel
|
| 45 |
|
| 46 |
+
model = ConvNeXtImageClassify.from_weights("kerasformers/convnext_xlarge_fb_in22k")
|
| 47 |
+
backbone = ConvNeXtModel.from_weights(
|
| 48 |
+
"kerasformers/convnext_xlarge_fb_in22k", as_backbone=True
|
| 49 |
+
)
|
| 50 |
|
| 51 |
+
image = Image.open("your_image.jpg").convert("RGB")
|
| 52 |
+
image = image.resize((224, 224))
|
| 53 |
+
x = np.asarray(image, dtype="float32")[None] # (1, H, W, 3)
|
| 54 |
+
print(model(x).shape) # (1, num_classes)
|
| 55 |
+
feats = backbone(x)
|
| 56 |
+
print(len(feats), [tuple(f.shape) for f in feats])
|
| 57 |
```
|
| 58 |
|
| 59 |
+
Load any ConvNeXt variant the same way with `from_weights("kerasformers/<variant>")`:
|
| 60 |
+
|
| 61 |
+
| Variant | Hub |
|
| 62 |
+
|---|---|
|
| 63 |
+
| `convnext_atto_d2_in1k` | [`kerasformers/convnext_atto_d2_in1k`](https://huggingface.co/kerasformers/convnext_atto_d2_in1k) |
|
| 64 |
+
| `convnext_base_fb_in1k` | [`kerasformers/convnext_base_fb_in1k`](https://huggingface.co/kerasformers/convnext_base_fb_in1k) |
|
| 65 |
+
| `convnext_base_fb_in22k` | [`kerasformers/convnext_base_fb_in22k`](https://huggingface.co/kerasformers/convnext_base_fb_in22k) |
|
| 66 |
+
| `convnext_base_fb_in22k_ft_in1k` | [`kerasformers/convnext_base_fb_in22k_ft_in1k`](https://huggingface.co/kerasformers/convnext_base_fb_in22k_ft_in1k) |
|
| 67 |
+
| `convnext_base_fb_in22k_ft_in1k_384` | [`kerasformers/convnext_base_fb_in22k_ft_in1k_384`](https://huggingface.co/kerasformers/convnext_base_fb_in22k_ft_in1k_384) |
|
| 68 |
+
| `convnext_femto_d1_in1k` | [`kerasformers/convnext_femto_d1_in1k`](https://huggingface.co/kerasformers/convnext_femto_d1_in1k) |
|
| 69 |
+
| `convnext_large_fb_in1k` | [`kerasformers/convnext_large_fb_in1k`](https://huggingface.co/kerasformers/convnext_large_fb_in1k) |
|
| 70 |
+
| `convnext_large_fb_in22k` | [`kerasformers/convnext_large_fb_in22k`](https://huggingface.co/kerasformers/convnext_large_fb_in22k) |
|
| 71 |
+
| `convnext_large_fb_in22k_ft_in1k` | [`kerasformers/convnext_large_fb_in22k_ft_in1k`](https://huggingface.co/kerasformers/convnext_large_fb_in22k_ft_in1k) |
|
| 72 |
+
| `convnext_large_fb_in22k_ft_in1k_384` | [`kerasformers/convnext_large_fb_in22k_ft_in1k_384`](https://huggingface.co/kerasformers/convnext_large_fb_in22k_ft_in1k_384) |
|
| 73 |
+
| `convnext_nano_d1h_in1k` | [`kerasformers/convnext_nano_d1h_in1k`](https://huggingface.co/kerasformers/convnext_nano_d1h_in1k) |
|
| 74 |
+
| `convnext_nano_in12k_ft_in1k` | [`kerasformers/convnext_nano_in12k_ft_in1k`](https://huggingface.co/kerasformers/convnext_nano_in12k_ft_in1k) |
|
| 75 |
+
| `convnext_pico_d1_in1k` | [`kerasformers/convnext_pico_d1_in1k`](https://huggingface.co/kerasformers/convnext_pico_d1_in1k) |
|
| 76 |
+
| `convnext_small_fb_in1k` | [`kerasformers/convnext_small_fb_in1k`](https://huggingface.co/kerasformers/convnext_small_fb_in1k) |
|
| 77 |
+
| `convnext_small_fb_in22k` | [`kerasformers/convnext_small_fb_in22k`](https://huggingface.co/kerasformers/convnext_small_fb_in22k) |
|
| 78 |
+
| `convnext_small_fb_in22k_ft_in1k` | [`kerasformers/convnext_small_fb_in22k_ft_in1k`](https://huggingface.co/kerasformers/convnext_small_fb_in22k_ft_in1k) |
|
| 79 |
+
| `convnext_small_fb_in22k_ft_in1k_384` | [`kerasformers/convnext_small_fb_in22k_ft_in1k_384`](https://huggingface.co/kerasformers/convnext_small_fb_in22k_ft_in1k_384) |
|
| 80 |
+
| `convnext_tiny_fb_in1k` | [`kerasformers/convnext_tiny_fb_in1k`](https://huggingface.co/kerasformers/convnext_tiny_fb_in1k) |
|
| 81 |
+
| `convnext_tiny_fb_in22k` | [`kerasformers/convnext_tiny_fb_in22k`](https://huggingface.co/kerasformers/convnext_tiny_fb_in22k) |
|
| 82 |
+
| `convnext_tiny_fb_in22k_ft_in1k` | [`kerasformers/convnext_tiny_fb_in22k_ft_in1k`](https://huggingface.co/kerasformers/convnext_tiny_fb_in22k_ft_in1k) |
|
| 83 |
+
| `convnext_tiny_fb_in22k_ft_in1k_384` | [`kerasformers/convnext_tiny_fb_in22k_ft_in1k_384`](https://huggingface.co/kerasformers/convnext_tiny_fb_in22k_ft_in1k_384) |
|
| 84 |
+
| `convnext_xlarge_fb_in22k` | [`kerasformers/convnext_xlarge_fb_in22k`](https://huggingface.co/kerasformers/convnext_xlarge_fb_in22k) |
|
| 85 |
+
| `convnext_xlarge_fb_in22k_ft_in1k` | [`kerasformers/convnext_xlarge_fb_in22k_ft_in1k`](https://huggingface.co/kerasformers/convnext_xlarge_fb_in22k_ft_in1k) |
|
| 86 |
+
| `convnext_xlarge_fb_in22k_ft_in1k_384` | [`kerasformers/convnext_xlarge_fb_in22k_ft_in1k_384`](https://huggingface.co/kerasformers/convnext_xlarge_fb_in22k_ft_in1k_384) |
|
| 87 |
+
|
| 88 |
+
## Tips
|
| 89 |
+
|
| 90 |
+
- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
|
| 91 |
+
- `ConvNeXtImageClassify` returns class logits; `ConvNeXtModel` returns features (`as_backbone=True` for multi-scale stages).
|
| 92 |
+
- See [docs](https://imvision12.github.io/KerasFormers/classification_backbones/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
|
| 93 |
+
- Upstream / timm checkpoints: `ConvNeXtImageClassify.from_weights("hf:timm/convnext_xlarge.fb_in22k")`.
|
| 94 |
+
|
| 95 |
+
## Special Thanks
|
| 96 |
+
|
| 97 |
+
A huge thank you to the ConvNeXt authors and the timm / Hub communities for creating and releasing these models.
|
| 98 |
+
|
| 99 |
+
License: see YAML `license` (usually matches the upstream checkpoint).
|