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
feat: normalize rotated label handling in orientation classification
myhloli302b1beadbe1
diff --git a/mineru/model/ori_cls/paddle_ori_cls.py b/mineru/model/ori_cls/paddle_ori_cls.pyindex 001a9c2e..c7c86f4f 100644--- a/mineru/model/ori_cls/paddle_ori_cls.py+++ b/mineru/model/ori_cls/paddle_ori_cls.py@@ -109,11 +109,20 @@ class PaddleOrientationClsModel:if is_rotated:x = self.preprocess(np_img)(result,) = self.sess.run(None, {"x": x})- rotate_label = self.labels[np.argmax(result)]+ rotate_label = self._normalize_rotated_label(+ self.labels[np.argmax(result)]+ )# logger.debug(f"Orientation classification result: {label}")return rotate_label+ @staticmethod+ def _normalize_rotated_label(label: str) -> str:+ """进入方向分类器已说明表格疑似旋转,0/180 等不可信结果统一按 270 兜底。"""+ if label in {"90", "270"}:+ return label+ return "270"+def list_2_batch(self, img_list, batch_size=16):"""将任意长度的列表按照指定的batch size分成多个batch@@ -248,7 +257,9 @@ class PaddleOrientationClsModel:x = self.batch_preprocess(img_batch)results = self.sess.run(None, {"x": x})for img_info, res in zip(rotated_imgs, results[0]):- label = self.labels[np.argmax(res)]+ label = self._normalize_rotated_label(+ self.labels[np.argmax(res)]+ )self.img_rotate(img_info, label)pbar.update(1)