microsoft / table-transformer

Table Transformer (TATR) is a deep learning model for extracting tables from unstructured documents (PDFs and images). This is also the official repository for the PubTables-1M dataset and GriTS evaluation metric.
MIT License
2.02k stars 232 forks source link

Fine-tuning dataset size #108

Open bely66 opened 1 year ago

bely66 commented 1 year ago

Hi Everyone, I'm trying to use the pretrained weights of PubTabNet 1M, to fine-tune on my own data.

As you know transformers are data hungry but I'd expect the need for huge amounts of data will be less in fine-tuning.

Any idea about the size of data needed for fine-tuning? will 1k images be enough?

bely66 commented 1 year ago

@bsmock Would it be hard to get your opinion on that?

IrfanSk-AI commented 1 year ago

Hi @bsmock, i am fine tuning on 500k sample dataset for table detection. I'm not getting very accurate results. I would like top know what size of the dataset is sufficient for fine tuning the model for both table detection and table structure recognition. can share your thoughts on this?

bsmock commented 1 year ago

@IrfanSk-AI PubTables-1M contains 500k samples (page images) for detection. 500k is enough to train from scratch if your data is high-quality. Could there be a data quality issue?

@bely66 1k could be enough for either detection or structure recognition. The number you need depends on a lot of factors, such as how similar the tables are to tables in PubTables-1M, whether the bounding boxes are annotated consistently, how similar the tables in your data are to each other, etc.

bely66 commented 1 year ago

@bsmock Thanks for your reply Mostly the data are very close to each other, at this stage, I'm training around 400 image The table format and color are very close, the only variation is in the table size and content.

I'm getting a relatively low scores on the dataset AP50: 0.794, AP75: 0.458, AP: 0.472, AR: 0.627

And It's not obvious why this is happening

Also I wanted to ask what's the recommended amount of epochs and hyper-parameter optimization for fine-tuning?

Thanks again

thiagodma commented 1 year ago

Hey @bely66 , could you share what were your parameters for the fine-tuning? Number of epochs and learning rate are parameters that usually you don't want to set too high when fine-tuning so that the model doesn't 'forget' what it saw while pre-training.

bely66 commented 1 year ago

I used the default parameter in structure_config

What would be the recommended weights?

thiagodma commented 1 year ago

As you're training with few data (400 samples) probably it is ok for you to make some experiments but I would start changing just the learning rate and the number of epochs. Try something like a learning rate 40x smaller than the one used on pre-training and 5 epochs. If you think the model is taking to long to converge, increase a bit the learning rate and so on

veyyil commented 1 year ago

Can any of you share any alternate links to the pretrained pubtables weights (pubtables1m_detection_detr_r18.pth) for both detection and TSR? The links in the readme are not working and have been waiting for it since 2 weeks now. Thanks in advance!

WalidHadri-Iron commented 1 year ago

Can any of you share any alternate links to the pretrained pubtables weights (pubtables1m_detection_detr_r18.pth) for both detection and TSR? The links in the readme are not working and have been waiting for it since 2 weeks now. Thanks in advance!

Just shared them here https://github.com/microsoft/table-transformer/issues/116

tzktok commented 1 month ago

@bsmock Thanks for your reply Mostly the data are very close to each other, at this stage, I'm training around 400 image The table format and color are very close, the only variation is in the table size and content.

I'm getting a relatively low scores on the dataset AP50: 0.794, AP75: 0.458, AP: 0.472, AR: 0.627

And It's not obvious why this is happening

Also I wanted to ask what's the recommended amount of epochs and hyper-parameter optimization for fine-tuning?

Thanks again

can u pls help me on this #181 ... @bely66 @thiagodma