feat: stage7 — Model Manager (F16) and Sequential VO (F07)

This commit is contained in:
Yuzviak
2026-03-22 22:59:55 +02:00
parent 9ef046d623
commit 058ed315dd
8 changed files with 494 additions and 2 deletions
+49
View File
@@ -0,0 +1,49 @@
"""Tests for Model Manager (F16)."""
import numpy as np
from gps_denied.core.models import ModelManager
def test_load_and_get_model():
manager = ModelManager()
# Should auto-load
engine = manager.get_inference_engine("SuperPoint")
assert engine.model_name == "SuperPoint"
# Check fallback/dummy
assert manager.fallback_to_onnx("SuperPoint") is True
assert manager.optimize_to_tensorrt("SuperPoint", "path.onnx") == "path.onnx.trt"
def test_mock_superpoint():
manager = ModelManager()
engine = manager.get_inference_engine("SuperPoint")
dummy_img = np.zeros((480, 640, 3), dtype=np.uint8)
res = engine.infer(dummy_img)
assert "keypoints" in res
assert "descriptors" in res
assert "scores" in res
assert len(res["keypoints"]) == 500
assert res["descriptors"].shape == (500, 256)
def test_mock_lightglue():
manager = ModelManager()
engine = manager.get_inference_engine("LightGlue")
# Need mock features
class DummyF:
def __init__(self, keypoints):
self.keypoints = keypoints
f1 = DummyF(np.random.rand(120, 2))
f2 = DummyF(np.random.rand(150, 2))
res = engine.infer({"features1": f1, "features2": f2})
assert "matches" in res
assert len(res["matches"]) == 100 # min(100, 120, 150)
assert res["keypoints1"].shape == (100, 2)
assert res["keypoints2"].shape == (100, 2)