Skip to content

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

fix: update batch analysis to use PIL images for layout prediction and adjust rotation condition

myhloli396cf8b81df1
diff --git a/mineru/backend/pipeline/batch_analyze.py b/mineru/backend/pipeline/batch_analyze.py
index fddd89e5..3e44ad04 100644
--- a/mineru/backend/pipeline/batch_analyze.py
+++ b/mineru/backend/pipeline/batch_analyze.py
@@ -42,12 +42,14 @@ class BatchAnalyze:
)
atom_model_manager = AtomModelSingleton()
+ pil_images = [image for image, _, _ in images_with_extra_info]
+
np_images = [np.asarray(image) for image, _, _ in images_with_extra_info]
# doclayout_yolo
images_layout_res += self.model.layout_model.batch_predict(
- np_images, YOLO_LAYOUT_BASE_BATCH_SIZE
+ pil_images, YOLO_LAYOUT_BASE_BATCH_SIZE
)
if self.formula_enable:
diff --git a/mineru/utils/ocr_utils.py b/mineru/utils/ocr_utils.py
index 3babe600..26e5f930 100644
--- a/mineru/utils/ocr_utils.py
+++ b/mineru/utils/ocr_utils.py
@@ -437,6 +437,7 @@ def get_rotate_crop_image(img, points):
borderMode=cv2.BORDER_REPLICATE,
flags=cv2.INTER_CUBIC)
dst_img_height, dst_img_width = dst_img.shape[0:2]
- if dst_img_height * 1.0 / dst_img_width >= 1.5:
+ rotate_radio = 2
+ if dst_img_height * 1.0 / dst_img_width >= rotate_radio:
dst_img = np.rot90(dst_img)
return dst_img
\ No newline at end of file