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: adjust confidence thresholds and refine table detection logic for improved accuracy
myhlolia01c4bbe669c
diff --git a/mineru/model/layout/doclayout_yolo.py b/mineru/model/layout/doclayout_yolo.pyindex 5667a909..b7c38f50 100644--- a/mineru/model/layout/doclayout_yolo.py+++ b/mineru/model/layout/doclayout_yolo.py@@ -60,10 +60,12 @@ class DocLayoutYOLOModel:with tqdm(total=len(images), desc="Layout Predict") as pbar:for idx in range(0, len(images), batch_size):batch = images[idx: idx + batch_size]+ if batch_size == 1:+ conf = 0.9 * self.confpredictions = self.model.predict(batch,imgsz=self.imgsz,- conf=self.conf,+ conf=conf,iou=self.iou,verbose=False,)diff --git a/mineru/model/table/cls/paddle_table_cls.py b/mineru/model/table/cls/paddle_table_cls.pyindex 5a609a8f..14153fca 100644--- a/mineru/model/table/cls/paddle_table_cls.py+++ b/mineru/model/table/cls/paddle_table_cls.py@@ -67,6 +67,6 @@ class PaddleTableClsModel:idx = np.argmax(result)conf = float(np.max(result))# logger.debug(f"Table classification result: {self.labels[idx]} with confidence {conf:.4f}")- if idx == 0 and conf < 0.85:+ if idx == 0 and conf < 0.8:idx = 1return self.labels[idx], confdiff --git a/mineru/model/table/rec/unet_table/unet_table.py b/mineru/model/table/rec/unet_table/unet_table.pyindex aa9ac95a..099ef2cc 100644--- a/mineru/model/table/rec/unet_table/unet_table.py+++ b/mineru/model/table/rec/unet_table/unet_table.py@@ -62,7 +62,7 @@ class UnetTableRecognition:img = self.load_img(img)polygons, rotated_polygons = self.table_structure(img, **kwargs)if polygons is None:- logger.warning("polygons is None.")+ # logger.warning("polygons is None.")return UnetTableOutput("", None, None, 0.0)try:@@ -243,7 +243,7 @@ class UnetTableModel:# 判断是否使用无线表格模型的结果if (wired_len <= round(wireless_len * 0.5) # 有线模型检测到的单元格数太少(低于无线模型的50%)- or (wireless_len < wired_len < (2 * wireless_len) and table_cls_score <= 0.949) # 有线模型检测到的单元格数反而更多+ or ((wireless_len < wired_len) and (wired_len < (2 * wireless_len)) and table_cls_score <= 0.949) # 有线模型检测到的单元格数反而更多or (0 <= gap_of_len <= 5 and wired_len <= round(wireless_len * 0.75)) # 两者相差不大但有线模型结果较少or (gap_of_len == 0 and wired_len <= 4) # 单元格数量完全相等且总量小于等于4):