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