Views
No views yet
| Model | Model size | Model Description |
|---|---|---|
| TF-ID-base[HF] | 0.23B | Extract tables/figures and their caption text |
| TF-ID-large[HF] (Recommended) | 0.77B | Extract tables/figures and their caption text |
| TF-ID-base-no-caption[HF] | 0.23B | Extract tables/figures without caption text |
| TF-ID-large-no-caption[HF] (Recommended) | 0.77B | Extract tables/figures without caption text |
| All TF-ID models are finetuned from microsoft/Florence-2 checkpoints. |

| Model | Total Images | Correct Output | Success Rate |
|---|---|---|---|
| TF-ID-base-no-caption[HF] | 261 | 253 | 96.93% |
| TF-ID-large-no-caption[HF] | 261 | 254 | 97.32% |
1import requests
2from PIL import Image
3from transformers import AutoProcessor, AutoModelForCausalLM
4
5model = AutoModelForCausalLM.from_pretrained("yifeihu/TF-ID-base", trust_remote_code=True)
6processor = AutoProcessor.from_pretrained("yifeihu/TF-ID-base", trust_remote_code=True)
7
8prompt = "<OD>"
9
10url = "https://huggingface.co/yifeihu/TF-ID-base/resolve/main/arxiv_2305_10853_5.png?download=true"
11image = Image.open(requests.get(url, stream=True).raw)
12
13inputs = processor(text=prompt, images=image, return_tensors="pt")
14
15generated_ids = model.generate(
16 input_ids=inputs["input_ids"],
17 pixel_values=inputs["pixel_values"],
18 max_new_tokens=1024,
19 do_sample=False,
20 num_beams=3
21)
22generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
23
24parsed_answer = processor.post_process_generation(generated_text, task="<OD>", image_size=(image.width, image.height))
25
26print(parsed_answer)
27@misc{TF-ID,
author = {Yifei Hu},
title = {TF-ID: Table/Figure IDentifier for academic papers},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/ai8hyf/TF-ID}},
}