Config System¶
We use python files as our config system. You can find all the provided configs under $MMEditing/configs
.
Config Name Style¶
We follow the below style to name config files. Contributors are advised to follow the same style.
{model}_[model setting]_{backbone}_[refiner]_[norm setting]_[misc]_[gpu x batch_per_gpu]_{schedule}_{dataset}
{xxx}
is required field and [yyy]
is optional.
{model}
: model type likesrcnn
,dim
, etc.[model setting]
: specific setting for some model, likeresolution
for input images,stage name
for training, etc.{backbone}
: backbone type liker50
(ResNet-50),x101
(ResNeXt-101).[refiner]
: refiner type likepln
(Plain Refiner).[norm_setting]
:bn
(Batch Normalization) is used unless specified, other norm layer type could begn
(Group Normalization),syncbn
(Synchronized Batch Normalization).[misc]
: miscellaneous setting/plugins of model, e.g.dconv
,gcb
,attention
,albu
,mstrain
.[gpu x batch_per_gpu]
: GPUs and samples per GPU,8x2
is used by default.{schedule}
: training schedule,20k
,100k
, etc.20k
means 20,000 iterations.100k
means 100,000 iterations.{dataset}
: dataset likeplaces
(for inpainting),comp1k
(for matting),div2k
(for restoration) andpaired
(for generation).
Config File Structure¶
Please refer to the corresponding page for config file structure for different tasks.
FAQ¶
Use intermediate variables in configs¶
Some intermediate variables are used in the configs files, like train_pipeline
/test_pipeline
in datasets.
For example, we would like to first define the train_pipeline
/test_pipeline
and pass them into data
. Thus, train_pipeline
/test_pipeline
are intermediate variable.
...
train_dataset_type = 'SRAnnotationDataset'
val_dataset_type = 'SRFolderDataset'
train_pipeline = [
dict(
type='LoadImageFromFile',
io_backend='disk',
key='lq',
flag='unchanged'),
...
dict(type='Collect', keys=['lq', 'gt'], meta_keys=['lq_path', 'gt_path']),
dict(type='ImageToTensor', keys=['lq', 'gt'])
]
test_pipeline = [
dict(
type='LoadImageFromFile',
io_backend='disk',
key='lq',
flag='unchanged'),
...
dict(type='Collect', keys=['lq', 'gt'], meta_keys=['lq_path', 'lq_path']),
dict(type='ImageToTensor', keys=['lq', 'gt'])
]
data = dict(
# train
samples_per_gpu=16,
workers_per_gpu=6,
drop_last=True,
train=dict(
type='RepeatDataset',
times=1000,
dataset=dict(
type=train_dataset_type,
lq_folder='data/DIV2K/DIV2K_train_LR_bicubic/X2_sub',
gt_folder='data/DIV2K/DIV2K_train_HR_sub',
ann_file='data/DIV2K/meta_info_DIV2K800sub_GT.txt',
pipeline=train_pipeline,
scale=scale)),
# val
val_samples_per_gpu=1,
val_workers_per_gpu=1,
val=dict(
type=val_dataset_type,
lq_folder='./data/val_set5/Set5_bicLRx2',
gt_folder='./data/val_set5/Set5_mod12',
pipeline=test_pipeline,
scale=scale,
filename_tmpl='{}'),