2021-01-25 18:10:14 +08:00
|
|
|
# dataset settings
|
|
|
|
dataset_type = 'VOC'
|
2022-08-29 11:10:05 +08:00
|
|
|
data_preprocessor = dict(
|
2022-10-17 17:08:18 +08:00
|
|
|
num_classes=20,
|
2022-06-01 14:11:53 +08:00
|
|
|
# RGB format normalization parameters
|
|
|
|
mean=[123.675, 116.28, 103.53],
|
|
|
|
std=[58.395, 57.12, 57.375],
|
|
|
|
# convert image from BGR to RGB
|
|
|
|
to_rgb=True,
|
2022-10-17 17:08:18 +08:00
|
|
|
# generate onehot-format labels for multi-label classification.
|
|
|
|
to_onehot=True,
|
2022-06-01 14:11:53 +08:00
|
|
|
)
|
|
|
|
|
2021-01-25 18:10:14 +08:00
|
|
|
train_pipeline = [
|
|
|
|
dict(type='LoadImageFromFile'),
|
2022-06-01 14:11:53 +08:00
|
|
|
dict(type='RandomResizedCrop', scale=224),
|
|
|
|
dict(type='RandomFlip', prob=0.5, direction='horizontal'),
|
2023-03-03 15:01:11 +08:00
|
|
|
dict(type='PackInputs'),
|
2021-01-25 18:10:14 +08:00
|
|
|
]
|
2022-06-01 14:11:53 +08:00
|
|
|
|
2021-01-25 18:10:14 +08:00
|
|
|
test_pipeline = [
|
|
|
|
dict(type='LoadImageFromFile'),
|
2022-06-01 14:11:53 +08:00
|
|
|
dict(type='ResizeEdge', scale=256, edge='short'),
|
2021-01-25 18:10:14 +08:00
|
|
|
dict(type='CenterCrop', crop_size=224),
|
2023-06-02 11:03:18 +08:00
|
|
|
dict(
|
|
|
|
type='PackInputs',
|
|
|
|
# `gt_label_difficult` is needed for VOC evaluation
|
|
|
|
meta_keys=('sample_idx', 'img_path', 'ori_shape', 'img_shape',
|
|
|
|
'scale_factor', 'flip', 'flip_direction',
|
|
|
|
'gt_label_difficult')),
|
2021-01-25 18:10:14 +08:00
|
|
|
]
|
2022-06-01 14:11:53 +08:00
|
|
|
|
|
|
|
train_dataloader = dict(
|
|
|
|
batch_size=16,
|
|
|
|
num_workers=5,
|
|
|
|
dataset=dict(
|
|
|
|
type=dataset_type,
|
2023-06-02 11:03:18 +08:00
|
|
|
data_root='data/VOC2007',
|
|
|
|
split='trainval',
|
2022-06-01 14:11:53 +08:00
|
|
|
pipeline=train_pipeline),
|
|
|
|
sampler=dict(type='DefaultSampler', shuffle=True),
|
|
|
|
)
|
|
|
|
|
|
|
|
val_dataloader = dict(
|
|
|
|
batch_size=16,
|
|
|
|
num_workers=5,
|
|
|
|
dataset=dict(
|
|
|
|
type=dataset_type,
|
2023-06-02 11:03:18 +08:00
|
|
|
data_root='data/VOC2007',
|
|
|
|
split='test',
|
2022-06-01 14:11:53 +08:00
|
|
|
pipeline=test_pipeline),
|
|
|
|
sampler=dict(type='DefaultSampler', shuffle=False),
|
|
|
|
)
|
|
|
|
|
2023-06-02 11:03:18 +08:00
|
|
|
test_dataloader = val_dataloader
|
2022-06-23 15:18:18 +08:00
|
|
|
|
|
|
|
# calculate precision_recall_f1 and mAP
|
2022-11-21 10:39:16 +08:00
|
|
|
val_evaluator = [
|
|
|
|
dict(type='VOCMultiLabelMetric'),
|
|
|
|
dict(type='VOCMultiLabelMetric', average='micro'),
|
|
|
|
dict(type='VOCAveragePrecision')
|
|
|
|
]
|
2022-06-23 15:18:18 +08:00
|
|
|
|
|
|
|
test_dataloader = val_dataloader
|
2022-06-01 14:11:53 +08:00
|
|
|
test_evaluator = val_evaluator
|