Skip to content

Commit 2b93ec5

Browse files
authored
fix slice op parameters not being passed correctly (#13319) (#13324)
1 parent c1cc80b commit 2b93ec5

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ dependencies = [
5656
"beautifulsoup4",
5757
"fonttools>=4.24.0",
5858
"fire>=0.3.0",
59+
"requests"
5960
]
6061

6162
[project.urls]

tools/infer/predict_det.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def predict(self, img):
293293
et = time.time()
294294
return dt_boxes, et - st
295295

296-
def __call__(self, img):
296+
def __call__(self, img, use_slice=False):
297297
# For image like poster with one side much greater than the other side,
298298
# splitting recursively and processing with overlap to enhance performance.
299299
MIN_BOUND_DISTANCE = 50
@@ -302,6 +302,7 @@ def __call__(self, img):
302302
if (
303303
img.shape[0] / img.shape[1] > 2
304304
and img.shape[0] > self.args.det_limit_side_len
305+
and use_slice
305306
):
306307
start_h = 0
307308
end_h = 0
@@ -349,6 +350,7 @@ def __call__(self, img):
349350
elif (
350351
img.shape[1] / img.shape[0] > 3
351352
and img.shape[1] > self.args.det_limit_side_len * 3
353+
and use_slice
352354
):
353355
start_w = 0
354356
end_w = 0

tools/infer/predict_system.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __call__(self, img, cls=True, slice={}):
9191
elapsed = []
9292
dt_slice_boxes = []
9393
for slice_crop, v_start, h_start in slice_gen:
94-
dt_boxes, elapse = self.text_detector(slice_crop)
94+
dt_boxes, elapse = self.text_detector(slice_crop, use_slice=True)
9595
if dt_boxes.size:
9696
dt_boxes[:, :, 0] += h_start
9797
dt_boxes[:, :, 1] += v_start

0 commit comments

Comments
 (0)