pub struct FaceEmbedding {
pub vector: Array1<f32>,
}Expand description
512-dimensional face embedding
Fields§
§vector: Array1<f32>The embedding vector
Implementations§
Source§impl FaceEmbedding
impl FaceEmbedding
Sourcepub fn cosine_similarity(&self, other: &FaceEmbedding) -> f32
pub fn cosine_similarity(&self, other: &FaceEmbedding) -> f32
Calculate cosine similarity with another embedding
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Convert to bytes for database storage (little-endian f32 values)
Sourcepub fn from_bytes(bytes: &[u8]) -> Option<Self>
pub fn from_bytes(bytes: &[u8]) -> Option<Self>
Create from bytes (expects 512 * 4 = 2048 bytes, little-endian f32)
Trait Implementations§
Source§impl Clone for FaceEmbedding
impl Clone for FaceEmbedding
Source§fn clone(&self) -> FaceEmbedding
fn clone(&self) -> FaceEmbedding
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FaceEmbedding
impl RefUnwindSafe for FaceEmbedding
impl Send for FaceEmbedding
impl Sync for FaceEmbedding
impl Unpin for FaceEmbedding
impl UnsafeUnpin for FaceEmbedding
impl UnwindSafe for FaceEmbedding
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Converts
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>
Converts
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