# Fine-tunning donut for full table data extraction

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tunning-donut-for-full-table-data-extraction%2F32551%3E%5C
**Category:** Models\
**Created:** [February 26, 2023, 11:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tunning-donut-for-full-table-data-extraction%2F32551 "2023-02-26T11:52:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wyzixg](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@wyzixg](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwyzixg)%5C
**Post date:** [February 26, 2023, 11:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tunning-donut-for-full-table-data-extraction%2F32551%2F1 "2023-02-26T11:52:22Z")

</div>

Hi, is it possible to train donut for table data extraction and if so how would one build the metadata.jsonl gt\_parse to include rowspans and collspans?  
I want to extract all rows / columns of all tables in the image.

For example this table:

 ![maxresdefault](https://us1.discourse-cdn.com/hellohellohello/original/2X/7/773b2d0647f5fb91a04399f86f0e2c981bbe0d82.jpeg)

Is this format allowed or si it a better option to specify if a row/col is spanned over multiple rows/cols?

```auto
{
 table: [
  {
   rows: [
    [
     { 0: 'Day', 1: 'Seminar', 2: 'Seminar', 3: 'Seminar' },
     { 0: 'Day', 1: 'Schedule', 2: 'Schedule', 3: 'Topic' },
     { 0: 'Day', 1: 'Begin', 2: 'End', 3: 'Topic' },
    ],
    [
     { 0: 'Monday', 1: '8:00 a.m.', 2: '5:00 p.m.', 3: 'Introduction to XML' },
     { 0: 'Monday', 1: '8:00 a.m.', 2: '5:00 p.m.', 3: 'Validity DTD and Relax NG' },
    ]
   ],
  },
 ],
...
}

```

Thanks

---

<div class="post-metadata">

**Author:** ![LukSky](https://avatars.discourse-cdn.com/v4/letter/l/d07c76/32.png) [@LukSky](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FLukSky)%5C
**Post date:** [April 12, 2023, 12:40pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tunning-donut-for-full-table-data-extraction%2F32551%2F2 "2023-04-12T12:40:10Z")

</div>

Hi, did you do this model? How it looks like? What is the accurace for tables? I search about it and find that for tables is good to put bounding box with the cell values for donut dataset, but I didnt check it. Maybe you have some expierence right now?

---

<div class="post-metadata">

**Author:** ![wyzixg](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@wyzixg](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwyzixg)%5C
**Post date:** [April 12, 2023, 1:07pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tunning-donut-for-full-table-data-extraction%2F32551%2F3 "2023-04-12T13:07:08Z")

</div>

I’ve done some trials using PubTables-1M using a structure like this:  
{“file\_name”:“PMC1064074\_table\_0.jpg”,“ground\_truth”:"{"gt\_parse":{"cells":[{"row\_0\_col\_0":"Kinetic parameter"},{"row\_0\_col\_1":"ND"},{"row\_0\_col\_2":"D"},{"row\_0\_col\_3":"D + dn-RhoA"},{"row\_0\_col\_4":"D + dn-Rac1"},{"row\_1\_col\_0":"Vmax"},{"row\_1\_col\_1":"19.6 ± 0.75"},{"row\_1\_col\_2":"26.2 ± 0.86\*"},{"row\_1\_col\_3":"31.3 ± 0.88†"},{"row\_1\_col\_4":"21.6 ± 0.9"},{"row\_2\_col\_0":"K’ for H+"},{"row\_2\_col\_1":"0.150 ± 0.02"},{"row\_2\_col\_2":"0.113 ± 0.05†"},{"row\_2\_col\_3":"0.105 ± 0.07†"},{"row\_2\_col\_4":"0.137 ± 0.023"},

It works on images that only contains the table or extracting the tables from the image and running donut only on that, but i’m not happy with the accuracy and i get wrong cell coordinates for tables that contains rowspan or colspan, i’m still working on it…  
Also i only trained it on 10k images, will try training it on full dataset but our GPU’s are busy on another project now…

A friend of mine had better results using pero-ocr, extracting words coordinates and getting the cells col and row by coordinates and building a json.  
It’s still a WIP…

---

<div class="post-metadata">

**Author:** ![ashishu6543](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@ashishu6543](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fashishu6543)%5C
**Post date:** [May 19, 2023, 11:59am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tunning-donut-for-full-table-data-extraction%2F32551%2F4 "2023-05-19T11:59:52Z")

</div>

Did anyone try to do this? I am eager to know if we can create the dataset for full table extraction. If yes then what will be the proper format even if the cells are spanned over multiple columns and rows?
