pub struct Recognizer { /* private fields */ }Implementations§
Source§impl Recognizer
impl Recognizer
pub fn new(threshold: f32) -> Result<Self, RecognizeError>
pub fn threshold(&self) -> f32
pub fn set_threshold(&mut self, threshold: f32) -> Result<(), RecognizeError>
pub fn enroll( &mut self, id: impl Into<String>, embedding: Tensor, ) -> Result<(), RecognizeError>
pub fn enroll_or_replace( &mut self, id: impl Into<String>, embedding: Tensor, ) -> Result<(), RecognizeError>
pub fn remove(&mut self, id: &str) -> bool
pub fn identities(&self) -> &[IdentityEmbedding]
pub fn clear(&mut self)
pub fn recognize( &self, embedding: &Tensor, ) -> Result<Recognition, RecognizeError>
pub fn recognize_slice( &self, embedding: &[f32], ) -> Result<Recognition, RecognizeError>
pub fn to_snapshot(&self) -> RecognizerSnapshot
pub fn from_snapshot( snapshot: RecognizerSnapshot, ) -> Result<Self, RecognizeError>
pub fn to_json_pretty(&self) -> Result<String, RecognizeError>
pub fn from_json(json: &str) -> Result<Self, RecognizeError>
pub fn save_json_file( &self, path: impl AsRef<Path>, ) -> Result<(), RecognizeError>
pub fn load_json_file(path: impl AsRef<Path>) -> Result<Self, RecognizeError>
Sourcepub fn build_index(&mut self)
pub fn build_index(&mut self)
Build a VP-tree index from the current gallery for fast nearest-neighbor search.
Sourcepub fn search_indexed(
&self,
embedding: &Tensor,
k: usize,
) -> Result<Vec<Recognition>, RecognizeError>
pub fn search_indexed( &self, embedding: &Tensor, k: usize, ) -> Result<Vec<Recognition>, RecognizeError>
Search using the VP-tree index if available, otherwise fall back to linear scan.
Returns the k nearest identities that meet the recognition threshold.
Trait Implementations§
Source§impl Clone for Recognizer
impl Clone for Recognizer
Source§fn clone(&self) -> Recognizer
fn clone(&self) -> Recognizer
Returns a duplicate of the value. Read more
1.0.0 · 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 Recognizer
impl RefUnwindSafe for Recognizer
impl Send for Recognizer
impl Sync for Recognizer
impl Unpin for Recognizer
impl UnsafeUnpin for Recognizer
impl UnwindSafe for Recognizer
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,
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