From 8f5ebe2aeb4a7f10fb5bf1bbffa7b0d5b5b644df Mon Sep 17 00:00:00 2001 From: shaoxiongduan Date: Thu, 7 May 2026 06:14:55 +0000 Subject: [PATCH] =?UTF-8?q?[bugfix]=20eval:=20human=5Faction=20=E2=80=94?= =?UTF-8?q?=20load=20kinetics=20labels=20from=20upstream=20submodule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The metric resolved the Kinetics-400 label file via a wm-eval-era ``_third_party/umt/kinetics_400_categories.txt`` path that no longer exists after the vbench-as-submodule port. ``os.path.exists`` was silently False, leaving the label dict empty; every prediction then mapped to the empty string and every score returned 0.0. Resolve the path through ``vbench.third_party.umt.__file__`` instead, which always points at the pinned upstream submodule. --- .../metrics/vbench/human_action/metric.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/fastvideo/eval/metrics/vbench/human_action/metric.py b/fastvideo/eval/metrics/vbench/human_action/metric.py index 2879a04f4..6bb10f70b 100644 --- a/fastvideo/eval/metrics/vbench/human_action/metric.py +++ b/fastvideo/eval/metrics/vbench/human_action/metric.py @@ -7,7 +7,7 @@ Score = 1.0 if match found, 0.0 otherwise. from __future__ import annotations -import os +from pathlib import Path import torch from torchvision.transforms.functional import resize, center_crop, normalize @@ -18,26 +18,26 @@ from fastvideo.eval.types import MetricResult from fastvideo.eval.io.video import extract_frames -# Kinetics-400 class names (loaded lazily) -_CAT_DICT = None +# Kinetics-400 class names (loaded lazily). The label file ships inside +# the upstream vbench submodule. +_CAT_DICT: dict[str, str] | None = None -def _load_cat_dict(): +def _load_cat_dict() -> dict[str, str]: global _CAT_DICT if _CAT_DICT is not None: return _CAT_DICT - cat_path = os.path.join( - os.path.dirname(__file__), "..", "_third_party", "umt", - "kinetics_400_categories.txt", - ) - _CAT_DICT = {} - if os.path.exists(cat_path): - with open(cat_path) as f: - for line in f: - parts = line.strip().split("\t") - if len(parts) == 2: - cat, idx = parts - _CAT_DICT[idx] = cat.lower() + import vbench.third_party.umt as _umt_pkg + cat_path = (Path(_umt_pkg.__file__).resolve().parent + / "kinetics_400_categories.txt") + out: dict[str, str] = {} + with cat_path.open() as f: + for line in f: + parts = line.strip().split("\t") + if len(parts) == 2: + cat, idx = parts + out[idx] = cat.lower() + _CAT_DICT = out return _CAT_DICT