Colab notebook: https://colab.research.google.com/drive/1Y8GVjwzBIgfmfD3ZypDX5H1JA_VG0YDL?usp=sharing
Finetuned model: ucsahin/Florence-2-large-TableDetection
Join the community of Machine Learners and AI enthusiasts.
Sign UpHi @ucsahin I think it would be great to add the multi-class scenario which current is only accepting one class which is table.
To enable multi-class you can simply change
for (cat, bbox) in zip(categories, bboxes):
bbox_str += f"{class_list[cat]}"
bbox = bbox.copy()
Thank you for clarifying and sharing the update to the code. I have also added a discussion to the Colab notebook for multi-class object detection.
Hi
@ucsahin
,
Thank you for sharing this, I had a question, I am trying to use this model for detecting tables in a document, I have observed that when there are no tables on a page, the model tries to predict tables there too, how can I work around this? Is there any confidence threshold that I can limit?
Thanks for your comment. Did you check if the model prediction actually resembles a table area (such as text and figure regions that are separated from the dense text area)? I cannot really tell without seeing what kind of documents you are working with. Please also note that although the fine-tuned model's performance is good in table detection (in my own experiments), it can still be further improved by training with a more comprehensive table detection dataset. What I suggest is as follows:
temperature
, top_p
, top_k
. You can also use beam search instead of the standard greedy decoding.Also, if your primary concern is to detect table regions (without doing anything with the table content like VQA, OCR, or information extraction), I suggest you check out table transformer models, which can detect table bounding boxes and recognize table structures. They also generate confidence scores for each of their predictions so that you can have more control over the desired output.