-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Tests failed in https://github.com/sign-language-processing/pose-evaluation/actions/runs/18368535610/job/52326150918
=================================== FAILURES ===================================
_____________________ test_dtai_distance_with_masked_poses _____________________
real_mixed_shape_files = [<pose_format.pose.Pose object at 0x7f1c8fd22330>, <pose_format.pose.Pose object at 0x7f1c8a1ca990>, <pose_format.pose.Pose object at 0x7f1c8a1ca3c0>]
def test_dtai_distance_with_masked_poses(real_mixed_shape_files: list[Pose]):
default_distance = 10.0
metric = DistanceMetric(
name="testmetric_with_no_masked_preprocessing",
distance_measure=DTWDTAIImplementationDistanceMeasure(
name="dtaiDTWAggregatedDistanceMeasureFast",
use_fast=True,
default_distance=default_distance,
),
pose_preprocessors=[],
)
with pytest.warns(
RuntimeWarning, match=f"Invalid distance calculated, setting to default value {default_distance}"
):
for hyp, ref in itertools.combinations(real_mixed_shape_files, 2):
> score = metric.score_with_signature(hyp, ref)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pose_evaluation/metrics/test_dtw_metric.py:75:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pose_evaluation/metrics/base_pose_metric.py:62: in score_with_signature
score=self.score(hypothesis, reference),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pose_evaluation/metrics/base_pose_metric.py:41: in score
return self._pose_score(hypothesis, reference)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pose_evaluation/metrics/distance_metric.py:26: in _pose_score
return self.distance_measure(processed_hypothesis.body.data, processed_reference.body.data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pose_evaluation/metrics/distance_measure.py:48: in __call__
return self.get_distance(hyp_data, ref_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pose_evaluation/metrics/dtw_metric.py:166: in get_distance
for i, (hyp_trajectory, ref_trajectory) in tqdm(
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/tqdm/std.py:1169: in __iter__
for obj in iterable:
^^^^^^^^
pose_evaluation/metrics/distance_measure.py:43: in _get_keypoint_trajectories
ref_data[:, 0, keypoint_idx, :],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = masked_array(
data=[[[[315.46875, 126.4453125, -1.24609375],
[338.75, 92.40234375, -1.1474609375],
...alse, False],
[False, False, False],
[False, False, False]]]],
fill_value=1e+20,
dtype=float32)
indx = (slice(None, None, None), 0, 553, slice(None, None, None))
def __getitem__(self, indx):
"""
x.__getitem__(y) <==> x[y]
Return the item described by i, as a masked array.
"""
# We could directly use ndarray.__getitem__ on self.
# But then we would have to modify __array_finalize__ to prevent the
# mask of being reshaped if it hasn't been set up properly yet
# So it's easier to stick to the current version
> dout = self.data[indx]
^^^^^^^^^^^^^^^
E IndexError: index 553 is out of bounds for axis 2 with size 553
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/numpy/ma/core.py:3228: IndexError
The problem appears to originate here:
https://github.com/sign-language-processing/pose-evaluation/blob/main/pose_evaluation/metrics/distance_measure.py#L38C1-L45C49
def _get_keypoint_trajectories(self, hyp_data: ma.MaskedArray, ref_data: ma.MaskedArray):
# frames, persons, keypoint
for keypoint_idx in range(hyp_data.shape[2]):
hyp_trajectory, ref_trajectory = (
hyp_data[:, 0, keypoint_idx, :],
ref_data[:, 0, keypoint_idx, :],
)
yield hyp_trajectory, ref_trajectory
But if this is because ref_data.shape[2] < hyp_data.shape[2], then that means there's an error upstream. It should not be the case that the shapes aren't the same.
Another possible fix would be to take the min value of ref_data.shape[2], hyp_data.shape[2] but then errors would fail silently in a sense. And points might be mismatched.
So perhaps the answer is to take another look at ReducePosesToCommonComponentsProcessor(), and add an assert statement to test_dtai_distance_with_masked_poses that the shapes of the processed poses should match.