The model consists of consecutive 10 Gram ConvKAN Layers with InstanceNorm2d, polynomial degree equal to 5, GlobalAveragePooling and Linear classification head:
- KAGN Convolution, 32 filters, 3x3
- Max pooling, 2x2
- KAGN Convolution, 64 filters, 3x3
- Max pooling, 2x2
- KAGN Convolution, 128 filters, 3x3
- KAGN Convolution, 128 filters, 3x3
- Max pooling, 2x2
- KAGN Convolution, 256 filters, 3x3
- KAGN Convolution, 256 filters, 3x3 10 Max pooling, 2x2
- KAGN Convolution, 256 filters, 3x3
- KAGN Convolution, 256 filters, 3x3
- Max pooling, 2x2
- KAGN Convolution, 256 filters, 3x3
- KAGN Convolution, 256 filters, 3x3
- Global Average pooling
- Output layer, 1000 nodes.
This model trained on Imagenet1k dataset (1281167 images in train set)
Model was trained during 200 full epochs with AdamW optimizer, with following parameters:
{'learning_rate': 0.0009, 'adam_beta1': 0.9, 'adam_beta2': 0.999, 'adam_weight_decay': 5e-06,
'adam_epsilon': 1e-08, 'lr_warmup_steps': 7500, 'lr_power': 0.3, 'lr_end': 1e-07, 'set_grads_to_none': False}
And this augmnetations:
from torchvision.transforms import v2
from torchvision.transforms.autoaugment import AutoAugmentPolicy
transforms_train = v2.Compose([
v2.ToImage(),
v2.RandomHorizontalFlip(p=0.5),
v2.RandomResizedCrop(224, antialias=True),
v2.RandomChoice([v2.AutoAugment(AutoAugmentPolicy.CIFAR10),
v2.AutoAugment(AutoAugmentPolicy.IMAGENET)
]),
v2.ToDtype(torch.float32, scale=True),
v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
On Imagenet1k Validation:
Accuracy, top1 | Accuracy, top5 | AUC (ovo) | AUC (ovr) |
---|---|---|---|
59.1 | 82.29 | 99.43 | 99.43 |
On Imagenet1k Test: Coming soon
The model consists of consecutive 10 Gram ConvKAN Layers with InstanceNorm2d, polynomial degree equal to 5, GlobalAveragePooling and Linear classification head:
- KAGN Convolution, 32 filters, 3x3
- Max pooling, 2x2
- KAGN Convolution, 64 filters, 3x3
- Max pooling, 2x2
- KAGN Convolution, 128 filters, 3x3
- KAGN Convolution, 128 filters, 3x3
- Max pooling, 2x2
- KAGN Convolution, 256 filters, 3x3
- KAGN Convolution, 256 filters, 3x3 10 Max pooling, 2x2
- KAGN Convolution, 256 filters, 3x3
- KAGN Convolution, 256 filters, 3x3
- Max pooling, 2x2
- KAGN Convolution, 512 filters, 3x3
- KAGN Convolution, 512 filters, 3x3
- Global Average pooling
- Output layer, 1000 nodes.
This model trained on Imagenet1k dataset (1281167 images in train set)
Model was trained during 200 full epochs with AdamW optimizer, with following parameters:
{'learning_rate': 0.0009, 'adam_beta1': 0.9, 'adam_beta2': 0.999, 'adam_weight_decay': 5e-06,
'adam_epsilon': 1e-08, 'lr_warmup_steps': 7500, 'lr_power': 0.3, 'lr_end': 1e-07, 'set_grads_to_none': False}
And this augmnetations:
from torchvision.transforms import v2
from torchvision.transforms.autoaugment import AutoAugmentPolicy
transforms_train = v2.Compose([
v2.ToImage(),
v2.RandomHorizontalFlip(p=0.5),
v2.RandomResizedCrop(224, antialias=True),
v2.RandomChoice([v2.AutoAugment(AutoAugmentPolicy.CIFAR10),
v2.AutoAugment(AutoAugmentPolicy.IMAGENET)
]),
v2.ToDtype(torch.float32, scale=True),
v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
On Imagenet1k Validation:
Accuracy, top1 | Accuracy, top5 | AUC (ovo) | AUC (ovr) |
---|---|---|---|
61.17 | 83.26 | 99.42 | 99.43 |
On Imagenet1k Test: Coming soon
The model consists of consecutive 10 Bottleneck Gram ConvKAN Layers with BatchNorm2D, polynomial degree equal to 5, GlobalAveragePooling and Linear classification head:
- BottleNeck KAGN Convolution, 32 filters, 3x3
- Max pooling, 2x2
- BottleNeck KAGN Convolution, 64 filters, 3x3
- Max pooling, 2x2
- BottleNeck KAGN Convolution, 128 filters, 3x3
- BottleNeck KAGN Convolution, 128 filters, 3x3
- Max pooling, 2x2
- BottleNeck KAGN Convolution, 256 filters, 3x3
- BottleNeck KAGN Convolution, 256 filters, 3x3 10 Max pooling, 2x2
- BottleNeck KAGN Convolution, 256 filters, 3x3
- BottleNeck KAGN Convolution, 256 filters, 3x3
- Max pooling, 2x2
- BottleNeck KAGN Convolution, 512 filters, 3x3
- BottleNeck KAGN Convolution, 512 filters, 3x3
- Global Average pooling
- Output layer, 1000 nodes.
This model trained on Imagenet1k dataset (1281167 images in train set)
Model was trained during 200 full epochs with AdamW optimizer, with following parameters:
{'learning_rate': 0.0005, 'adam_beta1': 0.9, 'adam_beta2': 0.999, 'adam_weight_decay': 5e-06,
'adam_epsilon': 1e-08, 'lr_warmup_steps': 7500, 'lr_power': 0.3, 'lr_end': 1e-07, 'set_grads_to_none': False}
And this augmnetations:
from torchvision.transforms import v2
from torchvision.transforms.autoaugment import AutoAugmentPolicy
transforms_train = v2.Compose([
v2.ToImage(),
v2.RandomHorizontalFlip(p=0.5),
v2.RandomResizedCrop(224, antialias=True),
v2.RandomChoice([v2.AutoAugment(AutoAugmentPolicy.CIFAR10),
v2.AutoAugment(AutoAugmentPolicy.IMAGENET)
]),
v2.ToDtype(torch.float32, scale=True),
v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
On Imagenet1k Validation:
Accuracy, top1 | Accuracy, top5 | AUC (ovo) | AUC (ovr) |
---|---|---|---|
68.5 | 88.46 | 99.61 | 99.61 |
On Imagenet1k Test: Coming soon
First, clone the repository:
git clone https://github.com/IvanDrokin/torch-conv-kan.git
cd torch-conv-kan
pip install -r requirements.txt
Then you can initialize the model and load weights.
import torch
from models import vggkagn_bn
model = vggkagn_bn(3,
1000,
groups=1,
degree=5,
dropout=0.05,
l1_decay=0,
width_scale=2,
affine=True,
norm_layer=nn.BatchNorm2d,
expected_feature_shape=(1, 1),
vgg_type='VGG11v4')
model.from_pretrained('brivangl/vgg_kagn_bn11_v4')
Transforms, used for validation on Imagenet1k:
from torchvision.transforms import v2
transforms_val = v2.Compose([
v2.ToImage(),
v2.Resize(256, antialias=True),
v2.CenterCrop(224),
v2.ToDtype(torch.float32, scale=True),
v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])