|
|
@@ -26,7 +26,7 @@ from ppstructurev3_utils import (
|
|
|
from utils import normalize_markdown_table, get_input_files
|
|
|
|
|
|
# 🎯 新增:导入适配器
|
|
|
-from adapters.table_recognition_adapter import apply_table_recognition_adapter, restore_original_function
|
|
|
+from adapters import apply_table_recognition_adapter, restore_original_function
|
|
|
|
|
|
def html_table_to_markdown(html: str) -> str:
|
|
|
"""
|
|
|
@@ -140,12 +140,13 @@ def process_images_with_table_pipeline(
|
|
|
try:
|
|
|
outputs = pipeline.predict(
|
|
|
img_path,
|
|
|
- use_doc_orientation_classify=True,
|
|
|
+ use_doc_orientation_classify=False,
|
|
|
use_doc_unwarping=False,
|
|
|
use_layout_detection=True,
|
|
|
use_ocr_results_with_table_cells=True,
|
|
|
use_table_orientation_classify=True,
|
|
|
use_wired_table_cells_trans_to_html=True,
|
|
|
+ use_wireless_table_cells_trans_to_html=True,
|
|
|
# 🎯 注意:适配器模式下不需要这个参数
|
|
|
# use_table_cells_split_ocr=False,
|
|
|
)
|
|
|
@@ -315,19 +316,21 @@ if __name__ == "__main__":
|
|
|
print("🚀 启动 table_recognition_v2 单管线处理程序...")
|
|
|
if len(sys.argv) == 1:
|
|
|
# 演示默认参数(请按需修改)
|
|
|
- demo = {
|
|
|
- "--input_dir": "/Users/zhch158/workspace/data/流水分析/A用户_单元格扫描流水.img",
|
|
|
- "--output_dir": "/Users/zhch158/workspace/data/流水分析/A用户_单元格扫描流水/table_recognition_v2_Results",
|
|
|
- "--pipeline": "./my_config/table_recognition_v2.yaml",
|
|
|
- "--device": "cpu",
|
|
|
- }
|
|
|
# demo = {
|
|
|
- # # "--input_file": "/Users/zhch158/workspace/data/至远彩色印刷工业有限公司/2023年度报告母公司.img/2023年度报告母公司_page_006.png",
|
|
|
- # "--input_file": "/Users/zhch158/workspace/data/至远彩色印刷工业有限公司/2023年度报告母公司.img/2023年度报告母公司_page_005.png",
|
|
|
- # "--output_dir": "/Users/zhch158/workspace/data/至远彩色印刷工业有限公司/table_recognition_v2_Results",
|
|
|
+ # "--input_dir": "/Users/zhch158/workspace/data/流水分析/A用户_单元格扫描流水.img",
|
|
|
+ # "--output_dir": "/Users/zhch158/workspace/data/流水分析/A用户_单元格扫描流水/table_recognition_v2_Results",
|
|
|
# "--pipeline": "./my_config/table_recognition_v2.yaml",
|
|
|
# "--device": "cpu",
|
|
|
# }
|
|
|
+ demo = {
|
|
|
+ # "--input_file": "/Users/zhch158/workspace/data/至远彩色印刷工业有限公司/2023年度报告母公司.img/2023年度报告母公司_page_006.png",
|
|
|
+ # "--input_file": "/Users/zhch158/workspace/data/至远彩色印刷工业有限公司/2023年度报告母公司.img/2023年度报告母公司_page_003.png",
|
|
|
+ # "--output_dir": "/Users/zhch158/workspace/data/至远彩色印刷工业有限公司/table_recognition_v2_Results",
|
|
|
+ "--input_file": "/Users/zhch158/workspace/data/流水分析/对公_招商银行图/table_recognition_v2_Results/对公_招商银行图/对公_招商银行图_page_001.png",
|
|
|
+ "--output_dir": "/Users/zhch158/workspace/data/流水分析/对公_招商银行图/table_recognition_v2_Results",
|
|
|
+ "--pipeline": "./my_config/table_recognition_v2.yaml",
|
|
|
+ "--device": "cpu",
|
|
|
+ }
|
|
|
|
|
|
sys.argv = [sys.argv[0]] + [kv for kv in sum(demo.items(), ())]
|
|
|
|