diff --git a/python/kiss_icp/pipeline.py b/python/kiss_icp/pipeline.py index 9994bfc3..f8dfd857 100644 --- a/python/kiss_icp/pipeline.py +++ b/python/kiss_icp/pipeline.py @@ -179,12 +179,14 @@ def _run_evaluation(self): # Run timing metrics evaluation, always def _get_fps(): total_time_s = sum(self.times) * 1e-9 - return float(len(self.times) / total_time_s) - - 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) + return float(len(self.times) / total_time_s) if total_time_s > 0 else 0 + + fps = _get_fps() + avg_fps = int(np.floor(fps)) + avg_ms = int(np.ceil(1e3 / fps)) if fps > 0 else 0 + if avg_fps > 0: + 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) def _write_log(self): if not self.results.empty():