diff --git a/lerobot/scripts/visualize_dataset.py b/lerobot/scripts/visualize_dataset.py index e7bd0693..739115e9 100644 --- a/lerobot/scripts/visualize_dataset.py +++ b/lerobot/scripts/visualize_dataset.py @@ -77,7 +77,7 @@ def render_dataset(dataset, out_dir, max_num_episodes): # add current frame to list of frames to render frames[im_key].append(item[im_key]) - end_of_episode = item["index"].item() == item["episode_data_index_to"].item() + end_of_episode = item["index"].item() == item["episode_data_index_to"].item() - 1 out_dir.mkdir(parents=True, exist_ok=True) for im_key in dataset.image_keys: diff --git a/tests/test_datasets.py b/tests/test_datasets.py index 85ddb00f..18d1e9d7 100644 --- a/tests/test_datasets.py +++ b/tests/test_datasets.py @@ -157,7 +157,7 @@ def test_load_previous_and_future_frames_within_tolerance(): "timestamp": [0.1, 0.2, 0.3, 0.4, 0.5], "index": [0, 1, 2, 3, 4], "episode_data_index_from": [0, 0, 0, 0, 0], - "episode_data_index_to": [4, 4, 4, 4, 4], + "episode_data_index_to": [5, 5, 5, 5, 5], }) data_dict = data_dict.with_format("torch") item = data_dict[2] @@ -173,7 +173,7 @@ def test_load_previous_and_future_frames_outside_tolerance_inside_episode_range( "timestamp": [0.1, 0.2, 0.3, 0.4, 0.5], "index": [0, 1, 2, 3, 4], "episode_data_index_from": [0, 0, 0, 0, 0], - "episode_data_index_to": [4, 4, 4, 4, 4], + "episode_data_index_to": [5, 5, 5, 5, 5], }) data_dict = data_dict.with_format("torch") item = data_dict[2] @@ -187,7 +187,7 @@ def test_load_previous_and_future_frames_outside_tolerance_outside_episode_range "timestamp": [0.1, 0.2, 0.3, 0.4, 0.5], "index": [0, 1, 2, 3, 4], "episode_data_index_from": [0, 0, 0, 0, 0], - "episode_data_index_to": [4, 4, 4, 4, 4], + "episode_data_index_to": [5, 5, 5, 5, 5], }) data_dict = data_dict.with_format("torch") item = data_dict[2]