Skip to content

Commit

Permalink
Update pipeline.py (#218)
Browse files Browse the repository at this point in the history
* Update pipeline.py

Changed computation of `avg_ms` to use float value of `_get_fps()` instead of int `avg_fps`, which caused `ZeroDivisionError` if avg_fps was evaluated to 0

* Applu suggestions

* Be less pedantic about when to report or not timing result

---------

Co-authored-by: Ignacio Vizzo <ignaciovizzo@gmail.com>
  • Loading branch information
kurthobein and nachovizzo committed Sep 18, 2023
1 parent 3e05085 commit d3bb87c
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions python/kiss_icp/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,22 @@ def _write_gt_poses(self):
)

def _run_evaluation(self):
if not self.has_gt:
print("[WARNING] No GT poses available, skipping evaluation")
return

# Run estimation metrics evaluation, only when GT data was provided
if self.has_gt:
avg_tra, avg_rot = sequence_error(self.gt_poses, self.poses)
ate_rot, ate_trans = absolute_trajectory_error(self.gt_poses, self.poses)
self.results.append(desc="Average Translation Error", units="%", value=avg_tra)
self.results.append(desc="Average Rotational Error", units="deg/m", value=avg_rot)
self.results.append(desc="Absolute Trajectory Error (ATE)", units="m", value=ate_trans)
self.results.append(desc="Absolute Rotational Error (ARE)", units="rad", value=ate_rot)

# Run timing metrics evaluation, always
def _get_fps():
total_time_s = sum(self.times) * 1e-9
return float(len(self.times) / total_time_s)

# Run metrics evaluation
avg_tra, avg_rot = sequence_error(self.gt_poses, self.poses)
ate_rot, ate_trans = absolute_trajectory_error(self.gt_poses, self.poses)
avg_fps = int(np.floor(_get_fps()))
avg_ms = 1e3 * (1 / avg_fps)

self.results.append(desc="Average Translation Error", units="%", value=avg_tra)
self.results.append(desc="Average Rotational Error", units="deg/m", value=avg_rot)
self.results.append(desc="Absolute Trajectory Error (ATE)", units="m", value=ate_trans)
self.results.append(desc="Absolute Rotational Error (ARE)", units="rad", value=ate_rot)
avg_fps = int(np.ceil(_get_fps()))
avg_ms = int(np.ceil(1e3 * (1 / _get_fps())))
self.results.append(desc="Average Frequency", units="Hz", value=avg_fps, trunc=True)
self.results.append(desc="Average Runtime", units="ms", value=avg_ms, trunc=True)

Expand Down

0 comments on commit d3bb87c

Please sign in to comment.