Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,56 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
datasets:
|
4 |
+
- imagenet-1k
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
metrics:
|
8 |
+
- accuracy
|
9 |
+
pipeline_tag: image-classification
|
10 |
---
|
11 |
+
|
12 |
+
[Alias-Free Convnets: Fractional Shift Invariance via Polynomial Activations](https://hmichaeli.github.io/alias_free_convnets/)
|
13 |
+
|
14 |
+
Official PyTorch trained model.
|
15 |
+
|
16 |
+
This is a ConvNeXt-Tiny variant.
|
17 |
+
|
18 |
+
convnext-baseline is ConvNeXt-Tiny with circular-padded convolutions.
|
19 |
+
convnext-afc is The full ConvNeXt-Tiny-AFC which is shift invariant to circular shifts.
|
20 |
+
|
21 |
+
For more details see the [paper](https://arxiv.org/abs/2303.08085) or the [implementation](https://github.com/hmichaeli/alias_free_convnets).
|
22 |
+
|
23 |
+
```bash
|
24 |
+
git clone https://github.com/hmichaeli/alias_free_convnets.git
|
25 |
+
```
|
26 |
+
|
27 |
+
```python
|
28 |
+
from huggingface_hub import hf_hub_download
|
29 |
+
import torch
|
30 |
+
from alias_free_convnets.models.convnext_afc import convnext_afc_tiny
|
31 |
+
|
32 |
+
# baseline
|
33 |
+
path = hf_hub_download(repo_id="hmichaeli/convnext-afc", filename="convnext_tiny_basline.pth")
|
34 |
+
ckpt = torch.load(path)
|
35 |
+
base_model = convnext_afc_tiny(pretrained=False, num_classes=1000)
|
36 |
+
base_model.load_state_dict(ckpt, strict=True)
|
37 |
+
|
38 |
+
# AFC
|
39 |
+
path = hf_hub_download(repo_id="hmichaeli/convnext-afc", filename="convnext_tiny_afc.pth")
|
40 |
+
ckpt = torch.load(path)
|
41 |
+
afc_model = convnext_afc_tiny(
|
42 |
+
pretrained=False,
|
43 |
+
num_classes=1000,
|
44 |
+
activation='up_poly_per_channel',
|
45 |
+
activation_kwargs={'in_scale': 7, 'out_scale': 7, 'train_scale': True},
|
46 |
+
blurpool_kwargs={"filter_type": "ideal", "scale_l2": False},
|
47 |
+
normalization_type='CHW2',
|
48 |
+
stem_activation_kwargs={"in_scale": 7, "out_scale": 7, "train_scale": True, "cutoff": 0.75},
|
49 |
+
normalization_kwargs={},
|
50 |
+
stem_mode='activation_residual', stem_activation='lpf_poly_per_channel'
|
51 |
+
)
|
52 |
+
afc_model.load_state_dict(ckpt, strict=False)
|
53 |
+
|
54 |
+
```
|
55 |
+
|
56 |
+
|