pub enum FaceEmbedder {
Local(LocalEmbedder),
Remote {
remote: RemoteEmbedder,
local_fallback: Option<LocalEmbedder>,
},
}Expand description
Dispatch enum — either local ONNX or remote GPU bridge.
The Remote variant always carries a LocalEmbedder alongside it.
When the remote bridge fails for a batch, we fall back to local for
just that batch instead of dropping the faces silently. The remote’s
own 3-strikes / unhealthy check still applies; this is the per-batch
safety net while it’s nominally healthy.
Variants§
Implementations§
Source§impl FaceEmbedder
impl FaceEmbedder
Sourcepub fn from_config(
rt: &OnnxRuntime,
cfg: &EmbedderConfig,
) -> Result<Self, Error>
pub fn from_config( rt: &OnnxRuntime, cfg: &EmbedderConfig, ) -> Result<Self, Error>
Build the configured embedder. Always constructs a local instance — it’s required as a fallback even when the bridge is healthy. If a remote bridge URL is configured AND the bridge passes its initial health check (including model match), the returned embedder routes batches through the remote first.
Sourcepub fn embed(&mut self, aligned_face: &RgbImage) -> Option<FaceEmbedding>
pub fn embed(&mut self, aligned_face: &RgbImage) -> Option<FaceEmbedding>
Generate embedding for an aligned face image (112x112).
Sourcepub fn embed_batch(&mut self, faces: &[RgbImage]) -> Vec<Option<FaceEmbedding>>
pub fn embed_batch(&mut self, faces: &[RgbImage]) -> Vec<Option<FaceEmbedding>>
Generate embeddings for a batch of aligned face images. Returns one Option per input; None only if both remote and local-fallback produced no embedding for that input.
Auto Trait Implementations§
impl Freeze for FaceEmbedder
impl !RefUnwindSafe for FaceEmbedder
impl Send for FaceEmbedder
impl Sync for FaceEmbedder
impl Unpin for FaceEmbedder
impl UnsafeUnpin for FaceEmbedder
impl !UnwindSafe for FaceEmbedder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more