fix slice op parameters not being passed correctly (#13319)
parent
c95f6b2de7
commit
db0ad17cf6
|
@ -56,6 +56,7 @@ dependencies = [
|
|||
"beautifulsoup4",
|
||||
"fonttools>=4.24.0",
|
||||
"fire>=0.3.0",
|
||||
"requests"
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
|
|
@ -293,7 +293,7 @@ class TextDetector(object):
|
|||
et = time.time()
|
||||
return dt_boxes, et - st
|
||||
|
||||
def __call__(self, img):
|
||||
def __call__(self, img, use_slice=False):
|
||||
# For image like poster with one side much greater than the other side,
|
||||
# splitting recursively and processing with overlap to enhance performance.
|
||||
MIN_BOUND_DISTANCE = 50
|
||||
|
@ -302,6 +302,7 @@ class TextDetector(object):
|
|||
if (
|
||||
img.shape[0] / img.shape[1] > 2
|
||||
and img.shape[0] > self.args.det_limit_side_len
|
||||
and use_slice
|
||||
):
|
||||
start_h = 0
|
||||
end_h = 0
|
||||
|
@ -349,6 +350,7 @@ class TextDetector(object):
|
|||
elif (
|
||||
img.shape[1] / img.shape[0] > 3
|
||||
and img.shape[1] > self.args.det_limit_side_len * 3
|
||||
and use_slice
|
||||
):
|
||||
start_w = 0
|
||||
end_w = 0
|
||||
|
|
|
@ -91,7 +91,7 @@ class TextSystem(object):
|
|||
elapsed = []
|
||||
dt_slice_boxes = []
|
||||
for slice_crop, v_start, h_start in slice_gen:
|
||||
dt_boxes, elapse = self.text_detector(slice_crop)
|
||||
dt_boxes, elapse = self.text_detector(slice_crop, use_slice=True)
|
||||
if dt_boxes.size:
|
||||
dt_boxes[:, :, 0] += h_start
|
||||
dt_boxes[:, :, 1] += v_start
|
||||
|
|
Loading…
Reference in New Issue