提交 0ee6137d 编写于 作者: W WenmuZhou

del pad

上级 4290c697
......@@ -122,8 +122,6 @@ class DetResizeForTest(object):
elif 'limit_side_len' in kwargs:
self.limit_side_len = kwargs['limit_side_len']
self.limit_type = kwargs.get('limit_type', 'min')
self.pad = kwargs.get('pad', False)
self.pad_size = kwargs.get('pad_size', 480)
elif 'resize_long' in kwargs:
self.resize_type = 2
self.resize_long = kwargs.get('resize_long', 960)
......@@ -174,11 +172,9 @@ class DetResizeForTest(object):
ratio = float(limit_side_len) / h
else:
ratio = float(limit_side_len) / w
elif self.pad:
ratio = float(self.pad_size) / max(h, w)
else:
ratio = 1.
else:
elif self.limit_type == 'min':
if min(h, w) < limit_side_len:
if h < w:
ratio = float(limit_side_len) / h
......@@ -186,6 +182,10 @@ class DetResizeForTest(object):
ratio = float(limit_side_len) / w
else:
ratio = 1.
elif self.limit_type == 'resize_long':
ratio = float(limit_side_len) / max(h,w)
else:
raise Exception('not support limit type, image ')
resize_h = int(h * ratio)
resize_w = int(w * ratio)
......@@ -201,10 +201,6 @@ class DetResizeForTest(object):
sys.exit(0)
ratio_h = resize_h / float(h)
ratio_w = resize_w / float(w)
if self.limit_type == 'max' and self.pad:
padding_im = np.zeros((self.pad_size, self.pad_size, c), dtype=np.float32)
padding_im[:resize_h, :resize_w, :] = img
img = padding_im
return img, [ratio_h, ratio_w]
def resize_image_type2(self, img):
......
......@@ -38,8 +38,7 @@ logger = get_logger()
class OCRSystem(object):
def __init__(self, args):
args.det_pad = True
args.det_pad_size = 960
args.det_limit_type = 'resize_long'
args.drop_score = 0
self.text_system = TextSystem(args)
self.table_system = TableSystem(args, self.text_system.text_detector, self.text_system.text_recognizer)
......
......@@ -42,8 +42,6 @@ class TextDetector(object):
'DetResizeForTest': {
'limit_side_len': args.det_limit_side_len,
'limit_type': args.det_limit_type,
'pad':args.det_pad,
'pad_size':args.det_pad_size
}
}, {
'NormalizeImage': {
......
......@@ -46,8 +46,6 @@ def init_args():
parser.add_argument("--det_model_dir", type=str)
parser.add_argument("--det_limit_side_len", type=float, default=960)
parser.add_argument("--det_limit_type", type=str, default='max')
parser.add_argument("--det_pad", type=str2bool, default=False)
parser.add_argument("--det_pad_size", type=int, default=640)
# DB parmas
parser.add_argument("--det_db_thresh", type=float, default=0.3)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册