From 24046b07d63d5f325a64b31144f5fd6cbfd4175c Mon Sep 17 00:00:00 2001 From: candyhong <1102229410@qq.com> Date: Mon, 4 Nov 2024 17:28:47 +0800 Subject: [PATCH] update doc about table model --- configs/table/README.md | 2 +- tools/infer/text/README.md | 85 +++++++++++++++++++++++++++++++++++ tools/infer/text/README_CN.md | 85 +++++++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 1 deletion(-) diff --git a/configs/table/README.md b/configs/table/README.md index 072cb65bc..ff75ee570 100644 --- a/configs/table/README.md +++ b/configs/table/README.md @@ -75,7 +75,7 @@ PubTabNet ``` -### 3.3 配置说明 +### 3.3 Configuration Description Update `configs/table/table_master.yaml`configuration file with data paths, specifically`dataset_root` is the directory of training set images folder, `label_file_list` is a list of training set annotation file path, and it may include multiple annotation file paths. diff --git a/tools/infer/text/README.md b/tools/infer/text/README.md index 35a410e14..2ed99a9e4 100644 --- a/tools/infer/text/README.md +++ b/tools/infer/text/README.md @@ -238,6 +238,91 @@ Evaluation of the text spotting inference results on Ascend 910 with MindSpore 2 2. Unless extra inidication, all experiments are run with `--det_limit_type`="min" and `--det_limit_side`=720. 3. SVTR is run in mixed precision mode (amp_level=O2) since it is optimized for O2. +## Table Structure Recognition + +To run table structure recognition on an input image or multiple images in a directory, please run: + +```shell +python tools/infer/text/predict_structure.py --image_dir {path_to_img or dir_to_imgs} --table_algorithm TABLE_MASTER +``` + +After running, the inference results will be saved in `{args.draw_img_save_dir}`, where `--draw_img_save_dir` is the directory for saving results and is set to `./inference_results` by default. Here are some results for examples. + +Example 1: +
+
+
+ example_structure.png +
+ +**Notes:** +1. For more argument illustrations and usage, please run `python tools/infer/text/predict_structure.py -h` or view `tools/infer/text/config.py` + +### Supported Table Recognition Algorithms and Networks + +
+
+
+ example_structure.png +
+ +, where the saved csv file is as follows +```txt +Parameter,Non-smokers Mean± SD or N (3),Smokers Mean ± SD or N (C) +N,24, +Age (y),69.1 ± 7.0,61.5 ± 9.3 + +Males/Females,24/0,11/0 +Race White/Black,19/5,9/2 +Weight (kg),97.8 ± 16.8,102.5 ± 23.4 +BMII (kg/m*),32.6 ± 4.9,32.6 ± 6.6 +Serum albumin (g/dL),3.8 ± 0.33,3.63 ± 0.30 +Serum Creatinine (mg/dL),2.75 ± 1.21,1.80 ± 0.74 * +BUN (mg/dL),46.5 ± 25.6,38.3 ± 21.8 +Hemoglobin (g/dL),13.3 ± 1.6,13.5 ± 2.4 +24 hour urine protein (g/d),3393 ± 2522,4423 ± 4385 +lathae)mm,28.9 ± 13.8,47.2 ± 34.8 * +Duration of diabetes (yr),15.7 ± 9.1,13.3 ± 9.0 +Insulin use,15 (63%),6 (55%) +"Hemoglobin A, C (%)",7.57 ± 2.02,8.98 ± 2.93 +Waist/Hip Ratio,1.00 ± 0.07,1.04 ± 0.07 +Antihypertensive medications,4.3 ± 1.6,3.9 ± 1.9 +A,21 (88%),8 (73%) +Total Cholesterol (mg/dL),184 ± 51,223 ± 87 +LDL Cholesterol (mg/dL),100 ± 44,116 ± 24 +HDL Cholesterol (mg/dL),42 ± 11.1,46 ± 11.4 +,17 (71%),7 (64%) + +``` + +**Notes:** +1. For more argument illustrations and usage, please run `python tools/infer/text/predict_table.py -h` or view `tools/infer/text/config.py` + ## Argument List All CLI argument definition can be viewed via `python tools/infer/text/predict_system.py -h` or reading `tools/infer/text/config.py`. diff --git a/tools/infer/text/README_CN.md b/tools/infer/text/README_CN.md index 370032c80..8cd915bf8 100644 --- a/tools/infer/text/README_CN.md +++ b/tools/infer/text/README_CN.md @@ -230,6 +230,91 @@ python deploy/eval_utils/eval_pipeline.py --gt_path path/to/gt.txt --pred_path p 3、SVTR在混合精度模式下运行(amp_level=O2),因为它针对O2进行了优化。 +## 表格结构识别 + +要对输入图像或包含多个图像的目录运行表格结构识别,请执行 +```shell +python tools/infer/text/predict_structure.py --image_dir {path_to_img or dir_to_imgs} --table_algorithm TABLE_MASTER +``` + +运行后,推理结果保存在`{args.draw_img_save_dir}`中,其中`--draw_img_save_dir`是保存结果的目录,这是`./inference_results`的默认设置,这里是一些示例结果。 + +示例1: +
+
+
+ example_structure.png +
+ +**注意事项:** +- 有关更多参数说明和用法,请运行`python tools/infer/text/predict_structure.py -h`或查看`tools/infer/text/config.py` + +### 支持的表格识别算法和网络 + +
+
+
+ example_structure.png +
+ +其中恢复的csv文件内容如下 +```txt +Parameter,Non-smokers Mean± SD or N (3),Smokers Mean ± SD or N (C) +N,24, +Age (y),69.1 ± 7.0,61.5 ± 9.3 + +Males/Females,24/0,11/0 +Race White/Black,19/5,9/2 +Weight (kg),97.8 ± 16.8,102.5 ± 23.4 +BMII (kg/m*),32.6 ± 4.9,32.6 ± 6.6 +Serum albumin (g/dL),3.8 ± 0.33,3.63 ± 0.30 +Serum Creatinine (mg/dL),2.75 ± 1.21,1.80 ± 0.74 * +BUN (mg/dL),46.5 ± 25.6,38.3 ± 21.8 +Hemoglobin (g/dL),13.3 ± 1.6,13.5 ± 2.4 +24 hour urine protein (g/d),3393 ± 2522,4423 ± 4385 +lathae)mm,28.9 ± 13.8,47.2 ± 34.8 * +Duration of diabetes (yr),15.7 ± 9.1,13.3 ± 9.0 +Insulin use,15 (63%),6 (55%) +"Hemoglobin A, C (%)",7.57 ± 2.02,8.98 ± 2.93 +Waist/Hip Ratio,1.00 ± 0.07,1.04 ± 0.07 +Antihypertensive medications,4.3 ± 1.6,3.9 ± 1.9 +A,21 (88%),8 (73%) +Total Cholesterol (mg/dL),184 ± 51,223 ± 87 +LDL Cholesterol (mg/dL),100 ± 44,116 ± 24 +HDL Cholesterol (mg/dL),42 ± 11.1,46 ± 11.4 +,17 (71%),7 (64%) + +``` + +**注意事项:** +1、如需更多参数说明和用法,请运行`python tools/infer/text/predict_table.py -h`或查看`tools/infer/text/config.py` + ## 参数列表 所有CLI参数定义都可以通过`python tools/infer/text/predict_system.py -h`或`tools/infer/text/config.py`查看。