[Feature] Add ResNeSt configs (#332)

* add configs for resnest training

* fix format
pull/341/head^2
LXXXXR 2021-07-14 15:58:19 +08:00 committed by GitHub
parent 76c5d34dcc
commit 24e58ba26d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 756 additions and 8 deletions

View File

@ -13,6 +13,12 @@ model = dict(
type='LinearClsHead',
num_classes=1000,
in_channels=2048,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
loss=dict(
type='LabelSmoothLoss',
label_smooth_val=0.1,
num_classes=1000,
reduction='mean',
loss_weight=1.0),
topk=(1, 5),
))
cal_acc=False))
train_cfg = dict(mixup=dict(alpha=0.2, num_classes=1000))

View File

@ -13,6 +13,12 @@ model = dict(
type='LinearClsHead',
num_classes=1000,
in_channels=2048,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
loss=dict(
type='LabelSmoothLoss',
label_smooth_val=0.1,
num_classes=1000,
reduction='mean',
loss_weight=1.0),
topk=(1, 5),
))
cal_acc=False))
train_cfg = dict(mixup=dict(alpha=0.2, num_classes=1000))

View File

@ -13,6 +13,12 @@ model = dict(
type='LinearClsHead',
num_classes=1000,
in_channels=2048,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
loss=dict(
type='LabelSmoothLoss',
label_smooth_val=0.1,
num_classes=1000,
reduction='mean',
loss_weight=1.0),
topk=(1, 5),
))
cal_acc=False))
train_cfg = dict(mixup=dict(alpha=0.2, num_classes=1000))

View File

@ -12,6 +12,12 @@ model = dict(
type='LinearClsHead',
num_classes=1000,
in_channels=2048,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
loss=dict(
type='LabelSmoothLoss',
label_smooth_val=0.1,
num_classes=1000,
reduction='mean',
loss_weight=1.0),
topk=(1, 5),
))
cal_acc=False))
train_cfg = dict(mixup=dict(alpha=0.2, num_classes=1000))

View File

@ -0,0 +1,181 @@
_base_ = ['../_base_/models/resnest101.py', '../_base_/default_runtime.py']
# dataset settings
dataset_type = 'ImageNet'
img_lighting_cfg = dict(
eigval=[55.4625, 4.7940, 1.1475],
eigvec=[[-0.5675, 0.7192, 0.4009], [-0.5808, -0.0045, -0.8140],
[-0.5836, -0.6948, 0.4203]],
alphastd=0.1,
to_rgb=True)
policies = [
dict(type='AutoContrast', prob=0.5),
dict(type='Equalize', prob=0.5),
dict(type='Invert', prob=0.5),
dict(
type='Rotate',
magnitude_key='angle',
magnitude_range=(0, 30),
pad_val=0,
prob=0.5,
random_negative_prob=0.5),
dict(
type='Posterize',
magnitude_key='bits',
magnitude_range=(0, 4),
prob=0.5),
dict(
type='Solarize',
magnitude_key='thr',
magnitude_range=(0, 256),
prob=0.5),
dict(
type='SolarizeAdd',
magnitude_key='magnitude',
magnitude_range=(0, 110),
thr=128,
prob=0.5),
dict(
type='ColorTransform',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Contrast',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Brightness',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Sharpness',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Shear',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='horizontal',
random_negative_prob=0.5),
dict(
type='Shear',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='vertical',
random_negative_prob=0.5),
dict(
type='Cutout',
magnitude_key='shape',
magnitude_range=(1, 41),
pad_val=0,
prob=0.5),
dict(
type='Translate',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='horizontal',
random_negative_prob=0.5,
interpolation='bicubic'),
dict(
type='Translate',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='vertical',
random_negative_prob=0.5,
interpolation='bicubic')
]
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='RandAugment',
policies=policies,
num_policies=2,
magnitude_level=12),
dict(
type='RandomResizedCrop',
size=256,
efficientnet_style=True,
interpolation='bicubic',
backend='pillow'),
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
dict(type='ColorJitter', brightness=0.4, contrast=0.4, saturation=0.4),
dict(type='Lighting', **img_lighting_cfg),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=False),
dict(type='ImageToTensor', keys=['img']),
dict(type='ToTensor', keys=['gt_label']),
dict(type='Collect', keys=['img', 'gt_label'])
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='CenterCrop',
crop_size=256,
efficientnet_style=True,
interpolation='bicubic',
backend='pillow'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img'])
]
data = dict(
samples_per_gpu=64,
workers_per_gpu=2,
train=dict(
type=dataset_type,
data_prefix='data/imagenet/train',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_prefix='data/imagenet/val',
ann_file='data/imagenet/meta/val.txt',
pipeline=test_pipeline),
test=dict(
# replace `data/val` with `data/test` for standard test
type=dataset_type,
data_prefix='data/imagenet/val',
ann_file='data/imagenet/meta/val.txt',
pipeline=test_pipeline))
evaluation = dict(interval=1, metric='accuracy')
# optimizer
optimizer = dict(
type='SGD',
lr=0.8,
momentum=0.9,
weight_decay=1e-4,
paramwise_cfg=dict(bias_decay_mult=0., norm_decay_mult=0.))
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='CosineAnnealing',
min_lr=0,
warmup='linear',
warmup_iters=5,
warmup_ratio=1e-6,
warmup_by_epoch=True)
runner = dict(type='EpochBasedRunner', max_epochs=270)

View File

@ -0,0 +1,181 @@
_base_ = ['../_base_/models/resnest200.py', '../_base_/default_runtime.py']
# dataset settings
dataset_type = 'ImageNet'
img_lighting_cfg = dict(
eigval=[55.4625, 4.7940, 1.1475],
eigvec=[[-0.5675, 0.7192, 0.4009], [-0.5808, -0.0045, -0.8140],
[-0.5836, -0.6948, 0.4203]],
alphastd=0.1,
to_rgb=True)
policies = [
dict(type='AutoContrast', prob=0.5),
dict(type='Equalize', prob=0.5),
dict(type='Invert', prob=0.5),
dict(
type='Rotate',
magnitude_key='angle',
magnitude_range=(0, 30),
pad_val=0,
prob=0.5,
random_negative_prob=0.5),
dict(
type='Posterize',
magnitude_key='bits',
magnitude_range=(0, 4),
prob=0.5),
dict(
type='Solarize',
magnitude_key='thr',
magnitude_range=(0, 256),
prob=0.5),
dict(
type='SolarizeAdd',
magnitude_key='magnitude',
magnitude_range=(0, 110),
thr=128,
prob=0.5),
dict(
type='ColorTransform',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Contrast',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Brightness',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Sharpness',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Shear',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='horizontal',
random_negative_prob=0.5),
dict(
type='Shear',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='vertical',
random_negative_prob=0.5),
dict(
type='Cutout',
magnitude_key='shape',
magnitude_range=(1, 41),
pad_val=0,
prob=0.5),
dict(
type='Translate',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='horizontal',
random_negative_prob=0.5,
interpolation='bicubic'),
dict(
type='Translate',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='vertical',
random_negative_prob=0.5,
interpolation='bicubic')
]
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='RandAugment',
policies=policies,
num_policies=2,
magnitude_level=12),
dict(
type='RandomResizedCrop',
size=320,
efficientnet_style=True,
interpolation='bicubic',
backend='pillow'),
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
dict(type='ColorJitter', brightness=0.4, contrast=0.4, saturation=0.4),
dict(type='Lighting', **img_lighting_cfg),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=False),
dict(type='ImageToTensor', keys=['img']),
dict(type='ToTensor', keys=['gt_label']),
dict(type='Collect', keys=['img', 'gt_label'])
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='CenterCrop',
crop_size=320,
efficientnet_style=True,
interpolation='bicubic',
backend='pillow'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img'])
]
data = dict(
samples_per_gpu=32,
workers_per_gpu=2,
train=dict(
type=dataset_type,
data_prefix='data/imagenet/train',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_prefix='data/imagenet/val',
ann_file='data/imagenet/meta/val.txt',
pipeline=test_pipeline),
test=dict(
# replace `data/val` with `data/test` for standard test
type=dataset_type,
data_prefix='data/imagenet/val',
ann_file='data/imagenet/meta/val.txt',
pipeline=test_pipeline))
evaluation = dict(interval=1, metric='accuracy')
# optimizer
optimizer = dict(
type='SGD',
lr=0.8,
momentum=0.9,
weight_decay=1e-4,
paramwise_cfg=dict(bias_decay_mult=0., norm_decay_mult=0.))
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='CosineAnnealing',
min_lr=0,
warmup='linear',
warmup_iters=5,
warmup_ratio=1e-6,
warmup_by_epoch=True)
runner = dict(type='EpochBasedRunner', max_epochs=270)

View File

@ -0,0 +1,181 @@
_base_ = ['../_base_/models/resnest269.py', '../_base_/default_runtime.py']
# dataset settings
dataset_type = 'ImageNet'
img_lighting_cfg = dict(
eigval=[55.4625, 4.7940, 1.1475],
eigvec=[[-0.5675, 0.7192, 0.4009], [-0.5808, -0.0045, -0.8140],
[-0.5836, -0.6948, 0.4203]],
alphastd=0.1,
to_rgb=True)
policies = [
dict(type='AutoContrast', prob=0.5),
dict(type='Equalize', prob=0.5),
dict(type='Invert', prob=0.5),
dict(
type='Rotate',
magnitude_key='angle',
magnitude_range=(0, 30),
pad_val=0,
prob=0.5,
random_negative_prob=0.5),
dict(
type='Posterize',
magnitude_key='bits',
magnitude_range=(0, 4),
prob=0.5),
dict(
type='Solarize',
magnitude_key='thr',
magnitude_range=(0, 256),
prob=0.5),
dict(
type='SolarizeAdd',
magnitude_key='magnitude',
magnitude_range=(0, 110),
thr=128,
prob=0.5),
dict(
type='ColorTransform',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Contrast',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Brightness',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Sharpness',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Shear',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='horizontal',
random_negative_prob=0.5),
dict(
type='Shear',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='vertical',
random_negative_prob=0.5),
dict(
type='Cutout',
magnitude_key='shape',
magnitude_range=(1, 41),
pad_val=0,
prob=0.5),
dict(
type='Translate',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='horizontal',
random_negative_prob=0.5,
interpolation='bicubic'),
dict(
type='Translate',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='vertical',
random_negative_prob=0.5,
interpolation='bicubic')
]
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='RandAugment',
policies=policies,
num_policies=2,
magnitude_level=12),
dict(
type='RandomResizedCrop',
size=416,
efficientnet_style=True,
interpolation='bicubic',
backend='pillow'),
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
dict(type='ColorJitter', brightness=0.4, contrast=0.4, saturation=0.4),
dict(type='Lighting', **img_lighting_cfg),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=False),
dict(type='ImageToTensor', keys=['img']),
dict(type='ToTensor', keys=['gt_label']),
dict(type='Collect', keys=['img', 'gt_label'])
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='CenterCrop',
crop_size=416,
efficientnet_style=True,
interpolation='bicubic',
backend='pillow'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img'])
]
data = dict(
samples_per_gpu=32,
workers_per_gpu=2,
train=dict(
type=dataset_type,
data_prefix='data/imagenet/train',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_prefix='data/imagenet/val',
ann_file='data/imagenet/meta/val.txt',
pipeline=test_pipeline),
test=dict(
# replace `data/val` with `data/test` for standard test
type=dataset_type,
data_prefix='data/imagenet/val',
ann_file='data/imagenet/meta/val.txt',
pipeline=test_pipeline))
evaluation = dict(interval=1, metric='accuracy')
# optimizer
optimizer = dict(
type='SGD',
lr=0.8,
momentum=0.9,
weight_decay=1e-4,
paramwise_cfg=dict(bias_decay_mult=0., norm_decay_mult=0.))
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='CosineAnnealing',
min_lr=0,
warmup='linear',
warmup_iters=5,
warmup_ratio=1e-6,
warmup_by_epoch=True)
runner = dict(type='EpochBasedRunner', max_epochs=270)

View File

@ -0,0 +1,181 @@
_base_ = ['../_base_/models/resnest50.py', '../_base_/default_runtime.py']
# dataset settings
dataset_type = 'ImageNet'
img_lighting_cfg = dict(
eigval=[55.4625, 4.7940, 1.1475],
eigvec=[[-0.5675, 0.7192, 0.4009], [-0.5808, -0.0045, -0.8140],
[-0.5836, -0.6948, 0.4203]],
alphastd=0.1,
to_rgb=True)
policies = [
dict(type='AutoContrast', prob=0.5),
dict(type='Equalize', prob=0.5),
dict(type='Invert', prob=0.5),
dict(
type='Rotate',
magnitude_key='angle',
magnitude_range=(0, 30),
pad_val=0,
prob=0.5,
random_negative_prob=0.5),
dict(
type='Posterize',
magnitude_key='bits',
magnitude_range=(0, 4),
prob=0.5),
dict(
type='Solarize',
magnitude_key='thr',
magnitude_range=(0, 256),
prob=0.5),
dict(
type='SolarizeAdd',
magnitude_key='magnitude',
magnitude_range=(0, 110),
thr=128,
prob=0.5),
dict(
type='ColorTransform',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Contrast',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Brightness',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Sharpness',
magnitude_key='magnitude',
magnitude_range=(-0.9, 0.9),
prob=0.5,
random_negative_prob=0.),
dict(
type='Shear',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='horizontal',
random_negative_prob=0.5),
dict(
type='Shear',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='vertical',
random_negative_prob=0.5),
dict(
type='Cutout',
magnitude_key='shape',
magnitude_range=(1, 41),
pad_val=0,
prob=0.5),
dict(
type='Translate',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='horizontal',
random_negative_prob=0.5,
interpolation='bicubic'),
dict(
type='Translate',
magnitude_key='magnitude',
magnitude_range=(0, 0.3),
pad_val=0,
prob=0.5,
direction='vertical',
random_negative_prob=0.5,
interpolation='bicubic')
]
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='RandAugment',
policies=policies,
num_policies=2,
magnitude_level=12),
dict(
type='RandomResizedCrop',
size=224,
efficientnet_style=True,
interpolation='bicubic',
backend='pillow'),
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
dict(type='ColorJitter', brightness=0.4, contrast=0.4, saturation=0.4),
dict(type='Lighting', **img_lighting_cfg),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=False),
dict(type='ImageToTensor', keys=['img']),
dict(type='ToTensor', keys=['gt_label']),
dict(type='Collect', keys=['img', 'gt_label'])
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='CenterCrop',
crop_size=224,
efficientnet_style=True,
interpolation='bicubic',
backend='pillow'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img'])
]
data = dict(
samples_per_gpu=64,
workers_per_gpu=2,
train=dict(
type=dataset_type,
data_prefix='data/imagenet/train',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_prefix='data/imagenet/val',
ann_file='data/imagenet/meta/val.txt',
pipeline=test_pipeline),
test=dict(
# replace `data/val` with `data/test` for standard test
type=dataset_type,
data_prefix='data/imagenet/val',
ann_file='data/imagenet/meta/val.txt',
pipeline=test_pipeline))
evaluation = dict(interval=1, metric='accuracy')
# optimizer
optimizer = dict(
type='SGD',
lr=0.8,
momentum=0.9,
weight_decay=1e-4,
paramwise_cfg=dict(bias_decay_mult=0., norm_decay_mult=0.))
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='CosineAnnealing',
min_lr=0,
warmup='linear',
warmup_iters=5,
warmup_ratio=1e-6,
warmup_by_epoch=True)
runner = dict(type='EpochBasedRunner', max_epochs=270)