Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(validate_t4_dataset): add nbr_samples checker, sample token checker #127

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions perception_dataset/t4_dataset/format_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,20 @@ def validate_scene(nusc: NuScenes):
nusc, "sample", scene["last_sample_token"]
), "scene.last_sample_token isn't found in log"

assert nusc.scene[0]["nbr_samples"] == len(
nusc.sample
), "scene.nbr_samples isn't equal to the number of samples."


@_logger_wrapper
def validate_sample(nusc: NuScenes):
assert len(nusc.sample) > 0, "There are no sample."

no_next_token_count: int = 0
no_prev_token_count: int = 0
sample_annotation_referred_sample_tokens = [
ann["sample_token"] for ann in nusc.sample_annotation
]
for sample in nusc.sample:
assert find_in_table(
nusc, "scene", sample["scene_token"]
Expand All @@ -96,6 +103,10 @@ def validate_sample(nusc: NuScenes):
nusc, "sample", prev_token
), "sample.prev_token isn't found in sample."

assert (
sample["token"] in sample_annotation_referred_sample_tokens
), "sample.token isn't found in sample_annotation."

assert no_next_token_count == len(
nusc.scene
), f"There are more than {len(nusc.scene)} sample of empty scene.next."
Expand Down
Loading