Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Open compass VLMEvalKit TDBench Utils

From Leeroopedia
Field Value
source VLMEvalKit
domain Vision, Evaluation, UI Grounding, Bounding Box

Overview

Provides bounding box extraction, IoU calculation, and centroid containment evaluation for the TDBench (Touch-Down Benchmark) UI grounding task.

Description

This module implements `extract_bbox_from_string` for parsing normalized bounding box coordinates from model output using regex, `calculate_bbox_iou` for computing Intersection-over-Union between predicted and ground-truth boxes, and `calculate_centroid_containment` for checking if the predicted box center falls within the ground-truth box. The `evaluate_bbox` function dispatches between centroid and IoU evaluation methods. It supports rotation augmentation testing with `rotations_all` (0, 90, 180, 270 degrees).

Usage

Called internally by the corresponding dataset class during evaluation.

Code Reference

  • Source: vlmeval/dataset/utils/tdbench.py, Lines: L1-108
  • Import: from vlmeval.dataset.utils.tdbench import evaluate_bbox, extract_bbox_from_string

Key Functions:

def extract_bbox_from_string(bbox_str): ...
def calculate_bbox_iou(pred_bbox, gt_bbox): ...
def calculate_centroid_containment(pred_bbox, gt_bbox): ...
def evaluate_bbox(pred_bbox, gt_bbox, method): ...

I/O Contract

Direction Description
Inputs Bounding box strings in "x1, y1, x2, y2" format (normalized 0-1); evaluation method ('centroid' or 'iou')
Outputs Float IoU score or binary centroid containment (0/1)

Usage Examples

from vlmeval.dataset.utils.tdbench import evaluate_bbox, extract_bbox_from_string

bbox = extract_bbox_from_string("0.1, 0.2, 0.5, 0.8")
score = evaluate_bbox(bbox, gt_bbox, method='iou')

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment