# NMS Overlap Removal Tests

**Task**: AZ-162_test_nms
**Name**: NMS Overlap Removal Tests
**Description**: Implement 3 tests for non-maximum suppression — overlapping kept by confidence, non-overlapping preserved, chain overlap resolution
**Complexity**: 1 point
**Dependencies**: AZ-152_test_infrastructure
**Component**: Blackbox Tests
**Jira**: AZ-162
**Epic**: AZ-151

## Problem

The NMS module removes overlapping detections based on IoU threshold (0.3), keeping the higher-confidence detection. Tests verify all overlap scenarios.

## Outcome

- 3 passing pytest tests in `tests/test_nms.py`

## Scope

### Included
- BT-NMS-01: Overlapping detections — keep higher confidence (IoU > 0.3 → 1 kept)
- BT-NMS-02: Non-overlapping detections — keep both (IoU < 0.3 → 2 kept)
- BT-NMS-03: Chain overlap resolution (A↔B, B↔C → ≤ 2 kept)

### Excluded
- Integration with inference pipeline (separate task)

## Acceptance Criteria

**AC-1: Overlap removal**
Given 2 Detections at same position, confidence 0.9 and 0.5, IoU > 0.3
When remove_overlapping_detections() runs
Then 1 detection returned (confidence 0.9)

**AC-2: Non-overlapping preserved**
Given 2 Detections at distant positions, IoU < 0.3
When remove_overlapping_detections() runs
Then 2 detections returned

**AC-3: Chain overlap**
Given 3 Detections: A overlaps B, B overlaps C, A doesn't overlap C
When remove_overlapping_detections() runs
Then ≤ 2 detections; highest confidence per overlapping pair kept

## Constraints

- Detection objects constructed in-memory (no fixture files)
- IoU threshold is 0.3 (from constants or hardcoded in NMS)
