-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
4,584 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
configs/classification/_base_/datasets/imagenet/edgenext_sz256_8xbs128.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Refers to `_RAND_INCREASING_TRANSFORMS` in pytorch-image-models | ||
rand_increasing_policies = [ | ||
dict(type='AutoContrast'), | ||
dict(type='Equalize'), | ||
dict(type='Invert'), | ||
dict(type='Rotate', magnitude_key='angle', magnitude_range=(0, 30)), | ||
dict(type='Posterize', magnitude_key='bits', magnitude_range=(4, 0)), | ||
dict(type='Solarize', magnitude_key='thr', magnitude_range=(256, 0)), | ||
dict(type='SolarizeAdd', magnitude_key='magnitude', magnitude_range=(0, 110)), | ||
dict(type='ColorTransform', magnitude_key='magnitude', magnitude_range=(0, 0.9)), | ||
dict(type='Contrast', magnitude_key='magnitude', magnitude_range=(0, 0.9)), | ||
dict(type='Brightness', magnitude_key='magnitude', magnitude_range=(0, 0.9)), | ||
dict(type='Sharpness', magnitude_key='magnitude', magnitude_range=(0, 0.9)), | ||
dict(type='Shear', | ||
magnitude_key='magnitude', magnitude_range=(0, 0.3), direction='horizontal'), | ||
dict(type='Shear', | ||
magnitude_key='magnitude', magnitude_range=(0, 0.3), direction='vertical'), | ||
dict(type='Translate', | ||
magnitude_key='magnitude', magnitude_range=(0, 0.45), direction='horizontal'), | ||
dict(type='Translate', | ||
magnitude_key='magnitude', magnitude_range=(0, 0.45), direction='vertical'), | ||
] | ||
|
||
# dataset settings | ||
data_source_cfg = dict(type='ImageNet') | ||
# ImageNet dataset | ||
data_train_list = 'data/meta/ImageNet/train_labeled_full.txt' | ||
data_train_root = 'data/ImageNet/train' | ||
data_test_list = 'data/meta/ImageNet/val_labeled.txt' | ||
data_test_root = 'data/ImageNet/val/' | ||
|
||
dataset_type = 'ClassificationDataset' | ||
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) | ||
train_pipeline = [ | ||
dict(type='RandomResizedCrop', size=256, interpolation=3), # bicubic | ||
dict(type='RandomHorizontalFlip'), | ||
dict(type='RandAugment', | ||
policies=rand_increasing_policies, | ||
num_policies=2, total_level=10, | ||
magnitude_level=9, magnitude_std=0.5, | ||
hparams=dict( | ||
pad_val=[104, 116, 124], interpolation='bicubic')), | ||
dict(type='ColorJitter', brightness=0.4, contrast=0.4, saturation=0.4), | ||
dict( | ||
type='RandomErasing_numpy', # before ToTensor and Normalize | ||
erase_prob=0.25, | ||
mode='rand', min_area_ratio=0.02, max_area_ratio=1 / 3, | ||
fill_color=[104, 116, 124], fill_std=[58, 57, 57]), # RGB | ||
] | ||
test_pipeline = [ | ||
dict(type='Resize', size=292, interpolation=3), # 0.875 | ||
dict(type='CenterCrop', size=256), | ||
dict(type='ToTensor'), | ||
dict(type='Normalize', **img_norm_cfg), | ||
] | ||
# prefetch | ||
prefetch = True | ||
if not prefetch: | ||
train_pipeline.extend([dict(type='ToTensor'), dict(type='Normalize', **img_norm_cfg)]) | ||
|
||
data = dict( | ||
imgs_per_gpu=128, | ||
workers_per_gpu=8, | ||
train=dict( | ||
type=dataset_type, | ||
data_source=dict( | ||
list_file=data_train_list, root=data_train_root, | ||
**data_source_cfg), | ||
pipeline=train_pipeline, | ||
prefetch=prefetch, | ||
), | ||
val=dict( | ||
type=dataset_type, | ||
data_source=dict( | ||
list_file=data_test_list, root=data_test_root, **data_source_cfg), | ||
pipeline=test_pipeline, | ||
prefetch=False, | ||
)) | ||
|
||
# validation hook | ||
evaluation = dict( | ||
initial=False, | ||
interval=1, | ||
imgs_per_gpu=128, | ||
workers_per_gpu=4, | ||
eval_param=dict(topk=(1, 5))) | ||
|
||
# checkpoint | ||
checkpoint_config = dict(interval=1, max_keep_ckpts=1) |
25 changes: 25 additions & 0 deletions
25
configs/classification/_base_/models/edgenext/edgenext-base.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='EdgeNeXt', | ||
arch='base', | ||
out_indices=(3, ), | ||
drop_path_rate=0.1, | ||
gap_before_final_norm=True, | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=584, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Conv2d', 'Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer='BatchNorm', val=1., bias=0.) | ||
], | ||
) |
25 changes: 25 additions & 0 deletions
25
configs/classification/_base_/models/edgenext/edgenext-small.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='EdgeNeXt', | ||
arch='small', | ||
out_indices=(3, ), | ||
drop_path_rate=0.1, | ||
gap_before_final_norm=True, | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=304, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Conv2d', 'Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer='BatchNorm', val=1., bias=0.) | ||
], | ||
) |
25 changes: 25 additions & 0 deletions
25
configs/classification/_base_/models/edgenext/edgenext-xsmall.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='EdgeNeXt', | ||
arch='xsmall', | ||
out_indices=(3, ), | ||
drop_path_rate=0.1, | ||
gap_before_final_norm=True, | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=192, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Conv2d', 'Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer='BatchNorm', val=1., bias=0.) | ||
], | ||
) |
25 changes: 25 additions & 0 deletions
25
configs/classification/_base_/models/edgenext/edgenext-xxsmall.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='EdgeNeXt', | ||
arch='xxsmall', | ||
out_indices=(3, ), | ||
drop_path_rate=0.1, | ||
gap_before_final_norm=True, | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=168, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Conv2d', 'Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer='BatchNorm', val=1., bias=0.) | ||
], | ||
) |
24 changes: 24 additions & 0 deletions
24
configs/classification/_base_/models/efficientformer/efficientformer_l1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='EfficientFormer', | ||
arch='l1', | ||
drop_path_rate=0., | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=448, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Conv2d', 'Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer=['BatchNorm', 'LayerNorm'], val=1., bias=0.), | ||
dict(type='Constant', layer=['LayerScale'], val=1e-5), | ||
], | ||
) |
24 changes: 24 additions & 0 deletions
24
configs/classification/_base_/models/efficientformer/efficientformer_l3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='EfficientFormer', | ||
arch='l3', | ||
drop_path_rate=0., | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=512, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Conv2d', 'Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer=['BatchNorm', 'LayerNorm'], val=1., bias=0.), | ||
dict(type='Constant', layer=['LayerScale'], val=1e-5), | ||
], | ||
) |
24 changes: 24 additions & 0 deletions
24
configs/classification/_base_/models/efficientformer/efficientformer_l7.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='EfficientFormer', | ||
arch='l7', | ||
drop_path_rate=0., | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=768, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Conv2d', 'Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer=['BatchNorm', 'LayerNorm'], val=1., bias=0.), | ||
dict(type='Constant', layer=['LayerScale'], val=1e-5), | ||
], | ||
) |
24 changes: 24 additions & 0 deletions
24
configs/classification/_base_/models/hornet/hornet_base.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='HorNet', | ||
arch='base', | ||
drop_path_rate=0.5, | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=1024, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
dict(type='Constant', layer=['LayerScale'], val=1e-6), | ||
], | ||
) |
24 changes: 24 additions & 0 deletions
24
configs/classification/_base_/models/hornet/hornet_large.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# model settings | ||
model = dict( | ||
type='MixUpClassification', | ||
pretrained=None, | ||
alpha=[0.8, 1.0,], | ||
mix_mode=["mixup", "cutmix",], | ||
mix_args=dict(), | ||
backbone=dict( | ||
type='HorNet', | ||
arch='large', | ||
drop_path_rate=0.2, | ||
), | ||
head=dict( | ||
type='ClsMixupHead', # mixup CE + label smooth | ||
loss=dict(type='LabelSmoothLoss', | ||
label_smooth_val=0.1, num_classes=1000, mode='original', loss_weight=1.0), | ||
with_avg_pool=True, | ||
in_channels=1536, num_classes=1000), | ||
init_cfg=[ | ||
dict(type='TruncNormal', layer=['Linear'], std=0.02, bias=0.), | ||
dict(type='Constant', layer='LayerNorm', val=1., bias=0.), | ||
dict(type='Constant', layer=['LayerScale'], val=1e-6), | ||
], | ||
) |
Oops, something went wrong.