Views
No views yet
timm/efficientformer_l7.snap_dist_in1k for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX.EfficientFormerImageClassify / EfficientFormerModel).1import os
2
3os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
4
5from PIL import Image
6from zeromodels.models.efficientformer import EfficientFormerImageClassify, EfficientFormerModel, EfficientFormerImageProcessor
7
8model = EfficientFormerImageClassify.from_weights("zeromodels/efficientformer_l7_snap_dist_in1k")
9processor = EfficientFormerImageProcessor.from_weights("zeromodels/efficientformer_l7_snap_dist_in1k")
10
11image = Image.open("your_image.jpg").convert("RGB")
12pixels = processor(image) # resize + normalize (normalization lives in the processor)
13logits = model(pixels, training=False)
14print(logits.shape) # (1, num_classes)
15
16# Feature extraction: the backbone without the classifier head
17backbone = EfficientFormerModel.from_weights("zeromodels/efficientformer_l7_snap_dist_in1k", as_backbone=True)
18features = backbone(pixels, training=False)from_weights("zeromodels/<variant>"):| Variant | Hub |
|---|---|
efficientformer_l1_snap_dist_in1k | zeromodels/efficientformer_l1_snap_dist_in1k |
efficientformer_l3_snap_dist_in1k | zeromodels/efficientformer_l3_snap_dist_in1k |
efficientformer_l7_snap_dist_in1k | zeromodels/efficientformer_l7_snap_dist_in1k |
KERAS_BACKEND before importing Keras / zeromodels.EfficientFormerImageClassify returns class logits; EfficientFormerModel returns features (as_backbone=True for multi-scale stages).EfficientFormerImageClassify.from_weights("hf:timm/efficientformer_l7.snap_dist_in1k").license (usually matches the upstream checkpoint).