Raise configured YOLO max detections
This commit is contained in:
@@ -93,7 +93,7 @@ class RecordingPredictModel:
|
||||
def __init__(self) -> None:
|
||||
self.seen_sources: list[dict] = []
|
||||
|
||||
def predict(self, *, source, conf, imgsz, device, verbose):
|
||||
def predict(self, *, source, conf, imgsz, device, verbose, max_det):
|
||||
from PIL import Image
|
||||
|
||||
with Image.open(source) as image:
|
||||
@@ -106,6 +106,7 @@ class RecordingPredictModel:
|
||||
"imgsz": imgsz,
|
||||
"device": device,
|
||||
"verbose": verbose,
|
||||
"max_det": max_det,
|
||||
}
|
||||
)
|
||||
return []
|
||||
@@ -399,6 +400,20 @@ def test_yolo_adapter_converts_single_band_tiles_to_rgb_before_prediction(tmp_pa
|
||||
assert model.seen_sources[0]["imgsz"] == 64
|
||||
assert model.seen_sources[0]["device"] == "cpu"
|
||||
assert model.seen_sources[0]["verbose"] is False
|
||||
assert model.seen_sources[0]["max_det"] == 1000
|
||||
|
||||
|
||||
def test_yolo_adapter_uses_configured_max_detections(tmp_path: Path) -> None:
|
||||
Image = pytest.importorskip("PIL.Image")
|
||||
tile_path = tmp_path / "rgb_tile.png"
|
||||
Image.new("RGB", (16, 16), (10, 20, 30)).save(tile_path)
|
||||
model = RecordingPredictModel()
|
||||
settings = _settings(tmp_path, yolo_max_detections=1500)
|
||||
|
||||
detections = YoloDetectionAdapter(settings).predict_tile(model, tile_path, confidence_threshold=0.25)
|
||||
|
||||
assert detections == []
|
||||
assert model.seen_sources[0]["max_det"] == 1500
|
||||
|
||||
|
||||
def test_yolo_adapter_wraps_prediction_runtime_errors(tmp_path: Path) -> None:
|
||||
|
||||
Reference in New Issue
Block a user