mirror of https://github.com/open-mmlab/mmocr.git
[TODO] Remove det&recog pipelines
parent
3734527d38
commit
2b3a4fe6b5
|
@ -1,88 +0,0 @@
|
|||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
|
||||
train_pipeline_r18 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(type='ColorJitter', brightness=32.0 / 255, saturation=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(
|
||||
type='ImgAugWrapper',
|
||||
args=[['Fliplr', 0.5],
|
||||
dict(cls='Affine', rotate=[-10, 10]), ['Resize', [0.5, 3.0]]]),
|
||||
dict(type='EastRandomCrop', target_size=(640, 640)),
|
||||
dict(type='DBNetTargets', shrink_ratio=0.4),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=['gt_shrink', 'gt_shrink_mask', 'gt_thr', 'gt_thr_mask'],
|
||||
visualize=dict(flag=False, boundary_key='gt_shrink')),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img', 'gt_shrink', 'gt_shrink_mask', 'gt_thr', 'gt_thr_mask'])
|
||||
]
|
||||
|
||||
test_pipeline_1333_736 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=(1333, 736), # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
||||
|
||||
# for dbnet_r50dcnv2_fpnc
|
||||
img_norm_cfg_r50dcnv2 = dict(
|
||||
mean=[122.67891434, 116.66876762, 104.00698793],
|
||||
std=[58.395, 57.12, 57.375],
|
||||
to_rgb=True)
|
||||
|
||||
train_pipeline_r50dcnv2 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(type='ColorJitter', brightness=32.0 / 255, saturation=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg_r50dcnv2),
|
||||
dict(
|
||||
type='ImgAugWrapper',
|
||||
args=[['Fliplr', 0.5],
|
||||
dict(cls='Affine', rotate=[-10, 10]), ['Resize', [0.5, 3.0]]]),
|
||||
dict(type='EastRandomCrop', target_size=(640, 640)),
|
||||
dict(type='DBNetTargets', shrink_ratio=0.4),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=['gt_shrink', 'gt_shrink_mask', 'gt_thr', 'gt_thr_mask'],
|
||||
visualize=dict(flag=False, boundary_key='gt_shrink')),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img', 'gt_shrink', 'gt_shrink_mask', 'gt_thr', 'gt_thr_mask'])
|
||||
]
|
||||
|
||||
test_pipeline_4068_1024 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=(4068, 1024), # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg_r50dcnv2),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
|
@ -1,61 +0,0 @@
|
|||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(type='ColorJitter', brightness=32.0 / 255, saturation=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='RandomScaling', size=800, scale=(0.75, 2.5)),
|
||||
dict(
|
||||
type='RandomCropFlip', crop_ratio=0.5, iter_num=1, min_area_ratio=0.2),
|
||||
dict(
|
||||
type='RandomCropPolyInstances',
|
||||
instance_key='gt_masks',
|
||||
crop_ratio=0.8,
|
||||
min_side_ratio=0.3),
|
||||
dict(
|
||||
type='RandomRotate',
|
||||
rotate_ratio=0.5,
|
||||
max_angle=60,
|
||||
pad_with_fixed_color=False,
|
||||
use_canvas=True),
|
||||
dict(type='SquareResizePad', target_size=800, pad_ratio=0.6),
|
||||
dict(type='RandomFlip', flip_ratio=0.5, direction='horizontal'),
|
||||
dict(type='DRRGTargets'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=[
|
||||
'gt_text_mask', 'gt_center_region_mask', 'gt_mask',
|
||||
'gt_top_height_map', 'gt_bot_height_map', 'gt_sin_map',
|
||||
'gt_cos_map', 'gt_comp_attribs'
|
||||
],
|
||||
visualize=dict(flag=False, boundary_key='gt_text_mask')),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=[
|
||||
'img', 'gt_text_mask', 'gt_center_region_mask', 'gt_mask',
|
||||
'gt_top_height_map', 'gt_bot_height_map', 'gt_sin_map',
|
||||
'gt_cos_map', 'gt_comp_attribs'
|
||||
])
|
||||
]
|
||||
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=(1024, 640), # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
|
@ -1,120 +0,0 @@
|
|||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
|
||||
# for icdar2015
|
||||
leval_prop_range_icdar2015 = ((0, 0.4), (0.3, 0.7), (0.6, 1.0))
|
||||
train_pipeline_icdar2015 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(
|
||||
type='ColorJitter',
|
||||
brightness=32.0 / 255,
|
||||
saturation=0.5,
|
||||
contrast=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='RandomScaling', size=800, scale=(3. / 4, 5. / 2)),
|
||||
dict(
|
||||
type='RandomCropFlip', crop_ratio=0.5, iter_num=1, min_area_ratio=0.2),
|
||||
dict(
|
||||
type='RandomCropPolyInstances',
|
||||
instance_key='gt_masks',
|
||||
crop_ratio=0.8,
|
||||
min_side_ratio=0.3),
|
||||
dict(
|
||||
type='RandomRotate',
|
||||
rotate_ratio=0.5,
|
||||
max_angle=30,
|
||||
pad_with_fixed_color=False,
|
||||
use_canvas=True),
|
||||
dict(type='SquareResizePad', target_size=800, pad_ratio=0.6),
|
||||
dict(type='RandomFlip', flip_ratio=0.5, direction='horizontal'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='FCENetTargets',
|
||||
fourier_degree=5,
|
||||
level_proportion_range=leval_prop_range_icdar2015),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=['p3_maps', 'p4_maps', 'p5_maps'],
|
||||
visualize=dict(flag=False, boundary_key=None)),
|
||||
dict(type='Collect', keys=['img', 'p3_maps', 'p4_maps', 'p5_maps'])
|
||||
]
|
||||
|
||||
img_scale_icdar2015 = (2260, 2260)
|
||||
test_pipeline_icdar2015 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_icdar2015, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
||||
|
||||
# for ctw1500
|
||||
leval_prop_range_ctw1500 = ((0, 0.25), (0.2, 0.65), (0.55, 1.0))
|
||||
train_pipeline_ctw1500 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(
|
||||
type='ColorJitter',
|
||||
brightness=32.0 / 255,
|
||||
saturation=0.5,
|
||||
contrast=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='RandomScaling', size=800, scale=(3. / 4, 5. / 2)),
|
||||
dict(
|
||||
type='RandomCropFlip', crop_ratio=0.5, iter_num=1, min_area_ratio=0.2),
|
||||
dict(
|
||||
type='RandomCropPolyInstances',
|
||||
instance_key='gt_masks',
|
||||
crop_ratio=0.8,
|
||||
min_side_ratio=0.3),
|
||||
dict(
|
||||
type='RandomRotate',
|
||||
rotate_ratio=0.5,
|
||||
max_angle=30,
|
||||
pad_with_fixed_color=False,
|
||||
use_canvas=True),
|
||||
dict(type='SquareResizePad', target_size=800, pad_ratio=0.6),
|
||||
dict(type='RandomFlip', flip_ratio=0.5, direction='horizontal'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='FCENetTargets',
|
||||
fourier_degree=5,
|
||||
level_proportion_range=leval_prop_range_ctw1500),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=['p3_maps', 'p4_maps', 'p5_maps'],
|
||||
visualize=dict(flag=False, boundary_key=None)),
|
||||
dict(type='Collect', keys=['img', 'p3_maps', 'p4_maps', 'p5_maps'])
|
||||
]
|
||||
|
||||
img_scale_ctw1500 = (1080, 736)
|
||||
test_pipeline_ctw1500 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_ctw1500, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
|
@ -1,57 +0,0 @@
|
|||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
|
||||
dict(
|
||||
type='ScaleAspectJitter',
|
||||
img_scale=None,
|
||||
keep_ratio=False,
|
||||
resize_type='indep_sample_in_range',
|
||||
scale_range=(640, 2560)),
|
||||
dict(type='RandomFlip', flip_ratio=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(
|
||||
type='RandomCropInstances',
|
||||
target_size=(640, 640),
|
||||
mask_type='union_all',
|
||||
instance_key='gt_masks'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='DefaultFormatBundle'),
|
||||
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']),
|
||||
]
|
||||
|
||||
# for ctw1500
|
||||
img_scale_ctw1500 = (1600, 1600)
|
||||
test_pipeline_ctw1500 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_ctw1500, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='RandomFlip'),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
||||
|
||||
# for icdar2015
|
||||
img_scale_icdar2015 = (1920, 1920)
|
||||
test_pipeline_icdar2015 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_icdar2015, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='RandomFlip'),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
|
@ -1,156 +0,0 @@
|
|||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
|
||||
# for ctw1500
|
||||
img_scale_train_ctw1500 = [(3000, 640)]
|
||||
shrink_ratio_train_ctw1500 = (1.0, 0.7)
|
||||
target_size_train_ctw1500 = (640, 640)
|
||||
train_pipeline_ctw1500 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(type='ColorJitter', brightness=32.0 / 255, saturation=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(
|
||||
type='ScaleAspectJitter',
|
||||
img_scale=img_scale_train_ctw1500,
|
||||
ratio_range=(0.7, 1.3),
|
||||
aspect_ratio_range=(0.9, 1.1),
|
||||
multiscale_mode='value',
|
||||
keep_ratio=False),
|
||||
# shrink_ratio is from big to small. The 1st must be 1.0
|
||||
dict(type='PANetTargets', shrink_ratio=shrink_ratio_train_ctw1500),
|
||||
dict(type='RandomFlip', flip_ratio=0.5, direction='horizontal'),
|
||||
dict(type='RandomRotate', rotate_ratio=1.0, max_angle=10),
|
||||
dict(
|
||||
type='RandomCropInstances',
|
||||
target_size=target_size_train_ctw1500,
|
||||
instance_key='gt_kernels'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=['gt_kernels', 'gt_mask'],
|
||||
visualize=dict(flag=False, boundary_key='gt_kernels')),
|
||||
dict(type='Collect', keys=['img', 'gt_kernels', 'gt_mask'])
|
||||
]
|
||||
|
||||
img_scale_test_ctw1500 = (3000, 640)
|
||||
test_pipeline_ctw1500 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_test_ctw1500, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
||||
|
||||
# for icdar2015
|
||||
img_scale_train_icdar2015 = [(3000, 736)]
|
||||
shrink_ratio_train_icdar2015 = (1.0, 0.5)
|
||||
target_size_train_icdar2015 = (736, 736)
|
||||
train_pipeline_icdar2015 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(type='ColorJitter', brightness=32.0 / 255, saturation=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(
|
||||
type='ScaleAspectJitter',
|
||||
img_scale=img_scale_train_icdar2015,
|
||||
ratio_range=(0.7, 1.3),
|
||||
aspect_ratio_range=(0.9, 1.1),
|
||||
multiscale_mode='value',
|
||||
keep_ratio=False),
|
||||
dict(type='PANetTargets', shrink_ratio=shrink_ratio_train_icdar2015),
|
||||
dict(type='RandomFlip', flip_ratio=0.5, direction='horizontal'),
|
||||
dict(type='RandomRotate', rotate_ratio=1.0, max_angle=10),
|
||||
dict(
|
||||
type='RandomCropInstances',
|
||||
target_size=target_size_train_icdar2015,
|
||||
instance_key='gt_kernels'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=['gt_kernels', 'gt_mask'],
|
||||
visualize=dict(flag=False, boundary_key='gt_kernels')),
|
||||
dict(type='Collect', keys=['img', 'gt_kernels', 'gt_mask'])
|
||||
]
|
||||
|
||||
img_scale_test_icdar2015 = (1333, 736)
|
||||
test_pipeline_icdar2015 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_test_icdar2015, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
||||
|
||||
# for icdar2017
|
||||
img_scale_train_icdar2017 = [(3000, 800)]
|
||||
shrink_ratio_train_icdar2017 = (1.0, 0.5)
|
||||
target_size_train_icdar2017 = (800, 800)
|
||||
train_pipeline_icdar2017 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(type='ColorJitter', brightness=32.0 / 255, saturation=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(
|
||||
type='ScaleAspectJitter',
|
||||
img_scale=img_scale_train_icdar2017,
|
||||
ratio_range=(0.7, 1.3),
|
||||
aspect_ratio_range=(0.9, 1.1),
|
||||
multiscale_mode='value',
|
||||
keep_ratio=False),
|
||||
dict(type='PANetTargets', shrink_ratio=shrink_ratio_train_icdar2017),
|
||||
dict(type='RandomFlip', flip_ratio=0.5, direction='horizontal'),
|
||||
dict(type='RandomRotate', rotate_ratio=1.0, max_angle=10),
|
||||
dict(
|
||||
type='RandomCropInstances',
|
||||
target_size=target_size_train_icdar2017,
|
||||
instance_key='gt_kernels'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=['gt_kernels', 'gt_mask'],
|
||||
visualize=dict(flag=False, boundary_key='gt_kernels')),
|
||||
dict(type='Collect', keys=['img', 'gt_kernels', 'gt_mask'])
|
||||
]
|
||||
|
||||
img_scale_test_icdar2017 = (1333, 800)
|
||||
test_pipeline_icdar2017 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_test_icdar2017, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
|
@ -1,70 +0,0 @@
|
|||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(type='ColorJitter', brightness=32.0 / 255, saturation=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(
|
||||
type='ScaleAspectJitter',
|
||||
img_scale=[(3000, 736)],
|
||||
ratio_range=(0.5, 3),
|
||||
aspect_ratio_range=(1, 1),
|
||||
multiscale_mode='value',
|
||||
long_size_bound=1280,
|
||||
short_size_bound=640,
|
||||
resize_type='long_short_bound',
|
||||
keep_ratio=False),
|
||||
dict(type='PSENetTargets'),
|
||||
dict(type='RandomFlip', flip_ratio=0.5, direction='horizontal'),
|
||||
dict(type='RandomRotate', rotate_ratio=1.0, max_angle=10),
|
||||
dict(
|
||||
type='RandomCropInstances',
|
||||
target_size=(640, 640),
|
||||
instance_key='gt_kernels'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=['gt_kernels', 'gt_mask'],
|
||||
visualize=dict(flag=False, boundary_key='gt_kernels')),
|
||||
dict(type='Collect', keys=['img', 'gt_kernels', 'gt_mask'])
|
||||
]
|
||||
|
||||
# for ctw1500
|
||||
img_scale_test_ctw1500 = (1280, 1280)
|
||||
test_pipeline_ctw1500 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_test_ctw1500, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
||||
|
||||
# for icdar2015
|
||||
img_scale_test_icdar2015 = (2240, 2240)
|
||||
test_pipeline_icdar2015 = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=img_scale_test_icdar2015, # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
|
@ -1,66 +0,0 @@
|
|||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='LoadTextAnnotations',
|
||||
with_bbox=True,
|
||||
with_mask=True,
|
||||
poly2mask=False),
|
||||
dict(type='ColorJitter', brightness=32.0 / 255, saturation=0.5),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(
|
||||
type='RandomCropPolyInstances',
|
||||
instance_key='gt_masks',
|
||||
crop_ratio=0.65,
|
||||
min_side_ratio=0.3),
|
||||
dict(
|
||||
type='RandomRotate',
|
||||
rotate_ratio=0.5,
|
||||
max_angle=20,
|
||||
pad_with_fixed_color=False,
|
||||
use_canvas=True),
|
||||
dict(
|
||||
type='ScaleAspectJitter',
|
||||
img_scale=[(3000, 736)], # unused
|
||||
ratio_range=(0.7, 1.3),
|
||||
aspect_ratio_range=(0.9, 1.1),
|
||||
multiscale_mode='value',
|
||||
long_size_bound=800,
|
||||
short_size_bound=480,
|
||||
resize_type='long_short_bound',
|
||||
keep_ratio=False),
|
||||
dict(type='SquareResizePad', target_size=800, pad_ratio=0.6),
|
||||
dict(type='RandomFlip', flip_ratio=0.5, direction='horizontal'),
|
||||
dict(type='TextSnakeTargets'),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(
|
||||
type='CustomFormatBundle',
|
||||
keys=[
|
||||
'gt_text_mask', 'gt_center_region_mask', 'gt_mask',
|
||||
'gt_radius_map', 'gt_sin_map', 'gt_cos_map'
|
||||
],
|
||||
visualize=dict(flag=False, boundary_key='gt_text_mask')),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=[
|
||||
'img', 'gt_text_mask', 'gt_center_region_mask', 'gt_mask',
|
||||
'gt_radius_map', 'gt_sin_map', 'gt_cos_map'
|
||||
])
|
||||
]
|
||||
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
|
||||
dict(
|
||||
type='MultiScaleFlipAug',
|
||||
img_scale=(1333, 736), # used by Resize
|
||||
flip=False,
|
||||
transforms=[
|
||||
dict(type='Resize', keep_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='Pad', size_divisor=32),
|
||||
dict(type='ImageToTensor', keys=['img']),
|
||||
dict(type='Collect', keys=['img']),
|
||||
])
|
||||
]
|
|
@ -1,35 +0,0 @@
|
|||
img_norm_cfg = dict(mean=[127], std=[127])
|
||||
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='grayscale'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=32,
|
||||
min_width=100,
|
||||
max_width=100,
|
||||
keep_aspect_ratio=False),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='DefaultFormatBundle'),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=['filename', 'resize_shape', 'text', 'valid_ratio']),
|
||||
]
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='grayscale'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=32,
|
||||
min_width=32,
|
||||
max_width=None,
|
||||
keep_aspect_ratio=True),
|
||||
dict(type='Normalize', **img_norm_cfg),
|
||||
dict(type='DefaultFormatBundle'),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'resize_shape', 'valid_ratio', 'img_norm_cfg',
|
||||
'ori_filename', 'img_shape', 'ori_shape'
|
||||
]),
|
||||
]
|
|
@ -1,37 +0,0 @@
|
|||
img_norm_cfg = dict(mean=[0.5], std=[0.5])
|
||||
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='grayscale'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=32,
|
||||
min_width=100,
|
||||
max_width=100,
|
||||
keep_aspect_ratio=False),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'resize_shape', 'text', 'valid_ratio'
|
||||
]),
|
||||
]
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile', color_type='grayscale'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=32,
|
||||
min_width=32,
|
||||
max_width=100,
|
||||
keep_aspect_ratio=False),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'resize_shape', 'valid_ratio',
|
||||
'img_norm_cfg', 'ori_filename', 'img_shape'
|
||||
]),
|
||||
]
|
|
@ -1,42 +0,0 @@
|
|||
img_norm_cfg = dict(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=48,
|
||||
min_width=48,
|
||||
max_width=160,
|
||||
keep_aspect_ratio=True),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'img_shape', 'text', 'valid_ratio',
|
||||
'resize_shape'
|
||||
]),
|
||||
]
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='MultiRotateAugOCR',
|
||||
rotate_degrees=[0, 90, 270],
|
||||
transforms=[
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=48,
|
||||
min_width=48,
|
||||
max_width=160,
|
||||
keep_aspect_ratio=True),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'img_shape', 'valid_ratio',
|
||||
'img_norm_cfg', 'ori_filename', 'resize_shape'
|
||||
]),
|
||||
])
|
||||
]
|
|
@ -1,38 +0,0 @@
|
|||
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=32,
|
||||
min_width=32,
|
||||
max_width=160,
|
||||
keep_aspect_ratio=True,
|
||||
width_downsample_ratio=0.25),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'resize_shape', 'text', 'valid_ratio'
|
||||
]),
|
||||
]
|
||||
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=32,
|
||||
min_width=32,
|
||||
max_width=160,
|
||||
keep_aspect_ratio=True),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'resize_shape', 'valid_ratio',
|
||||
'img_norm_cfg', 'ori_filename', 'img_shape'
|
||||
])
|
||||
]
|
|
@ -1,43 +0,0 @@
|
|||
img_norm_cfg = dict(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=48,
|
||||
min_width=48,
|
||||
max_width=160,
|
||||
keep_aspect_ratio=True,
|
||||
width_downsample_ratio=0.25),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'resize_shape', 'text', 'valid_ratio'
|
||||
]),
|
||||
]
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='MultiRotateAugOCR',
|
||||
rotate_degrees=[0, 90, 270],
|
||||
transforms=[
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=48,
|
||||
min_width=48,
|
||||
max_width=160,
|
||||
keep_aspect_ratio=True,
|
||||
width_downsample_ratio=0.25),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'resize_shape', 'valid_ratio',
|
||||
'img_norm_cfg', 'ori_filename', 'img_shape'
|
||||
]),
|
||||
])
|
||||
]
|
|
@ -1,44 +0,0 @@
|
|||
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=32,
|
||||
min_width=100,
|
||||
max_width=100,
|
||||
keep_aspect_ratio=False,
|
||||
width_downsample_ratio=0.25),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'img_shape', 'text', 'valid_ratio',
|
||||
'resize_shape'
|
||||
]),
|
||||
]
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='MultiRotateAugOCR',
|
||||
rotate_degrees=[0, 90, 270],
|
||||
transforms=[
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=32,
|
||||
min_width=100,
|
||||
max_width=100,
|
||||
keep_aspect_ratio=False,
|
||||
width_downsample_ratio=0.25),
|
||||
dict(type='ToTensorOCR'),
|
||||
dict(type='NormalizeOCR', **img_norm_cfg),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'ori_shape', 'img_shape', 'valid_ratio',
|
||||
'resize_shape', 'img_norm_cfg', 'ori_filename'
|
||||
]),
|
||||
])
|
||||
]
|
|
@ -1,66 +0,0 @@
|
|||
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'),
|
||||
dict(type='RandomRotate', rotate_ratio=0.5, max_angle=15),
|
||||
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'],
|
||||
meta_keys=['filename', 'ori_shape', 'resize_shape'])
|
||||
]
|
||||
|
||||
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']])
|
||||
|
||||
test_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(
|
||||
type='ResizeOCR',
|
||||
height=64,
|
||||
min_width=64,
|
||||
max_width=None,
|
||||
keep_aspect_ratio=True),
|
||||
dict(type='Normalize', **test_img_norm_cfg),
|
||||
dict(type='DefaultFormatBundle'),
|
||||
dict(
|
||||
type='Collect',
|
||||
keys=['img'],
|
||||
meta_keys=[
|
||||
'filename', 'resize_shape', 'img_norm_cfg', 'ori_filename',
|
||||
'img_shape', 'ori_shape'
|
||||
])
|
||||
]
|
Loading…
Reference in New Issue