Selaa lähdekoodia

feat(pipeline): add debug options for table classification to enhance visualization control

zhch158_admin 2 päivää sitten
vanhempi
commit
ac8cca5d22
1 muutettua tiedostoa jossa 12 lisäystä ja 1 poistoa
  1. 12 1
      ocr_tools/universal_doc_parser/core/pipeline_manager_v2.py

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

@@ -823,7 +823,18 @@ class EnhancedDocPipeline:
                 if use_table_classification and self.table_classifier:
                     bbox = item.get('bbox', [])
                     table_img = CoordinateUtils.crop_region(detection_image, bbox)
-                    cls_result = self.table_classifier.classify(table_img)
+                    
+                    # 构造调试选项
+                    cls_debug_opts = {}
+                    if output_dir:
+                        cls_debug_opts['output_dir'] = output_dir
+                    if basename:
+                        cls_debug_opts['prefix'] = f"{basename}_{idx}"
+                    
+                    cls_result = self.table_classifier.classify(
+                        table_img, 
+                        debug_options=cls_debug_opts
+                    )
                     table_type = cls_result.get('table_type', 'wireless')
                     confidence = cls_result.get('confidence', 0.0)
                     logger.info(f"📊 Table {idx} classified as '{table_type}' (conf: {confidence:.3f})")