-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Related to #146 possibly. Once in a while, tests like this one will fail, because the data used is randomly generated.
pose/src/python/tests/pose_test.py
Line 447 in e07ca68
| def test_pose_tf_posebody_normalize_eager_mode_preserves_shape(self): |
Possible solutions:
- If we fix Minor bug: pose.normalize can divide by zero, filling data with nan values #146 it can fix this
- Adjust the test data generation to ensure
0aand0bare farther apart.
Example:
=================================== FAILURES ===================================
_ TestPoseTensorflowPoseBody.test_pose_tf_posebody_normalize_distribution_eager_mode_correct_result _
self = <tests.pose_test.TestPoseTensorflowPoseBody testMethod=test_pose_tf_posebody_normalize_distribution_eager_mode_correct_result>
def test_pose_tf_posebody_normalize_distribution_eager_mode_correct_result(self):
"""
Tests if the normalization of distribution for Pose object with TensorFlow PoseBody returns expected result.
"""
pose = _get_random_pose_object_with_tf_posebody(num_keypoints=5, frames_min=2)
tensor_as_numpy = pose.body.data.tensor.numpy()
mask_as_numpy = pose.body.data.mask.numpy()
masked_numpy_array = ma.array(tensor_as_numpy, mask=np.logical_not(mask_as_numpy))
axis = (0, 1)
numpy_mean = ma.mean(masked_numpy_array, axis=axis)
numpy_std = ma.std(masked_numpy_array, axis=axis)
expected_tensor = (masked_numpy_array - numpy_mean) / numpy_std
expected_tensor = expected_tensor.filled(0)
pose.normalize_distribution(axis=axis)
actual_tensor_nan_fixed = pose.body.data.fix_nan()
actual_tensor_zero_filled = actual_tensor_nan_fixed.zero_filled()
actual_tensor_as_numpy = actual_tensor_zero_filled.numpy()
> self.assertTrue(np.allclose(actual_tensor_as_numpy, expected_tensor),
"Normalize distribution did not return the expected result.")
E AssertionError: False is not true : Normalize distribution did not return the expected result.
tests/pose_test.py:486: AssertionError
=============================== warnings summary ===============================
tests/hand_normalization_test.py::Test3DNormalization::test_hand_normalization
/home/runner/work/pose/pose/src/python/pose_format/utils/normalization_3d.py:98: RuntimeWarning: invalid value encountered in divide
normal /= np.linalg.norm(normal, axis=-1, keepdims=True)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/pose_test.py::TestPoseTensorflowPoseBody::test_pose_tf_posebody_normalize_distribution_eager_mode_correct_result - AssertionError: False is not true : Normalize distribution did not return the expected result.
=================== 1 failed, 29 passed, 1 warning in 52.60s ===================
Metadata
Metadata
Assignees
Labels
No labels