Skip to content

Commit 3466ebd

Browse files
authored
[cherry-pick] bugfix: pp-structurev3 (#3668)
1 parent f0b8b92 commit 3466ebd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

paddlex/inference/models/object_detection/processors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,9 @@ def apply(
792792
keep_mask &= (contains_other == 0) | (contained_by_other == 1)
793793
boxes = boxes[keep_mask]
794794

795+
if boxes.size == 0:
796+
return np.array([])
797+
795798
if layout_unclip_ratio:
796799
if isinstance(layout_unclip_ratio, float):
797800
layout_unclip_ratio = (layout_unclip_ratio, layout_unclip_ratio)
@@ -800,7 +803,7 @@ def apply(
800803
len(layout_unclip_ratio) == 2
801804
), f"The length of `layout_unclip_ratio` should be 2."
802805
elif isinstance(layout_unclip_ratio, dict):
803-
pass
806+
pass
804807
else:
805808
raise ValueError(
806809
f"The type of `layout_unclip_ratio` must be float, Tuple[float, float] or Dict[int, Tuple[float, float]], but got {type(layout_unclip_ratio)}."

paddlex/inference/pipelines/layout_parsing/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ def get_single_block_parsing_res(
592592

593593
if label == "table":
594594
for table_res in table_res_list:
595+
if len(table_res["cell_box_list"]) == 0:
596+
continue
595597
if (
596598
_calculate_overlap_area_div_minbox_area_ratio(
597599
block_bbox, table_res["cell_box_list"][0]

0 commit comments

Comments
 (0)