Skip to content

Commit

Permalink
fix slice op parameters not being passed correctly (PaddlePaddle#13319)
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatV committed Jul 9, 2024
1 parent c1cc80b commit b5044eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencies = [
"beautifulsoup4",
"fonttools>=4.24.0",
"fire>=0.3.0",
"requests"
]

[project.urls]
Expand Down
4 changes: 3 additions & 1 deletion tools/infer/predict_det.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def predict(self, img):
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
Expand All @@ -302,6 +302,7 @@ def __call__(self, img):
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
Expand Down Expand Up @@ -349,6 +350,7 @@ def __call__(self, img):
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
Expand Down
2 changes: 1 addition & 1 deletion tools/infer/predict_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __call__(self, img, cls=True, slice={}):
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
Expand Down

0 comments on commit b5044eb

Please sign in to comment.