|
|
|
@ -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
|
|
|
|
|