• Stefy Lanza (nextime / spora )'s avatar
    feat: serve VPR (EigenPlaces) via /v1/embeddings as 'vpr'/'eigenplaces' · 4e8e4f04
    Stefy Lanza (nextime / spora ) authored
    Implements REQUEST-vpr-embeddings.md: a visual place recognition model that turns
    a photo into ONE L2-normalised descriptor trained so two images of the SAME place
    land close — the building-identity discrimination dinov2/gme/geoclip lack (they
    rate similar-looking houses as matches). HomeHunter uses it to match listing
    exteriors against Street View panoramas.
    
    Backed by EigenPlaces (gmberton, ResNet50, 2048-d) loaded via torch.hub. Chosen
    over SALAD/MixVPR for a clean dependency footprint: torch + torchvision only (no
    pytorch_lightning). ImageNet-normalised, 512x512 eval transform (matches training
    crops); output L2-normalised (idempotent — the net already ends in an L2 layer).
    On GPU (nvidia engine device); CPU only as fallback.
    
    The image data URI arrives in `input` (per the contract) or the `image` field.
    torch.hub cache pinned to a persistent TORCH_HOME (/cache/torchhub) with the repo
    + weights + trusted_list pre-seeded, so the engine loads offline and
    non-interactively (a cold torch.hub.load would otherwise hit an interactive trust
    prompt that EOF-crashes a server).
    
    Verified: 2048-d L2=1.0, deterministic, one vector/image; and the decisive
    ordering test — same-place pairs (min cos 0.479) rank strictly above every
    different-place pair (max 0.349), zero overlap. Config: models.json 'eigenplaces'
    + alias 'vpr', engine nvidia. SALAD (pytorch_lightning, subprocess-isolated) to
    follow as a second, higher-accuracy option.
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01LoSpEthysqmseCc6Geizty
    4e8e4f04
__init__.py 4.11 KB