add distort and space

release/1.1
tink2123 5 years ago
parent 5067126e8c
commit 97a3af3bbf

@ -14,6 +14,7 @@ Global:
character_type: ch
character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt
loss_type: ctc
distort: true
reader_yml: ./configs/rec/rec_chinese_reader.yml
pretrain_weights:
checkpoints:

@ -13,6 +13,7 @@ Global:
max_text_length: 25
character_type: en
loss_type: ctc
distort: true
reader_yml: ./configs/rec/rec_icdar15_reader.yml
pretrain_weights: ./pretrain_models/rec_mv3_none_bilstm_ctc/best_accuracy
checkpoints:

@ -45,6 +45,8 @@ class LMDBReader(object):
self.use_tps = False
if "tps" in params:
self.ues_tps = True
if "distort" in params:
self.use_distort = params['distort']
if params['mode'] == 'train':
self.batch_size = params['train_batch_size_per_card']
self.drop_last = True
@ -142,7 +144,8 @@ class LMDBReader(object):
label=label,
char_ops=self.char_ops,
loss_type=self.loss_type,
max_text_length=self.max_text_length)
max_text_length=self.max_text_length,
distort=self.use_distort)
if outs is None:
continue
yield outs
@ -185,6 +188,8 @@ class SimpleReader(object):
self.use_tps = False
if "tps" in params:
self.use_tps = True
if "distort" in params:
self.use_distort = params['distort']
if params['mode'] == 'train':
self.batch_size = params['train_batch_size_per_card']
self.drop_last = True
@ -232,9 +237,14 @@ class SimpleReader(object):
img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
label = substr[1]
outs = process_image(img, self.image_shape, label,
self.char_ops, self.loss_type,
self.max_text_length)
outs = process_image(
img=img,
image_shape=self.image_shape,
label=label,
char_ops=self.char_ops,
loss_type=self.loss_type,
max_text_length=self.max_text_length,
distort=self.use_distort)
if outs is None:
continue
yield outs

File diff suppressed because it is too large Load Diff

@ -6620,4 +6620,5 @@ j

Loading…
Cancel
Save