Implementation:Open compass VLMEvalKit Physics Utils
| Field | Value |
|---|---|
| source | VLMEvalKit |
| domain | Vision, Evaluation, Physics, LaTeX Answer Extraction |
Overview
Provides physics question evaluation utilities with LaTeX boxed-answer extraction and symbolic equivalence checking.
Description
This module implements `build_physic_prompt` which constructs detailed physics problem prompts requiring answers in `\boxed{}` format. The `PHYSIC_auxeval` function evaluates physics answers by extracting boxed content from model responses using `extract_final_answer_allform`, then checking equivalence against ground truth via direct matching, symbolic comparison using sympy's `simplify`/`expand`/`trigsimp`, and LaTeX parsing. It supports both text and mathematical answers.
Usage
Called internally by the corresponding dataset class during evaluation.
Code Reference
- Source:
vlmeval/dataset/utils/physic.py, Lines: L1-103 - Import:
from vlmeval.dataset.utils.physic import build_physic_prompt, PHYSIC_auxeval
Key Functions:
def build_physic_prompt(line): ...
def PHYSIC_auxeval(model, line): ...
I/O Contract
| Direction | Description |
|---|---|
| Inputs | A data line dict with 'question', 'prediction', and 'answer' fields |
| Outputs | Dict with 'log' (evaluation trace) and 'res' (boolean equivalence result) |
Usage Examples
from vlmeval.dataset.utils.physic import PHYSIC_auxeval
result = PHYSIC_auxeval(model, line)