瀏覽代碼

fix that when both layout result and ocr result are null

gaotingquan 8 月之前
父節點
當前提交
896dd270e1
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      paddlex/inference/pipelines/layout_parsing/utils.py

+ 2 - 0
paddlex/inference/pipelines/layout_parsing/utils.py

@@ -1233,6 +1233,8 @@ def _get_sub_category(
             if num_doc_title == 2:
                 special_pre_cut_labels = title_labels + sub_title_labels
                 break
+    if len(blocks) == 0:
+        return blocks, {}
 
     min_x = min(block["block_bbox"][0] for block in blocks)
     min_y = min(block["block_bbox"][1] for block in blocks)