HGTasd's picture
Initial clean release
ec21fa4 verified
# PosterEval Evaluation Code
This package provides the metric code for evaluating generated academic
posters. It is organized as a small evaluation toolkit: prepare optional inputs,
generate IR when needed, and compute metrics.
## What Is Included
- PPTX structural metrics: `Ove`, `Ali`, `Ofl`
- IR generation from poster images
- IR-based content metrics: `Order`, `Completeness`, `LTA`, `Claim F1`
- OpenRouter-compatible VLM/LLM interface
- Public prompt files and one semantic-metric example config
## Metric Inputs
```text
PPTX
-> evaluate_structural_pptx.py
-> Ove / Ali / Ofl
poster image
-> prepare_ir.py --parser content
-> Order / Completeness / Claim F1
-> prepare_ir.py --parser figure
-> LTA
```
`content` and `figure` are intentionally separate IR parsers. The first focuses
on section roles, OCR text, and atomic claims. The second focuses on tighter
figure grounding for text-figure alignment. The exact prompts are under
`prompts/`.
## Metric Protocol
Structural metrics are computed directly from PPTX geometry:
- `Ofl`: total out-of-canvas shape area divided by canvas area, over all shapes.
- `Ali`: six-axis nearest-anchor alignment loss over valid visible shapes.
- `Ove`: mean IoU over valid visible shape pairs after dropping empty
`Rectangle` / `Rounded Rectangle` background containers and skipping
containment pairs where `intersection / min(area_i, area_j) >= 0.9`.
The valid-visible threshold is `0.1%` of canvas area. Container filtering is
applied to `Ove` only; `Ali` and `Ofl` keep the direct PPTX shape set.
Semantic metrics use two IR files per poster:
- content IR: `Order`, `Completeness`, and `Claim F1`
- figure IR plus poster image: `LTA`
The default Claim F1 policy is
`strict_v2_t05_subset_numeric_one_side85`: LLM pair scores, threshold `0.5`,
greedy one-to-one matching, 1% subset numeric consistency, and a one-side-only
numeric high-score waiver at `0.85`. The empty-claim fallback follows the local
evaluator used for the reported runs: both empty lists score `P=R=1`, empty
generated claims score `P=1,R=0`, and empty reference claims score `P=R=1`.
Reported benchmark IR records use non-empty reference claim lists; the fallback
is retained for compatibility.
## Installation
```bash
python3 -m pip install -r requirements.txt
```
Optional dependencies:
- LibreOffice, only if using `prepare_pptx_autofit.py`.
- A local Qwen3-VL-Embedding-2B checkpoint for LTA. This package includes the
lightweight wrapper `qwen3_vl_embedding.py`; download the model with:
```bash
python3 download_qwen3_vl_embedding.py
```
## OpenRouter
IR parsing and Claim F1 use an OpenAI-compatible OpenRouter endpoint.
```bash
export OPENROUTER_API_KEY=<your_key>
export OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
export POSTEREVAL_LLM_CACHE_DIR=.cache/postereval_llm
```
The default model alias is:
```text
qwen3-vl-235b -> qwen/qwen3-vl-235b-a22b-instruct
```
## Data Layout
For PPTX metrics, each method root should contain one directory per poster:
```text
<METHOD_ROOT>/
sample_001/
poster.pptx
sample_002/
poster.pptx
```
For IR generation, each image root should contain one directory per poster:
```text
<IMAGE_ROOT>/
sample_001/
poster.png
sample_002/
poster.png
```
Flat image roots are also supported with `prepare_ir.py --layout flat`.
## Commands
Structural metrics:
```bash
python3 evaluate_structural_pptx.py \
--pptx-root /path/to/pptx_root \
--output-dir outputs/structural \
--pptx-filename poster.pptx \
--workers 8
```
Structural metrics can be computed directly from a PPTX root; no config file is
required for the common single-root case.
Optional PPTX autofit materialization:
```bash
python3 prepare_pptx_autofit.py \
--src-root /path/to/input_pptx_root \
--dst-root /path/to/output_pptx_root \
--pptx-name poster.pptx
```
IR generation:
```bash
python3 prepare_ir.py \
--input-root /path/to/poster_image_root \
--output-root outputs/ir/method_a \
--parser both \
--layout directories \
--temperature 0.02 \
--workers 8
```
Content metrics:
```bash
python3 evaluate_semantic_ir.py \
--config configs/semantic_ir.example.json \
--output-dir outputs/semantic
```
By default, outputs do not include absolute input paths. Add `--include-paths`
only for local debugging.
## Outputs
Metric scripts write:
- `summary.md`
- `summary.json`
- `per_paper.csv`
- `per_paper.json`
`prepare_ir.py` writes:
- `content_ir/<sample>/poster_ir.json`
- `figure_ir/<sample>/poster_ir.json`
- `summary.json`
## Notes
This package contains code, prompts, and an example semantic config only. It does not
include datasets, generated posters, rendered images, paper PDFs, API keys, or
local runtime artifacts.