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>"
9url = "https://huggingface.co/yifeihu/TF-ID-base/resolve/main/arxiv_2305_10853_5.png?download=true"
10image = Image.open(requests.get(url, stream=True).raw)
11
12inputs = processor(text=prompt, images=image, return_tensors="pt")
13generated_ids = model.generate(
14 input_ids=inputs["input_ids"],
15 pixel_values=inputs["pixel_values"],
16 max_new_tokens=1024,
17 do_sample=False,
18 num_beams=3
19)
20
21generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
22parsed_answer = processor.post_process_generation(generated_text, task="<OD>", image_size=(image.width, image.height))
23
24print(parsed_answer)@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}},
}