Skip to content

Commit

Permalink
Fixed np.NaN to np.nan
Browse files Browse the repository at this point in the history
  • Loading branch information
kylevedder committed Jul 9, 2024
1 parent b80c3ca commit 8ea4aa3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ def _category_to_average_stats(
counts = np.array([v.count for v in values])
# Average of the epes weighted by the counts

weighted_split_avg_speed = np.NaN
weighted_average_epe = np.NaN
weighted_split_avg_speed = np.nan
weighted_average_epe = np.nan
if counts.sum() > 0:
valid_counts_mask = counts > 0

Expand Down
35 changes: 35 additions & 0 deletions tests/datasets/nuscenes/nuscenes_tests.py_bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from pathlib import Path

import pytest

from bucketed_scene_flow_eval.datasets.nuscenes import NuScenesRawSequenceLoader


@pytest.fixture
def nuscenes_loader() -> NuScenesRawSequenceLoader:
return NuScenesRawSequenceLoader(
sequence_dir=Path("/tmp/nuscenes"),
version="v1.0-mini",
split="mini_train",
verbose=False,
)


def test_nuscenes_loader_basic_load_and_len_check(nuscenes_loader: NuScenesRawSequenceLoader):
assert len(nuscenes_loader) > 0, f"no sequences found in {nuscenes_loader}"
expected_lens= [236, 236, 236, 233, 223, 239, 231, 231]
assert len(nuscenes_loader) == len(
expected_lens
), f"expected {len(expected_lens)} sequences, got {len(nuscenes_loader)}"

num_loop_iterations = 0
for sequence_id, expected_len in zip(nuscenes_loader.get_sequence_ids(), expected_lens):
num_loop_iterations += 1
nusc_seq = nuscenes_loader.load_sequence(sequence_id)
assert (
len(nusc_seq) == expected_len
), f"expected {expected_len} frames, got {len(nusc_seq)} for {sequence_id}"

assert num_loop_iterations == len(
expected_lens
), f"expected {len(expected_lens)} loop iterations, got {num_loop_iterations}"

0 comments on commit 8ea4aa3

Please sign in to comment.