|
|
@@ -0,0 +1,153 @@
|
|
|
+# 银行交易流水场景配置 - 智能路由器版本
|
|
|
+# 支持同时运行多个layout模型,自动选择最佳结果
|
|
|
+
|
|
|
+scene_name: "bank_statement_smart_router"
|
|
|
+description: "银行交易流水:智能路由器自动选择最佳layout模型(docling + mineru)"
|
|
|
+
|
|
|
+input:
|
|
|
+ supported_formats: [".pdf", ".png", ".jpg", ".jpeg", ".bmp", ".tiff"]
|
|
|
+ dpi: 200
|
|
|
+
|
|
|
+preprocessor:
|
|
|
+ module: "mineru"
|
|
|
+ orientation_classifier:
|
|
|
+ enabled: true
|
|
|
+
|
|
|
+# ============================================================
|
|
|
+# 智能布局模型路由器配置
|
|
|
+# ============================================================
|
|
|
+layout_detection:
|
|
|
+ module: "smart_router"
|
|
|
+ strategy: "ocr_eval" # ocr_eval(推荐,基于OCR评估选择最佳), auto(快速模式,基于文档特征)
|
|
|
+
|
|
|
+ # 分数差距阈值:当模型间分数差距小于此值时,优先选择 docling(默认 0.05)
|
|
|
+ score_diff_threshold: 0.05
|
|
|
+
|
|
|
+ # 配置多个模型
|
|
|
+ models:
|
|
|
+ docling:
|
|
|
+ module: "docling"
|
|
|
+ model_name: "docling-layout-old"
|
|
|
+ model_dir: "ds4sd/docling-layout-old"
|
|
|
+ device: "cpu"
|
|
|
+ conf: 0.3
|
|
|
+ num_threads: 4
|
|
|
+
|
|
|
+ mineru:
|
|
|
+ module: "mineru"
|
|
|
+ model_name: "layout"
|
|
|
+ model_dir: null # 使用默认路径
|
|
|
+ device: "cpu"
|
|
|
+
|
|
|
+ # Debug 可视化配置(与 MinerUWiredTableRecognizer.DebugOptions 对齐)
|
|
|
+ # 默认关闭。开启后将保存:layout检测结果
|
|
|
+ debug_options:
|
|
|
+ enabled: true # 是否开启调试可视化输出
|
|
|
+ output_dir: null # 调试输出目录;null不输出
|
|
|
+ prefix: "" # 保存文件名前缀(如设置为页码)
|
|
|
+
|
|
|
+
|
|
|
+ # 可选:回退模型(当所有模型都失败时使用)
|
|
|
+ fallback_model:
|
|
|
+ module: "mineru"
|
|
|
+ model_name: "layout"
|
|
|
+ device: "cpu"
|
|
|
+
|
|
|
+ # 后处理配置
|
|
|
+ post_process:
|
|
|
+ # 将大面积文本块转换为表格(后处理)
|
|
|
+ convert_large_text_to_table: true
|
|
|
+ min_text_area_ratio: 0.25
|
|
|
+ min_text_width_ratio: 0.4
|
|
|
+ min_text_height_ratio: 0.3
|
|
|
+
|
|
|
+ocr_recognition:
|
|
|
+ module: "mineru"
|
|
|
+ language: "ch"
|
|
|
+ det_threshold: 0.5
|
|
|
+ unclip_ratio: 1.5
|
|
|
+ enable_merge_det_boxes: false
|
|
|
+ batch_size: 8
|
|
|
+ device: "cpu"
|
|
|
+
|
|
|
+# 表格分类配置(自动区分有线/无线表格)
|
|
|
+table_classification:
|
|
|
+ enabled: true # 是否启用自动表格分类(默认关闭,使用手动配置)
|
|
|
+ module: "paddle" # 分类模型:paddle(MinerU PaddleTableClsModel)
|
|
|
+ confidence_threshold: 0.5 # 分类置信度阈值
|
|
|
+ batch_size: 16 # 批处理大小
|
|
|
+
|
|
|
+ # Debug 可视化配置(与 MinerUWiredTableRecognizer.DebugOptions 对齐)
|
|
|
+ # 默认关闭。开启后将保存:表格线
|
|
|
+ debug_options:
|
|
|
+ enabled: true # 是否开启调试可视化输出
|
|
|
+ output_dir: null # 调试输出目录;null不输出
|
|
|
+ save_table_lines: true # 保存表格线可视化(unet横线/竖线叠加)
|
|
|
+ image_format: "png" # 可视化图片格式:png/jpg
|
|
|
+ prefix: "" # 保存文件名前缀(如设置为页码/表格序号)
|
|
|
+
|
|
|
+# 有线表格识别专用配置
|
|
|
+table_recognition_wired:
|
|
|
+ use_wired_unet: true
|
|
|
+ upscale_ratio: 3.333
|
|
|
+ need_ocr: true
|
|
|
+ row_threshold: 10
|
|
|
+ col_threshold: 15
|
|
|
+ ocr_conf_threshold: 0.8
|
|
|
+ cell_crop_margin: 2
|
|
|
+ use_custom_postprocess: true # 是否使用自定义后处理(默认启用)
|
|
|
+
|
|
|
+ # 是否启用倾斜矫正
|
|
|
+ enable_deskew: true
|
|
|
+
|
|
|
+ # Debug 可视化配置(与 MinerUWiredTableRecognizer.DebugOptions 对齐)
|
|
|
+ # 默认关闭。开启后将保存:表格线、连通域、逻辑网格结构、文本覆盖可视化。
|
|
|
+ debug_options:
|
|
|
+ enabled: true # 是否开启调试可视化输出
|
|
|
+ output_dir: null # 调试输出目录;null不输出
|
|
|
+ save_table_lines: true # 保存表格线可视化(unet横线/竖线叠加)
|
|
|
+ save_connected_components: true # 保存连通域提取的单元格图
|
|
|
+ save_grid_structure: true # 保存逻辑网格结构(row/col/rowspan/colspan)
|
|
|
+ save_text_overlay: true # 保存文本填充覆盖图
|
|
|
+ image_format: "png" # 可视化图片格式:png/jpg
|
|
|
+ prefix: "" # 保存文件名前缀(如设置为页码/表格序号)
|
|
|
+
|
|
|
+# VLM 表格识别配置(当分类为 'wireless' 时使用)
|
|
|
+vl_recognition:
|
|
|
+ # 可选: "mineru" (MinerU VLM) 或 "paddle" (PaddleOCR-VL)
|
|
|
+ module: "paddle"
|
|
|
+ model_name: "PaddleOCR-VL-0.9B"
|
|
|
+
|
|
|
+ # 后端配置
|
|
|
+ backend: "http-client" # 可选: "http-client", "vllm-engine", "transformers"
|
|
|
+ server_url: "http://10.192.72.11:20016" # PaddleOCR-VL 服务地址
|
|
|
+
|
|
|
+ # 图片尺寸限制(避免序列长度超限)
|
|
|
+ max_image_size: 4096
|
|
|
+ resize_mode: 'max'
|
|
|
+ device: "cpu"
|
|
|
+ batch_size: 1
|
|
|
+ model_params:
|
|
|
+ max_concurrency: 10
|
|
|
+ http_timeout: 600
|
|
|
+
|
|
|
+ # 表格识别特定配置
|
|
|
+ table_recognition:
|
|
|
+ return_cells_coordinate: true # 返回单元格坐标
|
|
|
+
|
|
|
+output:
|
|
|
+ create_subdir: false
|
|
|
+ save_pdf_images: true
|
|
|
+ save_json: true
|
|
|
+ save_page_json: true
|
|
|
+ save_markdown: true
|
|
|
+ save_page_markdown: true
|
|
|
+ save_html: true
|
|
|
+ save_layout_image: true
|
|
|
+ save_ocr_image: true
|
|
|
+ draw_type_label: true
|
|
|
+ draw_bbox_number: true
|
|
|
+ save_enhanced_json: true
|
|
|
+ coordinate_precision: 2
|
|
|
+ normalize_numbers: true
|
|
|
+ debug_mode: true
|