pub struct FaceProcessor;Expand description
Face processing pipeline
Call process_photos to run the full detect -> embed -> cluster pipeline.
Implementations§
Source§impl FaceProcessor
impl FaceProcessor
Sourcepub fn run_clustering(
face_repo: &FaceRepo<'_>,
clustering_threshold: f32,
resolver_weights: ResolverWeights,
) -> Result<usize, String>
pub fn run_clustering( face_repo: &FaceRepo<'_>, clustering_threshold: f32, resolver_weights: ResolverWeights, ) -> Result<usize, String>
Run incremental clustering in two stages:
- Gallery k-NN retrieval + confidence bands: HIGH -> auto-assign to top cluster AMBIGUOUS -> queue for user review LOW -> leave for Stage 2
- Complete-link agglomerative clustering on still-unresolved faces
Public so integration tests (and re-cluster-only flows that skip
detection) can call it without going through the full
process_photos pipeline.
Source§impl FaceProcessor
impl FaceProcessor
Sourcepub fn find_manual_face(
photo_path: &Path,
orientation: i32,
drawn: (f32, f32, f32, f32),
model_dir: &Path,
) -> Result<ManualFace, ManualFaceError>
pub fn find_manual_face( photo_path: &Path, orientation: i32, drawn: (f32, f32, f32, f32), model_dir: &Path, ) -> Result<ManualFace, ManualFaceError>
Find the face inside drawn (normalised, display orientation) in the
photo at photo_path, and embed it. Touches no database, so callers
can run it without holding the library lock.
Sourcepub fn insert_manual_face(
conn: &Connection,
drive_path: &Path,
photo_id: i64,
face: &ManualFace,
) -> Result<i64>
pub fn insert_manual_face( conn: &Connection, drive_path: &Path, photo_id: i64, face: &ManualFace, ) -> Result<i64>
Store a face found by FaceProcessor::find_manual_face, unassigned,
and save its crop. Returns the new face’s id.
Source§impl FaceProcessor
impl FaceProcessor
Sourcepub fn sharpen_crops(
drive_path: &Path,
model_dir: &Path,
photo_path: &Path,
orientation: i32,
faces: &[SoftCrop],
) -> Result<usize, ManualFaceError>
pub fn sharpen_crops( drive_path: &Path, model_dir: &Path, photo_path: &Path, orientation: i32, faces: &[SoftCrop], ) -> Result<usize, ManualFaceError>
Crops saved before 0.6 are 80 px, too soft to judge a face when shown large. Re-save them at the full 112 px, lined up the same way new crops are, from the original photo. Only the picture changes: the face’s embedding and everything decided about it stay. Faces the detector can’t find again keep their old crop. Returns how many were re-saved.
Sourcepub fn crop_is_soft(drive_path: &Path, face_id: i64) -> bool
pub fn crop_is_soft(drive_path: &Path, face_id: i64) -> bool
Whether a saved face crop is smaller than today’s 112 px.
Source§impl FaceProcessor
impl FaceProcessor
Sourcepub fn process_photos(
drive_path: &Path,
model_dir: &Path,
detector_confidence: f32,
clustering_threshold: f32,
resolver_weights: ResolverWeights,
progress_tx: Option<Sender<FaceProcessingProgress>>,
cancel_flag: Option<Arc<AtomicBool>>,
) -> Result<FaceProcessingResult, String>
pub fn process_photos( drive_path: &Path, model_dir: &Path, detector_confidence: f32, clustering_threshold: f32, resolver_weights: ResolverWeights, progress_tx: Option<Sender<FaceProcessingProgress>>, cancel_flag: Option<Arc<AtomicBool>>, ) -> Result<FaceProcessingResult, String>
Run the full face processing pipeline on unprocessed photos.
Uses rayon for parallel detection/embedding with thread-local ONNX sessions, then batches DB writes for efficiency.
Auto Trait Implementations§
impl Freeze for FaceProcessor
impl RefUnwindSafe for FaceProcessor
impl Send for FaceProcessor
impl Sync for FaceProcessor
impl Unpin for FaceProcessor
impl UnsafeUnpin for FaceProcessor
impl UnwindSafe for FaceProcessor
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> ⓘ
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