Let the user choose which SCRFD finds their faces
faces.md §12.3 measured what the cheapest detector costs: the small faces in every group shot, and a dog embedded a dozen times. Which trade is right depends on the machine doing the sweep — a desktop left overnight and a tablet on a battery want different answers — so the detector is now a per-device setting, Fast / Balanced / Thorough on the settings page beside the indexing button, persisted with the rest of the settings file. A detector is half of a model id. Every face, marker, shard and calibration is keyed on faces.model_id precisely so that a model change is a new id and a re-index rather than a silent change under existing data, and a detector change is a model change: it decides which faces exist and where the landmarks that align them land. So each choice names its own pipeline. 500M keeps the bare "w600k_mbf" every existing library was written under, so an upgrade disturbs nothing; the others are qualified. Choosing one restarts coverage from zero under the new id, the sweep re-detects, confirmed names carry across by box overlap, and the sync shards are keyed by the same id so a peer on another setting neither adopts nor pollutes them. The library controller carries the id into the sync the same way it carries the cache budget, because the sync starts from places that have no settings in reach. All three shape-fixed exports ship — APK, Arch, Flatpak — since a tablet has no other way to obtain the one it was not installed with; the APK grows by twenty megabytes for the choice.
This commit is contained in:
@@ -391,6 +391,15 @@ pub struct LibraryController {
|
||||
/// wrong shape of question. A `Cell` because the page can change it while
|
||||
/// a library is open.
|
||||
timeline_bars: std::cell::Cell<u32>,
|
||||
/// TRACES: FR-CULL-8
|
||||
/// Which face pipeline this device indexes with, from the settings page.
|
||||
///
|
||||
/// Held here for the same reason as the two above: the derived sync runs
|
||||
/// from a sweep's completion and from the Sync button, neither of which
|
||||
/// has the settings in reach, and the shards it exports and adopts are
|
||||
/// keyed on this id. A `RefCell` of the id rather than the enum so that
|
||||
/// nothing here has to know how a detector becomes a model id.
|
||||
face_model_id: RefCell<String>,
|
||||
/// Where every worker this module starts reports what it is doing.
|
||||
///
|
||||
/// Held on the controller rather than passed to each function because the
|
||||
@@ -458,9 +467,22 @@ impl LibraryController {
|
||||
dr_types::CacheSettings::default().keep_opened_originals,
|
||||
),
|
||||
timeline_bars: std::cell::Cell::new(dr_types::LibrarySettings::default().timeline_bars),
|
||||
face_model_id: RefCell::new(dr_types::FaceDetector::default().model_id().to_string()),
|
||||
})
|
||||
}
|
||||
|
||||
/// TRACES: FR-CULL-8
|
||||
/// Which face pipeline the next sync exports and adopts under.
|
||||
///
|
||||
/// Set on every settings edit like the bars above. A sync already running
|
||||
/// keeps the id it started with, which is right: its shards are half
|
||||
/// written under that one.
|
||||
pub fn set_face_model_id(&self, id: &str) {
|
||||
if *self.face_model_id.borrow() != id {
|
||||
*self.face_model_id.borrow_mut() = id.to_string();
|
||||
}
|
||||
}
|
||||
|
||||
/// TRACES: FR-CAT-6
|
||||
/// How many bars the capture-time axis is cut into.
|
||||
///
|
||||
@@ -4016,6 +4038,7 @@ fn start_derived_sync(window: &AppWindow, ctl: &Rc<LibraryController>) {
|
||||
catalog_path,
|
||||
library::place_path(&conn.account),
|
||||
scratch,
|
||||
ctl.face_model_id.borrow().clone(),
|
||||
);
|
||||
|
||||
let timer = slint::Timer::default();
|
||||
|
||||
Reference in New Issue
Block a user