Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
pipeline_tag: object-detection
|
| 4 |
+
tags:
|
| 5 |
+
- table-detection
|
| 6 |
+
- spreadsheets
|
| 7 |
+
- object-detection
|
| 8 |
+
- faster-rcnn
|
| 9 |
+
- pytorch
|
| 10 |
---
|
| 11 |
+
|
| 12 |
+
# ExcelTableCNN: VEnron2 table detector
|
| 13 |
+
|
| 14 |
+
A Faster R-CNN table-boundary detector for spreadsheets, from
|
| 15 |
+
[ExcelTableCNN](https://github.com/Flagro/ExcelTableCNN), a license-clean
|
| 16 |
+
reimplementation of the TableSense approach. Given a sheet's cell grid it
|
| 17 |
+
predicts a bounding box (cell range) for each table, with PBR boundary snapping
|
| 18 |
+
and a grid-context backbone.
|
| 19 |
+
|
| 20 |
+
- Input: 30 per-cell feature channels, built by the package from `.xls`/`.xlsx`.
|
| 21 |
+
- Output: table bounding boxes as cell ranges, each with a confidence score.
|
| 22 |
+
- Weights: `final.pt` (about 201 MB), trained 160 epochs on the full VEnron2 set.
|
| 23 |
+
|
| 24 |
+
## Metrics
|
| 25 |
+
|
| 26 |
+
Evaluated on the held-out VEnron2 test split (197 sheets, 342 tables) at score
|
| 27 |
+
threshold 0.5, using the strict Error-of-Boundary metric (EoB-0 = cell-exact,
|
| 28 |
+
EoB-2 = within 2 cells):
|
| 29 |
+
|
| 30 |
+
| Metric | Precision | Recall |
|
| 31 |
+
|---|---|---|
|
| 32 |
+
| EoB-0 (exact) | 47.7% | 48.2% |
|
| 33 |
+
| EoB-2 (within 2 cells) | 66.5% | 67.3% |
|
| 34 |
+
|
| 35 |
+
The reloaded checkpoint reproduces these numbers exactly (RoI pooling scale
|
| 36 |
+
pinned to 1.0, see PR #8). For reference, the TableSense paper reports EoB-2
|
| 37 |
+
precision 86.5% / recall 91.3%, trained on about 25x more hand-labeled sheets.
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
Install the package (it handles featurization and decoding):
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
pip install git+https://github.com/Flagro/ExcelTableCNN.git
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Download the weights and detect tables from the command line:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
huggingface-cli download flagro/exceltablecnn-venron2 final.pt --local-dir .
|
| 51 |
+
excel-table-cnn-detect report.xls --weights final.pt
|
| 52 |
+
# Sheet1!B2:H45 score=0.973
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
Or from Python:
|
| 56 |
+
|
| 57 |
+
```python
|
| 58 |
+
from huggingface_hub import hf_hub_download
|
| 59 |
+
from excel_table_cnn import load_checkpoint
|
| 60 |
+
|
| 61 |
+
path = hf_hub_download("flagro/exceltablecnn-venron2", "final.pt")
|
| 62 |
+
model = load_checkpoint(path, device="cpu") # or "cuda"
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## Training
|
| 66 |
+
|
| 67 |
+
- Data: VEnron2, 1,288 training sheets, via the ExcelTableCNN pipeline.
|
| 68 |
+
- Schedule: 160 epochs, batch size 1, SGD (lr 0.005, momentum 0.9, weight decay
|
| 69 |
+
5e-4), 100-step warmup, constant LR, mixed precision.
|
| 70 |
+
- Featurization caps: default 2,048 x 512 cells. Seed 42.
|
| 71 |
+
- Hardware: single NVIDIA T4 (Kaggle), about 4 hours.
|
| 72 |
+
- Architecture: 30-channel input, grid-context backbone (stride 1), Faster
|
| 73 |
+
R-CNN detection head, PBR boundary-snapping head, 2 classes (table vs
|
| 74 |
+
background).
|
| 75 |
+
- Code: excel-table-cnn 0.3.0, commit `0ed4205`.
|
| 76 |
+
|
| 77 |
+
## Limitations
|
| 78 |
+
|
| 79 |
+
- Trained only on VEnron2 (Enron-derived financial and operational
|
| 80 |
+
spreadsheets); expect lower accuracy on very different domains or layouts.
|
| 81 |
+
- Cell-exact (EoB-0) detection is still under 50%; boundaries are often off by 1
|
| 82 |
+
to 2 cells, which is why EoB-2 is much higher. Use EoB-2 for downstream
|
| 83 |
+
extraction that tolerates small boundary error.
|
| 84 |
+
- Sheets larger than 2,048 x 512 cells are clipped during featurization.
|
| 85 |
+
|
| 86 |
+
## License and data
|
| 87 |
+
|
| 88 |
+
Code and weights are MIT-licensed (see the
|
| 89 |
+
[repository](https://github.com/Flagro/ExcelTableCNN)). The training data is the
|
| 90 |
+
public VEnron2 corpus, derived from the Enron email dataset; confirm its terms
|
| 91 |
+
permit your intended redistribution or use.
|
| 92 |
+
|
| 93 |
+
## Citation
|
| 94 |
+
|
| 95 |
+
Built on the method from TableSense (Dong et al., AAAI 2019). Please cite the
|
| 96 |
+
original paper for the approach and link this repository for the implementation.
|