Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
fix: refine bounding box removal logic based on score comparison
myhloli80c1b995bcbd
diff --git a/mineru/utils/model_utils.py b/mineru/utils/model_utils.pyindex 8422cac9..742be5f3 100644--- a/mineru/utils/model_utils.py+++ b/mineru/utils/model_utils.py@@ -219,29 +219,27 @@ def remove_overlaps_min_blocks(res_list):)if overlap_box is not None:- res_to_remove = None- large_res = None- # 确定哪个是小块(要移除的)+ # 根据重叠框确定哪个是小块,哪个是大块if overlap_box == res_list[i]['bbox']:- res_to_remove = res_list[i]- large_res = res_list[j]+ small_res, large_res = res_list[i], res_list[j]elif overlap_box == res_list[j]['bbox']:- res_to_remove = res_list[j]- large_res = res_list[i]+ small_res, large_res = res_list[j], res_list[i]+ else:+ continue # 如果重叠框与任一块都不匹配,跳过处理- if res_to_remove['score'] < large_res['score']:+ if small_res['score'] <= large_res['score']:# 如果小块的分数低于大块,则小块为需要移除的块- if res_to_remove is not None and res_to_remove not in need_remove:+ if small_res is not None and small_res not in need_remove:# 更新大块的边界为两者的并集x1, y1, x2, y2 = large_res['bbox']- sx1, sy1, sx2, sy2 = res_to_remove['bbox']+ sx1, sy1, sx2, sy2 = small_res['bbox']x1 = min(x1, sx1)y1 = min(y1, sy1)x2 = max(x2, sx2)y2 = max(y2, sy2)large_res['bbox'] = [x1, y1, x2, y2]- need_remove.append(res_to_remove)+ need_remove.append(small_res)else:# 如果大块的分数低于小块,则大块为需要移除的块, 这时不需要更新小块的边界if large_res is not None and large_res not in need_remove: