|
|
@@ -200,7 +200,21 @@ class MinerUVLLMProcessor:
|
|
|
# 2. 生成并保存 content_list JSON 文件
|
|
|
content_list = vlm_union_make(pdf_info, MakeMode.CONTENT_LIST, image_dir)
|
|
|
content_list_str = json.dumps(content_list, ensure_ascii=False, indent=2)
|
|
|
-
|
|
|
+ md_writer.write_string(f"{pdf_file_name}_original.json", content_list_str)
|
|
|
+ # 这里需要将middle_json->content_list 中的bbox坐标同比例缩放回去, 不用PDF坐标,使用针对图片坐标
|
|
|
+ # 因为已是单页处理,所以直接用第0页的width,height
|
|
|
+ page_width, page_height = pdf_info[0].get('page_size')
|
|
|
+ for element in content_list:
|
|
|
+ if "bbox" in element:
|
|
|
+ x0, y0, x1, y1 = element["bbox"]
|
|
|
+ element["bbox"] = [
|
|
|
+ int(x0 / 1000 * page_width),
|
|
|
+ int(y0 / 1000 * page_height),
|
|
|
+ int(x1 / 1000 * page_width),
|
|
|
+ int(y1 / 1000 * page_height),
|
|
|
+ ]
|
|
|
+ content_list_str = json.dumps(content_list, ensure_ascii=False, indent=2)
|
|
|
+
|
|
|
# 数字标准化处理
|
|
|
if self.normalize_numbers:
|
|
|
original_json = content_list_str
|
|
|
@@ -624,7 +638,7 @@ if __name__ == "__main__":
|
|
|
# 默认配置
|
|
|
default_config = {
|
|
|
# "input_file": "/home/ubuntu/zhch/data/至远彩色印刷工业有限公司/2023年度报告母公司.img/2023年度报告母公司_page_003.png",
|
|
|
- "inout_dir": "/Users/zhch158/workspace/data/流水分析/B用户_扫描流水.img",
|
|
|
+ "input_dir": "/Users/zhch158/workspace/data/流水分析/B用户_扫描流水.img",
|
|
|
"output_dir": "/Users/zhch158/workspace/data/流水分析/B用户_扫描流水/mineru-vlm-2.5.3_Results",
|
|
|
# "collect_results": f"./output/processed_files_{time.strftime('%Y%m%d_%H%M%S')}.csv",
|
|
|
"server_url": "http://10.192.72.11:8121",
|