Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
Signed-off-by: Shunsuke Miura <[email protected]>
  • Loading branch information
miursh committed Nov 21, 2023
1 parent 23baf92 commit c6ffc7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _remove_sample_of_non_keyframe(

def _change_sample_token_to_next_closest_keyframe(self, sample_data_list: list):
for sample_data in sample_data_list[:]:
if sample_data["is_key_frame"]:
if sample_data["is_key_frame"] or not sample_data["is_valid"]:
continue
sample_data["sample_token"] = self._get_next_closest_keyframe(
sample_data, sample_data_list
Expand Down Expand Up @@ -164,7 +164,9 @@ def connect_sample_data_next_prev_tokens(self, sample_data_list: list):
new_sample_data_list = []
for sensor in sensor_list:
sensor_sample_data_list = [
data for data in sample_data_list if data["calibrated_sensor_token"] == sensor
data
for data in sample_data_list
if data["calibrated_sensor_token"] == sensor and data["is_valid"]
]
self.connect_sample_next_prev_tokens(sensor_sample_data_list)
new_sample_data_list.extend(sensor_sample_data_list)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_t4_dataset_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ def test_sample_data_json(t4_dataset_path):
assert sample_data["filename"], "filename is empty"
assert sample_data["width"] >= 0, "width is empty"
assert sample_data["height"] >= 0, "height is empty"
assert (
sample_data["is_key_frame"] == sample_data["is_valid"]
), f"is_key_frame is {sample_data['is_key_frame']}, is_valid is {sample_data['is_valid']}"
assert (not sample_data["is_valid"] and not sample_data["is_key_frame"]) or sample_data[
"is_valid"
], f"is_key_frame is {sample_data['is_key_frame']}, is_valid is {sample_data['is_valid']}"
assert "next" in sample_data.keys(), "next is empty"
assert "prev" in sample_data.keys(), "prev is empty"

Expand Down

0 comments on commit c6ffc7a

Please sign in to comment.