animap-gpu / app /adapters /embedding /__init__.py
bluman1's picture
Publish services/inference
4b98524 verified
Raw
History Blame Contribute Delete
1.59 kB
"""Frozen visual embeddings, and the identity index built on top of them.
Two modules, split along the line §6.4 draws:
- `backbones` — the ONNX adapters that turn an image into one unit vector, and
the four specs §40.2 asks to be compared. Nothing in it knows what an animal
is.
- `identity` — enrolment, matching, and the open-set decision. Nothing in it
knows what ONNX is.
The split is not tidiness. The benchmark that chooses a backbone and the index
that serves a farm fail in different ways and are audited by different people,
and keeping the retrieval logic testable without a 837 MB artefact on disk is
what lets the open-set rules have unit tests at all.
Everything `adapters.embedding` exported before the split is re-exported here, so
`from app.adapters.embedding import DINOV3_SPEC` still resolves.
"""
from __future__ import annotations
from app.adapters.embedding.backbones import (
DINOV2_SPEC,
DINOV3_SPEC,
MEGADESCRIPTOR_SPEC,
MIEWID_SPEC,
OnnxEmbeddingAdapter,
preprocess,
)
from app.adapters.embedding.identity import (
ENROLMENT_VIEWS,
Candidate,
Embedding,
EnrolledView,
IdentityIndex,
IdentityResult,
IndexMismatch,
OpenSetPolicy,
UnmeasuredThreshold,
)
__all__ = [
"DINOV2_SPEC",
"DINOV3_SPEC",
"ENROLMENT_VIEWS",
"MEGADESCRIPTOR_SPEC",
"MIEWID_SPEC",
"Candidate",
"Embedding",
"EnrolledView",
"IdentityIndex",
"IdentityResult",
"IndexMismatch",
"OnnxEmbeddingAdapter",
"OpenSetPolicy",
"UnmeasuredThreshold",
"preprocess",
]