2021-04-02 23:54:57 +08:00
|
|
|
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
|
|
|
|
|
|
|
gt_label_convertor = dict(
|
|
|
|
type='SegConvertor', dict_type='DICT36', with_unknown=True, lower=True)
|
|
|
|
|
|
|
|
train_pipeline = [
|
|
|
|
dict(type='LoadImageFromFile'),
|
|
|
|
dict(
|
|
|
|
type='RandomPaddingOCR',
|
|
|
|
max_ratio=[0.15, 0.2, 0.15, 0.2],
|
|
|
|
box_type='char_quads'),
|
|
|
|
dict(type='OpencvToPil'),
|
|
|
|
dict(
|
|
|
|
type='RandomRotateImageBox',
|
|
|
|
min_angle=-17,
|
|
|
|
max_angle=17,
|
|
|
|
box_type='char_quads'),
|
|
|
|
dict(type='PilToOpencv'),
|
|
|
|
dict(
|
|
|
|
type='ResizeOCR',
|
|
|
|
height=64,
|
|
|
|
min_width=64,
|
|
|
|
max_width=512,
|
|
|
|
keep_aspect_ratio=True),
|
|
|
|
dict(
|
|
|
|
type='OCRSegTargets',
|
|
|
|
label_convertor=gt_label_convertor,
|
|
|
|
box_type='char_quads'),
|
2021-11-25 16:27:45 +08:00
|
|
|
dict(type='RandomRotateTextDet', rotate_ratio=0.5, max_angle=15),
|
2021-04-02 23:54:57 +08:00
|
|
|
dict(type='ColorJitter', brightness=0.4, contrast=0.4, saturation=0.4),
|
|
|
|
dict(type='ToTensorOCR'),
|
|
|
|
dict(type='FancyPCA'),
|
|
|
|
dict(type='NormalizeOCR', **img_norm_cfg),
|
|
|
|
dict(
|
|
|
|
type='CustomFormatBundle',
|
|
|
|
keys=['gt_kernels'],
|
|
|
|
visualize=dict(flag=False, boundary_key=None),
|
|
|
|
call_super=False),
|
|
|
|
dict(
|
|
|
|
type='Collect',
|
|
|
|
keys=['img', 'gt_kernels'],
|
2021-11-25 16:27:45 +08:00
|
|
|
meta_keys=['filename', 'ori_shape', 'resize_shape'])
|
2021-04-02 23:54:57 +08:00
|
|
|
]
|
|
|
|
|
2021-08-03 16:52:58 +08:00
|
|
|
test_img_norm_cfg = dict(
|
|
|
|
mean=[x * 255 for x in img_norm_cfg['mean']],
|
|
|
|
std=[x * 255 for x in img_norm_cfg['std']])
|
2021-11-25 16:27:45 +08:00
|
|
|
|
2021-04-02 23:54:57 +08:00
|
|
|
test_pipeline = [
|
|
|
|
dict(type='LoadImageFromFile'),
|
|
|
|
dict(
|
|
|
|
type='ResizeOCR',
|
|
|
|
height=64,
|
|
|
|
min_width=64,
|
|
|
|
max_width=None,
|
|
|
|
keep_aspect_ratio=True),
|
2021-08-03 16:52:58 +08:00
|
|
|
dict(type='Normalize', **test_img_norm_cfg),
|
|
|
|
dict(type='DefaultFormatBundle'),
|
2021-04-02 23:54:57 +08:00
|
|
|
dict(
|
|
|
|
type='Collect',
|
|
|
|
keys=['img'],
|
2022-01-26 21:02:31 +08:00
|
|
|
meta_keys=[
|
|
|
|
'filename', 'resize_shape', 'img_norm_cfg', 'ori_filename',
|
|
|
|
'img_shape', 'ori_shape'
|
|
|
|
])
|
2021-04-02 23:54:57 +08:00
|
|
|
]
|