BEAR-benchmark / README.md
yqi19's picture
Add dataset-card YAML header
dbecb6d verified
|
Raw
History Blame Contribute Delete
7.25 kB
metadata
license: cc-by-4.0
pretty_name: BEAR Benchmark
language:
  - en
task_categories:
  - visual-question-answering
  - video-text-to-text
tags:
  - embodied-ai
  - video-understanding
  - spatial-reasoning
  - robotics
  - vlm-evaluation
  - benchmark
size_categories:
  - 1K<n<10K

BEAR Benchmark

Data + runnable evaluation code for the BEAR benchmark.

Each task folder holds its data (*.json + images/videos) and a run.sh. The shared runners and util/ live at the repository root. You run in two steps:

  1. Inference — a VLM answers every question → produces a final_*.json.
  2. Scoringeval.py uses a GPT judge (for multiple-choice) or geometry (for pointing/bbox) to grade those replies and print the final accuracy.

1. Setup

pip install -r requirements.txt

# API keys (set the ones you need)
export OPENAI_API_KEY=sk-...        # OpenAI (gpt-* models) AND the eval judge
export GEMINI_API_KEY=...           # Google Gemini   (or GOOGLE_API_KEY)
export ANTHROPIC_API_KEY=...        # Anthropic Claude

eval.py always needs OPENAI_API_KEY (the multiple-choice judge calls an OpenAI model).


2. Run inference

From inside any task folder, run its run.sh:

bash run.sh <series> <model_name>

<series> selects the backend:

series backend script
gpt OpenAI API run_api_model.py
gemini Google API run_api_model.py
claude Anthropic API run_api_model.py
image local VLM via VLMEvalKit run_image_model.py

Examples:

cd task_planning
bash run.sh gpt    gpt-4o                       # OpenAI
bash run.sh gemini gemini-2.5-pro               # Gemini
bash run.sh claude claude-sonnet-4-20250514     # Claude
bash run.sh image  llava_next                   # local model (needs vlmeval)

This writes one final_<model>_evaluate_<task>.json per JSON in the folder. Input modality (single image / interleaved video+image / video) is auto-detected per item from its category, so the same command works in every task folder.

You can also call a runner directly:

cd spatial_reasoning
python ../run_api_model.py --model_name gpt-4o --model_series gpt \
       --input_json_path relative_direction_official.json \
       --evaluate_output_category relative_direction

Local models without VLMEvalKit (e.g. Cosmos)

run_image_model.py depends on VLMEvalKit. To evaluate a local model without it, use run_custom_model.py with a small adapter from bear_models.py. An adapter is just a class with generate(self, text, images) -> str; the runner samples video frames and passes them as a list of PIL images (single image for image tasks; 16 frames for video; 16 frames + observation for interleaved).

pip install "transformers>=4.51" accelerate torchvision    # for Cosmos / Qwen-VL

cd task_planning
# NVIDIA Cosmos-Reason1-7B (built on Qwen2.5-VL)
python ../run_custom_model.py --model_impl bear_models:CosmosReason1 \
       --input_json_path next_action_prediction_official.json

# any Qwen2.5-VL-style model
python ../run_custom_model.py --model_impl bear_models:QwenVL \
       --model_name Qwen/Qwen2.5-VL-7B-Instruct \
       --input_json_path next_action_prediction_official.json

# smoke test — no model, no extra deps
python ../run_custom_model.py --model_impl bear_models:EchoModel \
       --input_json_path next_action_prediction_official.json

It writes a final_<model>_evaluate_<task>.json, scored with eval.py (step 3) just like the other runners. To plug in your own model, add a class to bear_models.py:

class MyModel:
    def __init__(self, model_name="my/model", **kw):
        ...                                   # load the model once
    def generate(self, text, images):         # images: list[PIL.Image]
        return "...the model's text answer..."

and run it with --model_impl bear_models:MyModel.


3. Score the answers ← the final number

eval.py reads a final_*.json and grades it:

  • Multiple-choice (most tasks): an LLM judge (default gpt-4o-mini) reads the model's reply + the options and extracts the chosen letter A/B/C/D, compared to the ground-truth gt.
  • Pointing: the predicted (x, y) must land inside the ground-truth mask.
  • Bounding box: IoU between the predicted box and the ground-truth mask.
export OPENAI_API_KEY=sk-...

# generic (any task)
python eval.py --input_json task_planning/final_gpt-4o_evaluate_next_action_prediction_official.json

# long-horizon: also report episode-level strict accuracy
python eval.py --input_json long_horizon/final_gpt-4o_evaluate_vqa_all_episodes.json --episode

Options:

flag default meaning
--input_json (required) the final_*.json from step 2
--output_json <input>_scored.json per-item scored output
--judge_model gpt-4o-mini OpenAI model used to extract the MCQ answer
--episode off add episode-level strict accuracy (long_horizon)

Output: a *_scored.json (per-item direct_hit/cot_hit/direct_iou…) and a *_scored_summary.json, and the summary is printed, e.g.:

{
  "direct_reply": { "mcq": { "n": 300, "accuracy": 0.62 } },
  "cot_reply":    { "mcq": { "n": 300, "accuracy": 0.65 } }
}

direct = answer-immediately prompt, cot = chain-of-thought prompt (API models produce both; local image models produce direct only).


Tasks

Folder Modality Tasks (JSON) Grading
trajectory/ single image object / gripper / human-hand trajectory MCQ
bbox/ single image general-object / semantic-part / spatial-relationship bbox IoU vs mask
pointing/ single image object pointing point-in-mask
spatial_reasoning/ video + image (interleaved) / video relative direction, path planning, object localization MCQ
task_planning/ video next action prediction, task progress reasoning MCQ
long_horizon/ video (episodes) multi-question episodes MCQ + episode-strict

Layout

.
├── README.md
├── requirements.txt
├── run_api_model.py      # inference with API models (gpt / gemini / claude)
├── run_image_model.py    # inference with local VLMs (VLMEvalKit)
├── run_custom_model.py   # inference with any local model, NO VLMEvalKit
├── bear_models.py        # pluggable adapters (Cosmos, Qwen2.5-VL, Echo)
├── eval.py               # grading -> final score
├── util/                 # prompt templates, API wrappers, image grid
│   ├── prompt_generation.py
│   ├── gpt.py  gemini.py  claude.py
│   └── concate_image.py
└── <task folders>/       # data (*.json + media) + run.sh

Notes

  • Frame sampling: video is sampled to 16 frames. API runners send frames as images; the local image runner stitches frames into one grid image.
  • Resume: run_image_model.py checkpoints to tmp/ and skips finished items.
  • No hardcoded keys: all credentials are read from environment variables.