Skip to content

Commit ee4eafc

Browse files
eskjorgholger-motional
authored andcommitted
Fix yaw_diff calculation (#46)
1 parent 82fcb4c commit ee4eafc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python-sdk/nuscenes/eval/eval_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ def yaw_diff(sample_annotation: Dict, sample_result: Dict) -> float:
173173
yaw_result = quaternion_yaw(Quaternion(sample_result['rotation']))
174174

175175
# Compute smallest angle between two yaw values.
176-
angle_diff = np.maximum(yaw_annotation - yaw_result, yaw_result - yaw_annotation)
176+
angle_diff = abs(yaw_annotation - yaw_result)
177177
if angle_diff > np.pi:
178-
angle_diff = angle_diff - np.pi # Shift (pi, 2*pi] to (0, pi].
178+
angle_diff = 2 * np.pi - angle_diff # Shift (pi, 2*pi] to (0, pi].
179179
return angle_diff
180180

181181

0 commit comments

Comments
 (0)