See our collection for all versions of PoolFormer.

Run PoolFormer with Keras 3: JAX, PyTorch, or TensorFlow

GitHub Docs Collection

zeromodels/poolformer_s24_sail_in1k

Paper: MetaFormer Is Actually What You Need for Vision (arXiv:2111.11418) · HF Papers

PoolFormer shows MetaFormer with pooling as the token mixer can match strong vision baselines. Classifier or 4-stage backbone.

For more details on the model, please go to the upstream model card.

Pure-Keras 3 conversion of timm/poolformer_s24.sail_in1k for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX.

This is an image-classification / backbone checkpoint (PoolFormerImageClassify / PoolFormerModel).

✨ Quick start

import os

os.environ["KERAS_BACKEND"] = "torch"  # or "jax" / "tensorflow"

from PIL import Image
from zeromodels.models.poolformer import PoolFormerImageClassify, PoolFormerModel, PoolFormerImageProcessor

model = PoolFormerImageClassify.from_weights("zeromodels/poolformer_s24_sail_in1k")
processor = PoolFormerImageProcessor.from_weights("zeromodels/poolformer_s24_sail_in1k")

image = Image.open("your_image.jpg").convert("RGB")
pixels = processor(image)  # resize + normalize (normalization lives in the processor)
logits = model(pixels, training=False)
print(logits.shape)  # (1, num_classes)

# Feature extraction: the backbone without the classifier head
backbone = PoolFormerModel.from_weights("zeromodels/poolformer_s24_sail_in1k", as_backbone=True)
features = backbone(pixels, training=False)

Load any PoolFormer variant the same way with from_weights("zeromodels/<variant>"):

Variant Hub
poolformer_m36_sail_in1k zeromodels/poolformer_m36_sail_in1k
poolformer_m48_sail_in1k zeromodels/poolformer_m48_sail_in1k
poolformer_s12_sail_in1k zeromodels/poolformer_s12_sail_in1k
poolformer_s24_sail_in1k zeromodels/poolformer_s24_sail_in1k
poolformer_s36_sail_in1k zeromodels/poolformer_s36_sail_in1k

Tips

  • Set KERAS_BACKEND before importing Keras / zeromodels.
  • PoolFormerImageClassify returns class logits; PoolFormerModel returns features (as_backbone=True for multi-scale stages).
  • See docs and Loading Weights.
  • Upstream / timm checkpoints: PoolFormerImageClassify.from_weights("hf:timm/poolformer_s24.sail_in1k").

Special Thanks

A huge thank you to the PoolFormer authors and the timm / Hub communities for creating and releasing these models.

License: see YAML license (usually matches the upstream checkpoint).

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for zeromodels/poolformer_s24_sail_in1k

Finetuned
(1)
this model

Collection including zeromodels/poolformer_s24_sail_in1k

Paper for zeromodels/poolformer_s24_sail_in1k