feat: collision check for data augmentation#98
Open
rej55 wants to merge 3 commits into
Open
Conversation
Signed-off-by: Fumiya Watanabe <fumiya.watanabe.44@gmail.com>
Signed-off-by: Fumiya Watanabe <fumiya.watanabe.44@gmail.com>
Signed-off-by: Fumiya Watanabe <fumiya.watanabe.44@gmail.com>
|
I've started the training. I'll check the results and merge it if there's no deterioration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Overview
Adds a validity filter to
StatePerturbation(ego-state perturbation for data augmentation) that rejects perturbed samples where the augmented ego position would cause a physical collision.Without this filter, a randomly perturbed ego can overlap with surrounding objects or cross a lane boundary, introducing physically impossible training examples.
Changes
diffusion_planner/utils/data_augmentation.pyNew module-level geometry utilities (pure functions, no side effects):
_cross2d_rect_corners(x, y, cos_h, sin_h, length, width)→ 4 corner points[B, 4, 2]_sat_signed_distance_segments_intersect_rectNew
StatePerturbation._check_aug_validitymethod:Returns a
[B]bool tensor (True = invalid) based on two conditions:neighbor_agents_past[:, :, -1, :]for the current timestep; per-agent size from feature indices 6/7)lanes[..., :2] + lanes[..., 4:6]) and right boundary (lanes[..., :2] + lanes[..., 6:8]) consecutive waypoint segments that intersect the ego rectangle. Boundary sides with offset norm ≤ 0.01 m are treated as absent and skipped.Ego vehicle size is read from
inputs["ego_shape"][:, 1:2](length) and[:, 2:3](width) when available, with fallback to module-level constantsEGO_LENGTH = 5.0andEGO_WIDTH = 2.0.StatePerturbation.augmentupdate:Samples flagged as invalid retain their original (unperturbed) ego state.
diffusion_planner/tests/test_data_augmentation.pyAdded 33 new tests (26 → 59 total), covering:
How to test
Run the unit test suite: