Audit and suppress nested detector proposals
This commit is contained in:
@@ -26,3 +26,15 @@ def test_empty_reference_counts_false_positives() -> None:
|
||||
|
||||
def test_box_scaling_preserves_center() -> None:
|
||||
assert MODULE.scale_box((10.0, 20.0, 30.0, 40.0), 1.5) == (5.0, 15.0, 35.0, 45.0)
|
||||
|
||||
|
||||
def test_containment_suppression_removes_nested_lower_score_box() -> None:
|
||||
predictions = [
|
||||
((0.0, 0.0, 20.0, 20.0), 0.9),
|
||||
((5.0, 5.0, 15.0, 15.0), 0.8),
|
||||
((25.0, 0.0, 35.0, 10.0), 0.7),
|
||||
]
|
||||
assert MODULE.suppress_contained_predictions(predictions, 0.8) == [
|
||||
predictions[0],
|
||||
predictions[2],
|
||||
]
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SCRIPT = Path(__file__).parents[2] / "scripts" / "retile_yolo_dataset.py"
|
||||
SPEC = importlib.util.spec_from_file_location("retile_yolo", SCRIPT)
|
||||
assert SPEC and SPEC.loader
|
||||
MODULE = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(MODULE)
|
||||
|
||||
|
||||
def test_tile_starts_cover_edges_with_overlap() -> None:
|
||||
assert MODULE.tile_starts(640, 384, 128) == [0, 256]
|
||||
assert MODULE.tile_starts(700, 384, 128) == [0, 256, 316]
|
||||
|
||||
|
||||
def test_tile_starts_reject_image_smaller_than_tile() -> None:
|
||||
assert MODULE.tile_starts(320, 384, 128) == []
|
||||
Reference in New Issue
Block a user