Raise configured YOLO max detections
This commit is contained in:
@@ -93,6 +93,7 @@ def test_env_example_uses_runtime_env_names_read_by_backend_and_frontend() -> No
|
||||
assert "YOLO_MODEL_PATH=" in env_example
|
||||
assert "YOLO_CONFIG_DIR=./storage/ultralytics" in env_example
|
||||
assert "YOLO_MAX_TILES=100" in env_example
|
||||
assert "YOLO_MAX_DETECTIONS=1000" in env_example
|
||||
assert "ENABLE_YOLO" not in env_example
|
||||
assert "ENABLE_SAM" not in env_example
|
||||
assert "VITE_API_BASE_URL=" in env_example
|
||||
@@ -245,4 +246,5 @@ def test_unraid_deploy_passes_ai_build_arg_and_yolo_runtime_env() -> None:
|
||||
assert '-e YOLO_MODELS_DIR="$YOLO_MODELS_DIR"' in run_script
|
||||
assert '-e YOLO_MODEL_PATH="$YOLO_MODEL_PATH"' in run_script
|
||||
assert '-e YOLO_MAX_TILES="$YOLO_MAX_TILES"' in run_script
|
||||
assert '-e YOLO_MAX_DETECTIONS="$YOLO_MAX_DETECTIONS"' in run_script
|
||||
assert "-v \"${GEOINTEL_MODELS_PATH}:/app/models\"" in run_script
|
||||
|
||||
@@ -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