feat: stage8 — Global Place Recognition and Metric Refinement

This commit is contained in:
Yuzviak
2026-03-22 23:03:54 +02:00
parent 058ed315dd
commit 905d6992de
9 changed files with 558 additions and 5 deletions
+38
View File
@@ -0,0 +1,38 @@
"""Global Place Recognition schemas (Component F08)."""
from typing import Optional
import numpy as np
from pydantic import BaseModel
from gps_denied.schemas.flight import GPSPoint
from gps_denied.schemas.satellite import TileBounds
class TileCandidate(BaseModel):
"""A matched satellite tile candidate."""
tile_id: str
gps_center: GPSPoint
bounds: TileBounds
similarity_score: float
rank: int
spatial_score: Optional[float] = None
class DatabaseMatch(BaseModel):
"""Raw index match from Faiss queries."""
index: int
tile_id: str
distance: float
similarity_score: float
class SatelliteTile(BaseModel):
"""A stored satellite tile representation for indexing."""
model_config = {"arbitrary_types_allowed": True}
tile_id: str
image: np.ndarray
gps_center: GPSPoint
bounds: TileBounds
descriptor: Optional[np.ndarray] = None
+54
View File
@@ -0,0 +1,54 @@
"""Metric Refinement schemas (Component F09)."""
from typing import Optional
import numpy as np
from pydantic import BaseModel
from gps_denied.schemas.flight import GPSPoint
class AlignmentResult(BaseModel):
"""Result of aligning a UAV image to a single satellite tile."""
model_config = {"arbitrary_types_allowed": True}
matched: bool
homography: np.ndarray # (3, 3)
gps_center: GPSPoint
confidence: float
inlier_count: int
total_correspondences: int
reprojection_error: float # Mean error in pixels
class Sim3Transform(BaseModel):
"""Sim(3) transformation: scale, rotation, translation."""
model_config = {"arbitrary_types_allowed": True}
translation: np.ndarray # (3,)
rotation: np.ndarray # (3, 3) rotation matrix
scale: float
class ChunkAlignmentResult(BaseModel):
"""Result of aligning a chunk array of UAV images to a satellite tile."""
model_config = {"arbitrary_types_allowed": True}
matched: bool
chunk_id: str
chunk_center_gps: GPSPoint
rotation_angle: float
confidence: float
inlier_count: int
transform: Sim3Transform
reprojection_error: float
class LiteSAMConfig(BaseModel):
"""Configuration for LiteSAM alignment."""
model_path: str = "mock_path"
confidence_threshold: float = 0.7
min_inliers: int = 15
max_reprojection_error: float = 2.0 # pixels
multi_scale_levels: int = 3
chunk_min_inliers: int = 30