Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

feat: adjust OCR detection base batch size and optimize batch ratio logic for GPU memory

myhlolib49b0ce3b8de
diff --git a/mineru/backend/pipeline/batch_analyze.py b/mineru/backend/pipeline/batch_analyze.py
index 89e7264c..05bf7a17 100644
--- a/mineru/backend/pipeline/batch_analyze.py
+++ b/mineru/backend/pipeline/batch_analyze.py
@@ -27,7 +27,7 @@ from ...utils.pdf_image_tools import get_crop_np_img
LAYOUT_BASE_BATCH_SIZE = 1
MFR_BASE_BATCH_SIZE = 16
-OCR_DET_BASE_BATCH_SIZE = 16
+OCR_DET_BASE_BATCH_SIZE = 8
TABLE_ORI_CLS_BATCH_SIZE = 16
TABLE_Wired_Wireless_CLS_BATCH_SIZE = 16
diff --git a/mineru/backend/pipeline/pipeline_analyze.py b/mineru/backend/pipeline/pipeline_analyze.py
index 8bc9064b..a625528f 100644
--- a/mineru/backend/pipeline/pipeline_analyze.py
+++ b/mineru/backend/pipeline/pipeline_analyze.py
@@ -553,11 +553,11 @@ def batch_image_analyze(
gpu_memory = get_vram(device)
if gpu_memory >= 16:
batch_ratio = 16
- elif gpu_memory >= 12:
- batch_ratio = 8
elif gpu_memory >= 8:
- batch_ratio = 4
+ batch_ratio = 8
elif gpu_memory >= 6:
+ batch_ratio = 4
+ elif gpu_memory >= 4:
batch_ratio = 2
else:
batch_ratio = 1