fix(workflows): route detections_consensus IoU through detection geometry#2420
Open
kounelisagis wants to merge 1 commit into
Open
fix(workflows): route detections_consensus IoU through detection geometry#2420kounelisagis wants to merge 1 commit into
kounelisagis wants to merge 1 commit into
Conversation
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.
What does this PR do?
DetectionsConsensusBlockV1.calculate_ioualways usessv.box_iou_batchonxyxy, regardless of what geometry each detection actually carries. For instance-segmentation or OBB workflows that's the bounding box of the actual shape - which can overlap heavily even when the masks / oriented bodies don't. Two detections with identical AABBs but disjoint masks (or crossed OBBs in an aerial image) end up matched as the same object, and consensus silently merges them.The fix dispatches on the geometry the detections actually carry:
mask_iou_batchwhen both have amaskoriented_box_iou_batchwhen both havedata["xyxyxyxy"]box_iou_batchotherwise (unchanged)Type of Change
Testing
Test details:
Two new unit tests in
tests/workflows/unit_tests/core_steps/fusion/test_detections_consensus.py:test_calculate_iou_uses_mask_iou_when_both_have_masks- identical AABB, disjoint masks -> IoU 0.0 (would be 1.0 pre-fix).test_calculate_iou_uses_obb_iou_when_both_have_oriented_boxes- crossed OBBs at +-45°, near-identical AABBs -> IoU < 0.2 (would be > 0.95 pre-fix).Both fail on
main. Existingcalculate_ioutests are unchanged.Checklist
Additional Context
The block already accepts a
detections_merge_mask_aggregationparameter and is wired up to instance-segmentation models, so mask support was clearly intended - but the matching step itself was still bbox-only, so the aggregation never actually saw masks that the user expected to be merged.