File size: 1,590 Bytes
4b98524
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""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",
]