global.yaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. # OCR验证工具配置文件
  2. # 样式配置
  3. styles:
  4. font_size: 8
  5. colors:
  6. primary: "#0288d1"
  7. secondary: "#ff9800"
  8. success: "#4caf50"
  9. error: "#f44336"
  10. warning: "#ff9800"
  11. background: "#fafafa"
  12. text: "#333333"
  13. layout:
  14. default_zoom: 1.0
  15. default_height: 800
  16. sidebar_width: 1
  17. content_width: 0.65
  18. # 界面配置
  19. ui:
  20. page_title: "OCR可视化校验工具"
  21. page_icon: "🔍"
  22. layout: "wide"
  23. sidebar_state: "expanded"
  24. # OCR数据配置
  25. ocr:
  26. min_text_length: 2
  27. default_confidence: 1.0
  28. exclude_texts: ["Picture", ""]
  29. # 图片方向检测配置
  30. orientation_detection:
  31. enabled: true
  32. confidence_threshold: 0.3 # 置信度阈值
  33. methods: ["opencv_analysis"] # 检测方法
  34. cache_results: true # 缓存检测结果
  35. # OCR工具类型配置
  36. tools:
  37. dots_ocr:
  38. name: "Dots OCR"
  39. description: "专业VLM OCR"
  40. json_structure: "array" # JSON为数组格式
  41. text_field: "text"
  42. bbox_field: "bbox"
  43. category_field: "category"
  44. confidence_field: "confidence"
  45. # 旋转处理配置
  46. rotation:
  47. coordinates_are_pre_rotated: false # 坐标不是预旋转的
  48. ppstructv3:
  49. name: "PPStructV3"
  50. description: "PaddleOCR PP-StructureV3"
  51. json_structure: "object" # JSON为对象格式
  52. parsing_results_field: "parsing_res_list"
  53. text_field: "block_content"
  54. bbox_field: "block_bbox"
  55. rec_texts_field: "overall_ocr_res.rec_texts" # 针对表格中的文字块
  56. rec_boxes_field: "overall_ocr_res.rec_boxes" # 针对表格中的文字块
  57. category_field: "block_label"
  58. confidence_field: "confidence"
  59. # 旋转处理配置
  60. rotation:
  61. coordinates_are_pre_rotated: true # 坐标已经是预旋转的
  62. table_recognition_v2:
  63. name: "TableRecognitionV2"
  64. description: "PaddleOCR Table Recognition V2"
  65. json_structure: "object"
  66. parsing_results_field: "table_res_list"
  67. text_field: "pred_html"
  68. bbox_field: "cell_box_list" # 原先的 cell_box_listox 为笔误
  69. rec_texts_field: "table_ocr_pred.rec_texts" # 针对表格中的文字块
  70. rec_boxes_field: "table_ocr_pred.rec_boxes" # 针对表格中的文字块
  71. category_field: "type"
  72. confidence_field: "confidence"
  73. rotation:
  74. coordinates_are_pre_rotated: true
  75. mineru:
  76. name: "MinerU"
  77. description: "MinerU OCR"
  78. json_structure: "array" # JSON为数组格式
  79. text_field: "text"
  80. bbox_field: "bbox"
  81. category_field: "type"
  82. confidence_field: "confidence"
  83. # 表格相关字段
  84. table_body_field: "table_body"
  85. table_cells_field: "table_cells"
  86. img_path_field: "img_path"
  87. # 旋转处理配置
  88. rotation:
  89. coordinates_are_pre_rotated: false
  90. # 自动检测工具类型的规则(按优先级从高到低)
  91. auto_detection:
  92. enabled: true
  93. rules:
  94. # Table Recognition V2 - 最高优先级
  95. - tool_type: "table_recognition_v2"
  96. conditions:
  97. - type: "field_exists"
  98. field: "table_res_list"
  99. - type: "field_not_exists"
  100. field: "parsing_res_list"
  101. priority: 4
  102. # PPStructV3 - 第二优先级
  103. - tool_type: "ppstructv3"
  104. conditions:
  105. - type: "field_exists"
  106. field: "parsing_res_list"
  107. - type: "field_exists"
  108. field: "doc_preprocessor_res"
  109. priority: 2
  110. # MinerU - 第三优先级
  111. - tool_type: "mineru"
  112. conditions:
  113. - type: "field_exists"
  114. field: "page_idx"
  115. - type: "field_exists"
  116. field: "type"
  117. - type: "json_structure"
  118. structure: "array"
  119. priority: 1
  120. # Dots OCR - 最低优先级(默认)
  121. - tool_type: "dots_ocr"
  122. conditions:
  123. - type: "json_structure"
  124. structure: "array"
  125. - type: "field_exists"
  126. field: "category"
  127. priority: 3
  128. # 预校验结果文件路径
  129. pre_validation:
  130. out_dir: "./output/pre_validation/"
  131. data_sources:
  132. - 德_内蒙古银行照.yaml
  133. - 对公_招商银行图.yaml
  134. - A用户_单元格扫描流水.yaml
  135. - B用户_扫描流水.yaml
  136. - 康强_北京农村商业银行.yaml
  137. - 至远彩色_2023年报.yaml