JaMe76 commited on
Commit
051e06e
1 Parent(s): f209138

Model, how to use, how to train, how to fine tune

Browse files
Files changed (1) hide show
  1. README.md +61 -0
README.md CHANGED
@@ -1,3 +1,64 @@
1
  ---
 
 
2
  license: apache-2.0
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ tags:
3
+ - Tensorflow
4
  license: apache-2.0
5
+ datasets:
6
+ - Pubtabnet
7
  ---
8
+
9
+
10
+ # Tensorpacks Cascade-RCNN with FPN and Group Normalization on ResNext32xd4-50 trained on Pubtabnet for Semantic Segmentation of tables.
11
+
12
+ The model and its training code has been mainly taken from: [Tensorpack](https://github.com/tensorpack/tensorpack/tree/master/examples/FasterRCNN) .
13
+
14
+ Regarding the dataset, please check: [Xu Zhong et. all. - Image-based table recognition: data, model, and evaluation](https://arxiv.org/abs/1911.10683).
15
+
16
+ The code has been adapted so that it can be used in a **deep**doctection pipeline.
17
+
18
+ ## How this model can be used
19
+
20
+ This model can be used with the **deep**doctection in a full pipeline, along with table recognition and OCR. Check the general instruction following this [Get_started](https://github.com/deepdoctection/deepdoctection/blob/master/notebooks/Get_Started.ipynb) tutorial.
21
+
22
+ ## How this model was trained.
23
+
24
+ To recreate the model run on the **deep**doctection framework, run:
25
+
26
+ ```python
27
+ >>> import os
28
+ >>> from deep_doctection.datasets import DatasetRegistry
29
+ >>> from deep_doctection.eval import MetricRegistry
30
+ >>> from deep_doctection.utils import get_configs_dir_path
31
+ >>> from deep_doctection.train import train_faster_rcnn
32
+
33
+ pubtabnet = DatasetRegistry.get_dataset("pubtabnet")
34
+ pubtabnet.dataflow.categories.set_cat_to_sub_cat({"ITEM":"row_col"})
35
+ pubtabnet.dataflow.categories.filter_categories(categories=["ROW","COLUMN"])
36
+
37
+ path_config_yaml=os.path.join(get_configs_dir_path(),"tp/rows/conf_frcnn_rows.yaml")
38
+ path_weights = ""
39
+ dataset_train = pubtabnet
40
+
41
+ config_overwrite=["TRAIN.STEPS_PER_EPOCH=500","TRAIN.STARTING_EPOCH=1", "TRAIN.CHECKPOINT_PERIOD=50"]
42
+ build_train_config=["max_datapoints=500000","rows_and_cols=True"]
43
+ dataset_val = pubtabnet
44
+ build_val_config = ["max_datapoints=2000","rows_and_cols=True"]
45
+
46
+ coco_metric = MetricRegistry.get_metric("coco")
47
+ coco_metric.set_params(max_detections=[50,200,600], area_range=[[0,1000000],[0,200],[200,800],[800,1000000]])
48
+
49
+ train_faster_rcnn(path_config_yaml=path_config_yaml,
50
+ dataset_train=dataset_train,
51
+ path_weights=path_weights,
52
+ config_overwrite=config_overwrite,
53
+ log_dir="/path/to/dir",
54
+ build_train_config=build_train_config,
55
+ dataset_val=dataset_val,
56
+ build_val_config=build_val_config,
57
+ metric=coco_metric,
58
+ pipeline_component_name="ImageLayoutService"
59
+ )
60
+ ```
61
+
62
+ ## How to fine-tune this model
63
+
64
+ To fine tune this model, please check this [Fine-tune](https://github.com/deepdoctection/deepdoctection/blob/master/notebooks/Fine_Tune.ipynb) tutorial.