提交 3337dee6 编写于 作者: xuyang2233's avatar xuyang2233

fixed rec_img_aug 20220801

上级 c5e39657
...@@ -66,7 +66,8 @@ Metric: ...@@ -66,7 +66,8 @@ Metric:
Train: Train:
dataset: dataset:
name: LMDBDataSet name: LMDBDataSet
data_dir: ./train_data/data_lmdb_release/training/ # data_dir: ./train_data/data_lmdb_release/training/
data_dir: I:/dataset/OCR/STR/evaluation/evaluation/CUTE80
transforms: transforms:
- DecodeImage: # load image - DecodeImage: # load image
img_mode: BGR img_mode: BGR
...@@ -88,7 +89,8 @@ Train: ...@@ -88,7 +89,8 @@ Train:
Eval: Eval:
dataset: dataset:
name: LMDBDataSet name: LMDBDataSet
data_dir: ./train_data/data_lmdb_release/evaluation/ # data_dir: ./train_data/data_lmdb_release/evaluation/
data_dir: I:/dataset/OCR/STR/evaluation/evaluation/CUTE80
transforms: transforms:
- DecodeImage: # load image - DecodeImage: # load image
img_mode: BGR img_mode: BGR
......
...@@ -259,24 +259,6 @@ class PRENResizeImg(object): ...@@ -259,24 +259,6 @@ class PRENResizeImg(object):
data['image'] = resized_img.astype(np.float32) data['image'] = resized_img.astype(np.float32)
return data return data
<<<<<<< HEAD
class RobustScannerRecResizeImg(object):
def __init__(self, image_shape, max_text_length, width_downsample_ratio=0.25, **kwargs):
self.image_shape = image_shape
self.width_downsample_ratio = width_downsample_ratio
self.max_text_length = max_text_length
def __call__(self, data):
img = data['image']
norm_img, resize_shape, pad_shape, valid_ratio = resize_norm_img_sar(
img, self.image_shape, self.width_downsample_ratio)
word_positons = np.array(range(0, self.max_text_length)).astype('int64')
data['image'] = norm_img
data['resized_shape'] = resize_shape
data['pad_shape'] = pad_shape
data['valid_ratio'] = valid_ratio
data['word_positons'] = word_positons
=======
class SPINRecResizeImg(object): class SPINRecResizeImg(object):
def __init__(self, def __init__(self,
image_shape, image_shape,
...@@ -319,7 +301,6 @@ class SPINRecResizeImg(object): ...@@ -319,7 +301,6 @@ class SPINRecResizeImg(object):
img -= mean img -= mean
img *= stdinv img *= stdinv
data['image'] = img data['image'] = img
>>>>>>> 1696b36bdb4152138ed5cb08a357df8fe03dc067
return data return data
class GrayRecResizeImg(object): class GrayRecResizeImg(object):
...@@ -399,6 +380,23 @@ class SVTRRecResizeImg(object): ...@@ -399,6 +380,23 @@ class SVTRRecResizeImg(object):
data['valid_ratio'] = valid_ratio data['valid_ratio'] = valid_ratio
return data return data
class RobustScannerRecResizeImg(object):
def __init__(self, image_shape, max_text_length, width_downsample_ratio=0.25, **kwargs):
self.image_shape = image_shape
self.width_downsample_ratio = width_downsample_ratio
self.max_text_length = max_text_length
def __call__(self, data):
img = data['image']
norm_img, resize_shape, pad_shape, valid_ratio = resize_norm_img_sar(
img, self.image_shape, self.width_downsample_ratio)
word_positons = np.array(range(0, self.max_text_length)).astype('int64')
data['image'] = norm_img
data['resized_shape'] = resize_shape
data['pad_shape'] = pad_shape
data['valid_ratio'] = valid_ratio
data['word_positons'] = word_positons
return data
def resize_norm_img_sar(img, image_shape, width_downsample_ratio=0.25): def resize_norm_img_sar(img, image_shape, width_downsample_ratio=0.25):
imgC, imgH, imgW_min, imgW_max = image_shape imgC, imgH, imgW_min, imgW_max = image_shape
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册