Image-to-Text
PEFT
Safetensors
Portuguese
English
vision-language
table-extraction
scientific-figures
markdown-table
lightonocr
qwen2.5-vl
qwen3-vl
lora
icdar-metric-loss
Instructions to use lucasoc/sci-image-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use lucasoc/sci-image-models with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-VL-3B-Instruct") model = PeftModel.from_pretrained(base_model, "lucasoc/sci-image-models") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from lucasoc/sci-image-models: direct link, hf CLI and curl.
- Browser
- Download file 6.64 kB
-
https://huggingface.co/lucasoc/sci-image-models/resolve/main/README.md
- Command line
-
hf download hf://lucasoc/sci-image-models/README.md
-
curl -L -o README.md https://huggingface.co/lucasoc/sci-image-models/resolve/main/README.md
6.64 kB
metadata
license: apache-2.0
base_model:
- lightonai/LightOnOCR-3-4B
- Qwen/Qwen2.5-VL-7B-Instruct
- Qwen/Qwen3-VL-8B-Instruct
- Qwen/Qwen2.5-VL-3B-Instruct
library_name: peft
pipeline_tag: image-to-text
tags:
- vision-language
- image-to-text
- table-extraction
- scientific-figures
- markdown-table
- lightonocr
- qwen2.5-vl
- qwen3-vl
- lora
- peft
- icdar-metric-loss
language:
- pt
- en
metrics:
- teds
- cell_precision
- cell_recall
- cell_f1
- valid_table
- icdar_rms
- icdar_score
Sci-Image-Markdown: Extratores Multimodais de Tabelas Científicas (LoRA Adapters)
Coleção oficial de LoRA Adapters de alta precisão desenvolvidos para o framework sci-image-markdown, especializados na transcrição visual direta de figuras científicas densas (espectroscopia, ALD/ALE, isotermas e cinética química) em tabelas estruturadas em formato GitHub-Flavored Markdown.
Treinados com a ICDAR Metric-Aware Loss v3 (Loss balanceada de proximidade numérica suave, penalidade de cardinalidade e ancoragem topológica TEDS).
🏆 Tabela Oficial do Leaderboard ICDAR 2026 (Task 2: Data Table Extraction)
Avaliação rigorosa realizada sobre as 373 figuras científicas reais do conjunto de teste independente oficial do desafio:
| Posição | Modelo / Backbone | Método / Adaptação | Subpasta no Repo | Tabelas Válidas (valid_table) |
RMS Numérico (icdar_rms) |
Estrutura TEDS (teds) |
Score Final ICDAR | Hardware Recomendado |
|---|---|---|---|---|---|---|---|---|
| 🥇 1º | LightOnOCR-3-4B (Novo Recorde) |
LoRA + Loss v3 | lightonocr_3_4b/ |
98.39% | 0.6212 | 0.4252 | 0.5232 🏆 | ~8 GB VRAM |
| 🥈 2º | Qwen2.5-VL-7B |
LoRA + Loss v2 | qwen2_5_vl_7b/ |
99.73% | 0.6026 | 0.4396 | 0.5211 🚀 | ~14 GB VRAM |
| 🥉 3º | Qwen2.5-VL-3B |
LoRA + Loss v1 | root / |
99.73% | 0.5830 | 0.4068 | 0.4949 | < 8 GB VRAM |
| 4º | Qwen3-VL-8B |
LoRA + Loss v3 | qwen3_vl_8b/ |
99.73% | 0.6076 | 0.3668 | 0.4872 | ~16 GB VRAM |
| Ref | 1º Colocado Oficial ICDAR 2026 (Peking) | Ensemble / Multi-VLM | - | ~99.0% | 0.5810 | 0.4552 | 0.5181 | Multi-GPU Cluster |
| Ref | 2º Colocado Oficial ICDAR 2026 (Samsung) | Prompting Especializado | - | ~98.5% | 0.5230 | 0.3972 | 0.4601 | Multi-GPU Cluster |
| Base | Qwen2.5-VL-3B (Zero-Shot) | Sem Treinamento | - | 88.74% | 0.4812 | 0.2316 | 0.3564 | < 8 GB VRAM |
📂 Organização dos Modelos no Repositório
lucasoc/sci-image-models/
├── README.md # Visão geral e leaderboard comparativo
├── adapter_config.json # Adapter Qwen2.5-VL-3B (raiz)
├── adapter_model.safetensors # Pesos LoRA Qwen2.5-VL-3B
├── lightonocr_3_4b/ # 🏆 NOVO RECORDE ABSOLUTO (52.32%)
│ ├── adapter_config.json
│ ├── adapter_model.safetensors # 88 MB
│ ├── test_report.json # Relatório completo de teste
│ └── README.md
├── qwen2_5_vl_7b/ # SOTA Qwen2.5-VL-7B (52.11%)
│ ├── adapter_config.json
│ ├── adapter_model.safetensors # 177 MB
│ ├── test_report.json
│ └── README.md
└── qwen3_vl_8b/ # Qwen3-VL-8B (48.72%)
├── adapter_config.json
├── adapter_model.safetensors # 176 MB
├── test_report.json
└── README.md
🚀 Como Executar Inferência
1. LightOnOCR-3-4B (Novo Campeão Absoluto - 52.32%)
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForCausalLM
from peft import PeftModel
# Carregar processador e base model
processor = AutoProcessor.from_pretrained("lucasoc/sci-image-models", subfolder="lightonocr_3_4b")
base_model = AutoModelForCausalLM.from_pretrained(
"lightonai/LightOnOCR-3-4B",
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "lucasoc/sci-image-models", subfolder="lightonocr_3_4b")
model.eval()
2. Qwen2.5-VL-7B ou Qwen3-VL-8B
import torch
from PIL import Image
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
from peft import PeftModel
from qwen_vl_utils import process_vision_info
# Para Qwen2.5-VL-7B use subfolder="qwen2_5_vl_7b" e base "Qwen/Qwen2.5-VL-7B-Instruct"
# Para Qwen3-VL-8B use subfolder="qwen3_vl_8b" e base "Qwen/Qwen3-VL-8B-Instruct"
subfolder = "qwen2_5_vl_7b"
base_model_name = "Qwen/Qwen2.5-VL-7B-Instruct"
processor = AutoProcessor.from_pretrained("lucasoc/sci-image-models", subfolder=subfolder)
base_model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
base_model_name,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "lucasoc/sci-image-models", subfolder=subfolder)
model.eval()
# Processamento da figura
image = Image.open("exemplo_grafico_cientifico.png").convert("RGB")
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "Extract all numerical data points from this scientific figure into a Markdown table."}
]
}
]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, _ = process_vision_info(messages)
inputs = processor(text=[text], images=image_inputs, return_tensors="pt").to("cuda")
with torch.inference_mode():
outputs = model.generate(**inputs, max_new_tokens=1024)
result = processor.batch_decode(outputs, skip_special_tokens=True)[0]
print(result)
🔬 Evolução das Funções de Perda (Loss Formulation)
- Loss v1 (Token-Weighted Static CE): Ponderação de tokens numéricos (4.0x) e estruturais (3.0x).
- Loss v2 (Float-Proximity & Cardinality Surrogate Loss): Penalidade suave por desvio percentual em números decodificados + multiplicador global de cardinalidade.
- Loss v3 (TEDS Topology & Directional Control): Introdução de penalidade de colunas (
col_count_penalty_weight = 2.0), reforço de cabeçalho (header_weight = 4.5) e terminação antecipada direcional sobre<eos>para evitar sobregeração de linhas vazias. Alcançou o recorde absoluto de 0.5232 com o LightOnOCR-3-4B.
📜 Citação & Repositório Oficial
Repositório completo no GitHub: lucasdocunha/sci-image-markdown