Views
No views yet
timm/deit_tiny_distilled_patch16_224.fb_in1k for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX.DeiTImageClassify / DeiTModel).1import os
2
3os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
4
5from PIL import Image
6from zeromodels.models.deit import DeiTImageClassify, DeiTModel, DeiTImageProcessor
7
8model = DeiTImageClassify.from_weights("zeromodels/deit_tiny_distilled_patch16_224_fb_in1k")
9processor = DeiTImageProcessor.from_weights("zeromodels/deit_tiny_distilled_patch16_224_fb_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 = DeiTModel.from_weights("zeromodels/deit_tiny_distilled_patch16_224_fb_in1k", as_backbone=True)
18features = backbone(pixels, training=False)from_weights("zeromodels/<variant>"):KERAS_BACKEND before importing Keras / zeromodels.DeiTImageClassify returns class logits; DeiTModel returns features (as_backbone=True for multi-scale stages).DeiTImageClassify.from_weights("hf:timm/deit_tiny_distilled_patch16_224.fb_in1k").license (usually matches the upstream checkpoint).