mirror of
https://github.com/open-mmlab/mmocr.git
synced 2025-06-03 21:54:47 +08:00
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
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'
|
|
]),
|
|
])
|
|
]
|