rpx_benchmark.tasks.detection
Object detection (closed vocab + open vocab).
1"""Object detection (closed vocab + open vocab).""" 2 3from __future__ import annotations 4 5from dataclasses import dataclass 6 7from ..api import TaskType 8from ._pipeline import PipelineResult, TaskRunConfig, run_pipeline 9from .registry import TaskSpec, register_task 10 11PRIMARY_METRIC = "f1" 12 13 14@dataclass 15class ObjectDetectionRunConfig(TaskRunConfig): 16 pass 17 18 19def run_object_detection(cfg: ObjectDetectionRunConfig) -> PipelineResult: 20 return run_pipeline( 21 task=TaskType.OBJECT_DETECTION, 22 primary_metric=PRIMARY_METRIC, 23 cfg=cfg, 24 ) 25 26 27def run_open_vocab_detection(cfg: ObjectDetectionRunConfig) -> PipelineResult: 28 return run_pipeline( 29 task=TaskType.OPEN_VOCAB_DETECTION, 30 primary_metric=PRIMARY_METRIC, 31 cfg=cfg, 32 ) 33 34 35TASK_SPEC = TaskSpec( 36 task=TaskType.OBJECT_DETECTION, 37 display_name="Object Detection", 38 description="Detect and label boxes on a single RGB frame (closed vocab).", 39 primary_metric=PRIMARY_METRIC, 40 required_modalities=["rgb", "boxes"], 41 higher_is_better=True, 42 run=run_object_detection, 43) 44 45OPEN_VOCAB_TASK_SPEC = TaskSpec( 46 task=TaskType.OPEN_VOCAB_DETECTION, 47 display_name="Open-Vocabulary Detection", 48 description="Detect objects given a free-text vocabulary.", 49 primary_metric=PRIMARY_METRIC, 50 required_modalities=["rgb", "boxes"], 51 higher_is_better=True, 52 run=run_open_vocab_detection, 53) 54 55register_task(TASK_SPEC) 56register_task(OPEN_VOCAB_TASK_SPEC)
PRIMARY_METRIC =
'f1'
ObjectDetectionRunConfig(model: 'Optional[BenchmarkableModel]' = None, split: 'Difficulty | str' =
ObjectDetectionRunConfig( model: Optional[rpx_benchmark.adapters.BenchmarkableModel] = None, split: rpx_benchmark.api.Difficulty | str = <Difficulty.HARD: 'hard'>, repo_id: Optional[str] = None, cache_dir: Optional[str] = None, revision: Optional[str] = '51432e5d48895bbafb490ae7c5e34e0f6b7da7d6', batch_size: int = 1, require_cuda: bool = False, skip_flops: bool = False, max_samples: Optional[int] = None, manifest_path: Optional[str] = None, device: str = 'cuda', output_dir: Optional[str] = None, progress: Optional[Callable[[int, Optional[int], str], NoneType]] = None, metric_suite: Optional[rpx_benchmark.metrics.MetricSuite] = None, upload_to_box: bool = False, box_folder_id: Optional[str] = None)
def
run_object_detection( cfg: ObjectDetectionRunConfig) -> Tuple[rpx_benchmark.metrics.registry.BenchmarkResult, rpx_benchmark.deployment.DeploymentReadinessReport, Dict[str, pathlib.Path]]:
def
run_open_vocab_detection( cfg: ObjectDetectionRunConfig) -> Tuple[rpx_benchmark.metrics.registry.BenchmarkResult, rpx_benchmark.deployment.DeploymentReadinessReport, Dict[str, pathlib.Path]]:
TASK_SPEC =
TaskSpec(task=<TaskType.OBJECT_DETECTION: 'object_detection'>, display_name='Object Detection', primary_metric='f1', required_modalities=['rgb', 'boxes'], run=<function run_object_detection>, higher_is_better=True, description='Detect and label boxes on a single RGB frame (closed vocab).', temporal_stability_fn=None, geometric_coherence_fn=None)
OPEN_VOCAB_TASK_SPEC =
TaskSpec(task=<TaskType.OPEN_VOCAB_DETECTION: 'open_vocab_detection'>, display_name='Open-Vocabulary Detection', primary_metric='f1', required_modalities=['rgb', 'boxes'], run=<function run_open_vocab_detection>, higher_is_better=True, description='Detect objects given a free-text vocabulary.', temporal_stability_fn=None, geometric_coherence_fn=None)