62 lines
1.9 KiB
Python
62 lines
1.9 KiB
Python
_base_ = [
|
|
'../_base_/models/van/van_large.py',
|
|
'../_base_/datasets/imagenet_bs64_swin_224.py',
|
|
'../_base_/schedules/imagenet_bs1024_adamw_swin.py',
|
|
'../_base_/default_runtime.py'
|
|
]
|
|
|
|
# Note that the mean and variance used here are different from other configs
|
|
img_norm_cfg = dict(
|
|
mean=[127.5, 127.5, 127.5], std=[127.5, 127.5, 127.5], to_rgb=True)
|
|
train_pipeline = [
|
|
dict(type='LoadImageFromFile'),
|
|
dict(
|
|
type='RandomResizedCrop',
|
|
size=224,
|
|
backend='pillow',
|
|
interpolation='bicubic'),
|
|
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
|
|
dict(
|
|
type='RandAugment',
|
|
policies={{_base_.rand_increasing_policies}},
|
|
num_policies=2,
|
|
total_level=10,
|
|
magnitude_level=9,
|
|
magnitude_std=0.5,
|
|
hparams=dict(
|
|
pad_val=[round(x) for x in img_norm_cfg['mean'][::-1]],
|
|
interpolation='bicubic')),
|
|
dict(type='ColorJitter', brightness=0.4, contrast=0.4, saturation=0.4),
|
|
dict(
|
|
type='RandomErasing',
|
|
erase_prob=0.25,
|
|
mode='rand',
|
|
min_area_ratio=0.02,
|
|
max_area_ratio=1 / 3,
|
|
fill_color=img_norm_cfg['mean'][::-1],
|
|
fill_std=img_norm_cfg['std'][::-1]),
|
|
dict(type='Normalize', **img_norm_cfg),
|
|
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='Resize',
|
|
size=(248, -1),
|
|
backend='pillow',
|
|
interpolation='bicubic'),
|
|
dict(type='CenterCrop', crop_size=224),
|
|
dict(type='Normalize', **img_norm_cfg),
|
|
dict(type='ImageToTensor', keys=['img']),
|
|
dict(type='Collect', keys=['img'])
|
|
]
|
|
|
|
data = dict(
|
|
samples_per_gpu=128,
|
|
train=dict(pipeline=train_pipeline),
|
|
val=dict(pipeline=test_pipeline),
|
|
test=dict(pipeline=test_pipeline))
|