This commit is contained in:
Qizhi Chen 2025-04-15 04:59:12 +08:00 committed by GitHub
commit 3bfc44165f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -119,8 +119,11 @@ def _assert_type_and_shape(stats_list: list[dict[str, dict]]):
raise ValueError("Number of dimensions must be at least 1, and is 0 instead.") raise ValueError("Number of dimensions must be at least 1, and is 0 instead.")
if k == "count" and v.shape != (1,): if k == "count" and v.shape != (1,):
raise ValueError(f"Shape of 'count' must be (1), but is {v.shape} instead.") raise ValueError(f"Shape of 'count' must be (1), but is {v.shape} instead.")
if "image" in fkey and k != "count" and v.shape != (3, 1, 1): if "image" in fkey and k != "count":
if "depth" not in fkey and v.shape != (3, 1, 1):
raise ValueError(f"Shape of '{k}' must be (3,1,1), but is {v.shape} instead.") raise ValueError(f"Shape of '{k}' must be (3,1,1), but is {v.shape} instead.")
if "depth" in fkey and v.shape != (1, 1, 1):
raise ValueError(f"Shape of '{k}' must be (1,1,1), but is {v.shape} instead.")
def aggregate_feature_stats(stats_ft_list: list[dict[str, dict]]) -> dict[str, dict[str, np.ndarray]]: def aggregate_feature_stats(stats_ft_list: list[dict[str, dict]]) -> dict[str, dict[str, np.ndarray]]: