Skip to content

fix(perception_fp): change method contain to intersect#333

Open
MasatoSaeki wants to merge 1 commit intodevelopfrom
fix/contain_method
Open

fix(perception_fp): change method contain to intersect#333
MasatoSaeki wants to merge 1 commit intodevelopfrom
fix/contain_method

Conversation

@MasatoSaeki
Copy link
Copy Markdown
Contributor

Types of PR

  • New Features
  • Upgrade of existing features
  • Bugfix

Description

This PR fixes the

How to review this PR

Others

Signed-off-by: MasatoSaeki <masato.saeki@tier4.jp>
Copilot AI review requested due to automatic review settings March 11, 2026 08:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Perception FP (false positive) evaluation logic for bbox data by switching the non-detection-area XY check from point containment to polygon intersection, and extends the sample scenario with an additional bbox-only criterion.

Changes:

  • Update bbox vs non-detection-area XY evaluation from contains(...) on corners to intersects(...) on a bbox polygon.
  • Add a new Criterion entry to the sample perception_fp scenario for bbox evaluation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
driving_log_replayer_v2/driving_log_replayer_v2/perception_fp/models.py Changes bbox-in-area evaluation predicate from corner containment to polygon intersection.
sample/perception_fp/scenario.yaml Adds an additional bbox-only criterion sample configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

prep_geom, corners[:, 0], corners[:, 1]
) # or contains(non_detection_area, Polygon(corners[:, 0:2]))
)
is_in_xy = np.any(prep_geom.intersects(Polygon(corners[:, 0:2])))
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prep_geom.intersects(...) returns true even when the bbox only touches the non-detection area boundary. This conflicts with the documented behavior for perception_fp (boundary contact should be treated as non-contact) and with the local comment # boundary is not included. Consider using an interior-intersection check (e.g., intersects AND NOT touches, or another predicate that excludes boundary-only contact) so boundary cases don't become false positives.

Suggested change
is_in_xy = np.any(prep_geom.intersects(Polygon(corners[:, 0:2])))
polygon_xy = Polygon(corners[:, 0:2])
# boundary is not included: require interior intersection (not just touching)
is_in_xy = prep_geom.intersects(polygon_xy) and not non_detection_area.geom.touches(
polygon_xy
)

Copilot uses AI. Check for mistakes.
Comment on lines +311 to 312
is_in_xy = np.any(prep_geom.intersects(Polygon(corners[:, 0:2])))
if is_in_z and is_in_xy:
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change alters the bbox-in-polygon logic (from checking corner containment to polygon intersection). Please add unit tests that cover: (1) a bbox that overlaps the non_detection_area even though all its corners are outside, and (2) a bbox that only touches the boundary (should be treated as non-contact per the use-case docs). Current tests only cover the fully-inside case, so they won't catch regressions here.

Copilot uses AI. Check for mistakes.
prep_geom, corners[:, 0], corners[:, 1]
) # or contains(non_detection_area, Polygon(corners[:, 0:2]))
)
is_in_xy = np.any(prep_geom.intersects(Polygon(corners[:, 0:2])))
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.any(...) is redundant here because prep_geom.intersects(...) already returns a single boolean. Removing the np.any wrapper will make the intent clearer and avoid implying vectorized behavior.

Suggested change
is_in_xy = np.any(prep_geom.intersects(Polygon(corners[:, 0:2])))
is_in_xy = prep_geom.intersects(Polygon(corners[:, 0:2]))

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants