Add model description, how to use, how trained, how to fine tune
Browse files
README.md
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 model has been trained on detecting cells from tables. Note, that the datasets contains tables only. Therefore, it is required to perform a table detection task before
|
17 |
+
detecting cells.
|
18 |
+
|
19 |
+
The code has been adapted so that it can be used in a **deep**doctection pipeline.
|
20 |
+
|
21 |
+
## How this model can be used
|
22 |
+
|
23 |
+
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.
|
24 |
+
|
25 |
+
## How this model was trained.
|
26 |
+
|
27 |
+
To recreate the model run on the **deep**doctection framework, run:
|
28 |
+
|
29 |
+
```python
|
30 |
+
|
31 |
+
>>> import os
|
32 |
+
>>> from deep_doctection.datasets import DatasetRegistry
|
33 |
+
>>> from deep_doctection.eval import MetricRegistry
|
34 |
+
>>> from deep_doctection.utils import get_configs_dir_path
|
35 |
+
>>> from deep_doctection.train import train_faster_rcnn
|
36 |
+
|
37 |
+
pubtabnet = DatasetRegistry.get_dataset("pubtabnet")
|
38 |
+
pubtabnet.dataflow.categories.filter_categories(categories="CELL")
|
39 |
+
|
40 |
+
path_config_yaml=os.path.join(get_configs_dir_path(),"tp/cell/conf_frcnn_cell.yaml")
|
41 |
+
path_weights = ""
|
42 |
+
|
43 |
+
dataset_train = pubtabnet
|
44 |
+
config_overwrite=["TRAIN.STEPS_PER_EPOCH=500","TRAIN.STARTING_EPOCH=1",
|
45 |
+
"TRAIN.CHECKPOINT_PERIOD=50","BACKBONE.FREEZE_AT=0", "PREPROC.TRAIN_SHORT_EDGE_SIZE=[200,600]"]
|
46 |
+
build_train_config=["max_datapoints=500000"]
|
47 |
+
dataset_val = pubtabnet
|
48 |
+
build_val_config = ["max_datapoints=4000"]
|
49 |
+
|
50 |
+
coco_metric = MetricRegistry.get_metric("coco")
|
51 |
+
coco_metric.set_params(max_detections=[50,200,600], area_range=[[0,1000000],[0,200],[200,800],[800,1000000]])
|
52 |
+
|
53 |
+
train_faster_rcnn(path_config_yaml=path_config_yaml,
|
54 |
+
dataset_train=dataset_train,
|
55 |
+
path_weights=path_weights,
|
56 |
+
config_overwrite=config_overwrite,
|
57 |
+
log_dir="/path/to/dir",
|
58 |
+
build_train_config=build_train_config,
|
59 |
+
dataset_val=dataset_val,
|
60 |
+
build_val_config=build_val_config,
|
61 |
+
metric=coco_metric,
|
62 |
+
pipeline_component_name="ImageLayoutService"
|
63 |
+
)
|
64 |
+
```
|
65 |
+
|
66 |
+
## How to fine-tune this model
|
67 |
+
|
68 |
+
To fine tune this model, please check this [Fine-tune](https://github.com/deepdoctection/deepdoctection/blob/master/notebooks/Fine_Tune.ipynb) tutorial.
|