Skip to content

fix(autoware_bevfusion): validate remapper config at runtime#12472

Open
BISTU-gzy wants to merge 1 commit intoautowarefoundation:mainfrom
BISTU-gzy:codex/bevfusion-remapper-validation
Open

fix(autoware_bevfusion): validate remapper config at runtime#12472
BISTU-gzy wants to merge 1 commit intoautowarefoundation:mainfrom
BISTU-gzy:codex/bevfusion-remapper-validation

Conversation

@BISTU-gzy
Copy link
Copy Markdown

Summary

This PR hardens autoware_bevfusion's detection class remapper by:

  • replacing assert-only config validation with runtime validation
  • skipping labels that fall outside the configured remapper matrix
  • adding a dedicated unit test for the remapper

Motivation

autoware_bevfusion loads the remapper parameters from an external model data file.
Before this change, the remapper only validated matrix sizes with assert(...).

In release builds, those assertions disappear, so malformed remapper config could reach
Eigen::Map and matrix indexing without any runtime protection.

This patch makes the failure mode explicit and consistent with the package's existing
fail-fast parameter validation style.

What Changed

  • DetectionClassRemapper::setParameters() now throws on:
    • mismatched matrix sizes
    • empty matrices
    • non-square matrices
  • DetectionClassRemapper::mapClasses() now skips labels outside the configured matrix range
  • added test_detection_class_remapper.cpp
    • valid remapping behavior
    • mismatched sizes
    • empty matrices
    • non-square matrices
    • out-of-range labels

Testing

  • git diff --check
  • built and ran a targeted ament test harness against:
    • perception/autoware_bevfusion/lib/detection_class_remapper.cpp
    • perception/autoware_bevfusion/test/test_detection_class_remapper.cpp

Result:

  • 5 / 5 tests passed

Note:

  • full workspace colcon build --packages-select autoware_bevfusion was not completed in this environment because the local workspace is missing several internal package dependencies unrelated to this patch.

@github-actions github-actions bot added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Apr 13, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@BISTU-gzy BISTU-gzy force-pushed the codex/bevfusion-remapper-validation branch 2 times, most recently from f60c7b0 to 54d8c89 Compare April 13, 2026 01:09
Signed-off-by: BISTU-gzy <269895055+BISTU-gzy@users.noreply.github.com>
@BISTU-gzy BISTU-gzy force-pushed the codex/bevfusion-remapper-validation branch from 54d8c89 to 434aff7 Compare April 13, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:perception Advanced sensor data processing and environment understanding. (auto-assigned)

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

1 participant