fix slice op parameters not being passed correctly (#13319)

pull/13197/merge
Wang Xin 2024-07-09 17:13:41 +08:00 committed by GitHub
parent c95f6b2de7
commit db0ad17cf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View File

@ -56,6 +56,7 @@ dependencies = [
"beautifulsoup4",
"fonttools>=4.24.0",
"fire>=0.3.0",
"requests"
]
[project.urls]

View File

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

View File

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