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:
@@ -26,8 +26,8 @@ use std::rc::Rc;
|
||||
|
||||
use dr_types::settings::budget;
|
||||
use dr_types::{
|
||||
CollisionPolicy, ColourSpace, ExportFormat, ExportTarget, GroupNavigation, LibrarySettings,
|
||||
OutputSharpening, ScreenSize, Settings, SizingMode,
|
||||
CollisionPolicy, ColourSpace, ExportFormat, ExportTarget, FaceDetector, GroupNavigation,
|
||||
LibrarySettings, OutputSharpening, ScreenSize, Settings, SizingMode,
|
||||
};
|
||||
use slint::ComponentHandle;
|
||||
|
||||
@@ -186,6 +186,24 @@ pub fn render(window: &AppWindow, controller: &SettingsController) {
|
||||
);
|
||||
window.set_settings_cache_usage(controller.usage_label.borrow().clone().into());
|
||||
|
||||
// --- faces ---------------------------------------------------------
|
||||
//
|
||||
// TRACES: FR-CULL-8
|
||||
// Labelled from the enum's own order, so the chip index and
|
||||
// `FaceDetector::ALL` cannot disagree about which detector was picked.
|
||||
window.set_settings_face_detector_labels(slint::ModelRc::new(slint::VecModel::from(
|
||||
FaceDetector::ALL
|
||||
.iter()
|
||||
.map(|d| slint::SharedString::from(d.label()))
|
||||
.collect::<Vec<_>>(),
|
||||
)));
|
||||
window.set_settings_face_detector_selected(
|
||||
FaceDetector::ALL
|
||||
.iter()
|
||||
.position(|d| *d == s.faces.detector)
|
||||
.unwrap_or(0) as i32,
|
||||
);
|
||||
|
||||
// --- library -------------------------------------------------------
|
||||
//
|
||||
// Labelled here rather than in the page, so the chips cannot offer a count
|
||||
@@ -484,6 +502,28 @@ pub fn wire<F, G>(
|
||||
});
|
||||
}
|
||||
|
||||
// --- faces ---------------------------------------------------------
|
||||
//
|
||||
// TRACES: FR-CULL-8
|
||||
// Notified like a budget change, because the effect is outside this
|
||||
// page: the library controller carries the pipeline id into the next
|
||||
// sync, and the coverage line under the picker has to be re-counted
|
||||
// under the new id — which the caller's `on_budget_changed` does.
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
let ctl = controller.clone();
|
||||
let notify = on_budget_changed.clone();
|
||||
window.on_settings_face_detector_picked(move |i| {
|
||||
let Some(w) = weak.upgrade() else { return };
|
||||
let Some(choice) = FaceDetector::ALL.get(i as usize).copied() else {
|
||||
return;
|
||||
};
|
||||
ctl.edit(|s| s.faces.detector = choice);
|
||||
notify(&ctl.snapshot());
|
||||
render(&w, &ctl);
|
||||
});
|
||||
}
|
||||
|
||||
// --- export --------------------------------------------------------
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
|
||||
Reference in New Issue
Block a user