Kaynağa Gözat

fix(pipeline_manager): ensure bbox coordinates are integers for text PDFs

- Updated the bounding box (bbox) assignment in the EnhancedDocPipeline to maintain integer types for coordinates, aligning with the integer pixel coordinates of PDF formats. This change enhances the accuracy of spatial data representation in document processing.
zhch158_admin 16 saat önce
ebeveyn
işleme
6913675caf

+ 2 - 1
ocr_tools/universal_doc_parser/core/pipeline_manager_v2.py

@@ -537,9 +537,10 @@ class EnhancedDocPipeline:
                 continue
             
             # 转换为 OCR span 格式
+            # 文字PDF的bbox保持int类型(PDF坐标本身就是整数像素坐标)
             span = {
                 'text': text,
-                'bbox': [x1, y1, x2, y2],  # 或者转为 poly 格式
+                'bbox': [int(round(x1)), int(round(y1)), int(round(x2)), int(round(y2))],  # 文字PDF保持int类型
                 'confidence': 1.0,  # PDF 提取的置信度设为 1.0
                 'source': 'pdf'  # 标记来源
             }