[refactor] eval: drop batch_unit/trial_forward from remaining metrics

Completes the d1bc1413 cleanup pass on the five files that were
skipped because dataloader had pending modifications. With those
modifications now landed (commits 7cdbcc94 + c2a22560), the dead
code in optical_flow + the four aux-using vbench metrics
(color/multiple_objects/object_class/spatial_relationship) can go.

Mechanical removal of batch_unit class attrs and trial_forward
method overrides — neither is read anywhere since calibrate() was
deleted in 502f061d.

Parity verified on fs-mbz-gpu-085: byte-identical to v3 baseline.
This commit is contained in:
shaoxiongduan
2026-05-06 00:51:00 +00:00
parent e117167eb9
commit 2b8e5a56a8
5 changed files with 0 additions and 21 deletions
@@ -251,7 +251,6 @@ class OpticalFlowMetric(BaseMetric):
needs_gpu = True
backbone = "optical_flow"
dependencies = ["ptlflow"]
batch_unit = "frame_pair"
def __init__(
self,
@@ -284,22 +283,6 @@ class OpticalFlowMetric(BaseMetric):
self._model.eval()
self._model = self._model.to(self.device)
def trial_forward(self, batch_size, *, height, width, num_frames):
from ptlflow.utils.io_adapter import IOAdapter
io_adapter = IOAdapter(
output_stride=self._model.output_stride,
input_size=(height, width),
cuda=(self.device.type == "cuda"),
)
dummy_bgr = np.random.randint(0, 255, (height, width, 3), dtype=np.uint8)
pair_tensors = []
for _ in range(batch_size):
inputs = io_adapter.prepare_inputs([dummy_bgr, dummy_bgr])
pair_tensors.append(inputs["images"])
batched = torch.cat(pair_tensors, dim=0)
with torch.no_grad():
self._model({"images": batched})
def _compute_flows_batched(
self, pair_frames: list[tuple[np.ndarray, np.ndarray]], io_adapter,
) -> list[np.ndarray]:
@@ -26,7 +26,6 @@ class ColorMetric(BaseMetric):
requires_reference = False
higher_is_better = True
needs_gpu = True
batch_unit = "video"
dependencies = ["detectron2"]
def __init__(self) -> None:
@@ -20,7 +20,6 @@ class MultipleObjectsMetric(BaseMetric):
requires_reference = False
higher_is_better = True
needs_gpu = True
batch_unit = "video"
dependencies = ["detectron2"]
def __init__(self) -> None:
@@ -20,7 +20,6 @@ class ObjectClassMetric(BaseMetric):
requires_reference = False
higher_is_better = True
needs_gpu = True
batch_unit = "video"
dependencies = ["detectron2"]
def __init__(self) -> None:
@@ -57,7 +57,6 @@ class SpatialRelationshipMetric(BaseMetric):
requires_reference = False
higher_is_better = True
needs_gpu = True
batch_unit = "video"
dependencies = ["detectron2"]
def __init__(self) -> None: