convnext-afc / README.md
hmichaeli's picture
Update README.md
c1333ba
metadata
license: mit
datasets:
  - imagenet-1k
language:
  - en
metrics:
  - accuracy
pipeline_tag: image-classification

Alias-Free Convnets: Fractional Shift Invariance via Polynomial Activations

Official PyTorch trained model.

This is a ConvNeXt-Tiny variant.

convnext-baseline is ConvNeXt-Tiny with circular-padded convolutions. convnext-afc is The full ConvNeXt-Tiny-AFC which is shift invariant to circular shifts.

For more details see the paper or the implementation.

git clone https://github.com/hmichaeli/alias_free_convnets.git
from huggingface_hub import hf_hub_download
import torch
from alias_free_convnets.models.convnext_afc import convnext_afc_tiny

# baseline
path = hf_hub_download(repo_id="hmichaeli/convnext-afc", filename="convnext_tiny_basline.pth")
ckpt = torch.load(path)
base_model = convnext_afc_tiny(pretrained=False, num_classes=1000)
base_model.load_state_dict(ckpt, strict=True)

# AFC
path = hf_hub_download(repo_id="hmichaeli/convnext-afc", filename="convnext_tiny_afc.pth")
ckpt = torch.load(path)
afc_model = convnext_afc_tiny(
        pretrained=False,
        num_classes=1000,
        activation='up_poly_per_channel',
        activation_kwargs={'in_scale': 7, 'out_scale': 7, 'train_scale': True},
        blurpool_kwargs={"filter_type": "ideal", "scale_l2": False},
        normalization_type='CHW2',
        stem_activation_kwargs={"in_scale": 7, "out_scale": 7, "train_scale": True, "cutoff": 0.75},
        normalization_kwargs={},
        stem_mode='activation_residual', stem_activation='lpf_poly_per_channel'
    )
afc_model.load_state_dict(ckpt, strict=False)