Skip to content

Rust/corrosion detections get wrongly deleted by new overlap-cleanup logic #1

@djimrastephane

Description

@djimrastephane

What's wrong

We're in the middle of improving how the detector cleans up overlapping boxes (the "non-max suppression" / NMS step in src/detection/nms.py and src/detection/contour.py). The new cleanup logic is supposed to remove duplicate/cluttered boxes when two different detectors fire on the same spot.

The problem: when a "dark blob" detection and a "rust/corrosion color" detection land on the same patch of screen, the new logic always throws away the rust one and keeps the dark blob one. That's the wrong call — rust patches are exactly the case we want to flag, and right now we're silently losing that evidence.

This is caught by our automated test suite — tests/test_detection.py::TestContourDetector::test_detects_color_anomaly currently fails on the in-progress branch.

Why it matters

If this ships as-is, the dashboard will under-report corrosion pitting, which is one of the six failure modes this whole tool exists to catch (see README "Failure Modes Detected" table).

What needs to happen

Decide and implement the right rule for when a rust/color detection and a dark-blob detection overlap on the same area:

  • Option A: never suppress one class in favor of the other — let both pass through and let the classification step downstream decide which failure type wins.
  • Option B: only suppress the smaller/lower-confidence box when overlap is very high — but make sure the rust signal isn't always the one that loses.

Get the failing test passing again as part of this fix, and add a test case that locks in whichever behavior is chosen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions