convnext-afc / README.md
hmichaeli's picture
Update README.md
c1333ba
|
raw
history blame
No virus
1.78 kB
---
license: mit
datasets:
- imagenet-1k
language:
- en
metrics:
- accuracy
pipeline_tag: image-classification
---
[Alias-Free Convnets: Fractional Shift Invariance via Polynomial Activations](https://hmichaeli.github.io/alias_free_convnets/)
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](https://arxiv.org/abs/2303.08085) or the [implementation](https://github.com/hmichaeli/alias_free_convnets).
```bash
git clone https://github.com/hmichaeli/alias_free_convnets.git
```
```python
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)
```