Filter the grid to a person with their eyes open
An "Eyes open" chip beside the people chips, offered only while someone is chosen and dropped when the last person goes, so no term narrows the grid with nothing on the bar to say so. It compiles the rule in dr_face::eyes into the person's face subquery — Anna, eyes open, whoever else is blinking beside her — and drops a frame only on a closed eye that could be read: sunglasses, eyes too small or soft to read, and faces never read all pass, so an old library shows everything under the chip until the measuring pass has run. A test drives the same readings through the SQL and through the rule and requires them to agree. The People screen badges a face "Eyes closed", "Sunglasses" or "Eyes unclear" so the reason a frame is or is not in the grid can be read off the face; the sweep loads the three models when they are beside the pair and reads eyes on the indexing and measuring passes from the native render; the coverage line counts unread faces as work to measure so an already-indexed library keeps its Index button. The term travels with the place.
This commit is contained in:
@@ -60,7 +60,7 @@ fn main() {
|
||||
}
|
||||
};
|
||||
|
||||
let audit = match faces::audit(&catalog, &store, MODEL_ID) {
|
||||
let audit = match faces::audit(&catalog, &store, MODEL_ID, false) {
|
||||
Ok(a) => a,
|
||||
Err(e) => {
|
||||
eprintln!("coverage check failed: {e}");
|
||||
@@ -183,8 +183,13 @@ fn main() {
|
||||
let rx = faces::spawn_store_face_sweep(
|
||||
catalog_path,
|
||||
store_dir,
|
||||
PathBuf::from(detector),
|
||||
PathBuf::from(embedder),
|
||||
dr_ui::FaceModelPaths {
|
||||
detector: PathBuf::from(detector),
|
||||
embedder: PathBuf::from(embedder),
|
||||
// A measurement tool for the detector and embedder; the eye
|
||||
// models are the library pass's business.
|
||||
eyes: None,
|
||||
},
|
||||
MODEL_ID.to_string(),
|
||||
dr_face::DetectOptions::default(),
|
||||
);
|
||||
@@ -222,7 +227,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
if let Ok(a) = faces::audit(&catalog, &store, MODEL_ID) {
|
||||
if let Ok(a) = faces::audit(&catalog, &store, MODEL_ID, false) {
|
||||
println!("{}", a.summary());
|
||||
}
|
||||
println!("\nrun again with --cluster to group these faces into people.");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! TRACES: FR-CULL-8 | FR-EXP-9
|
||||
//! Measure what indexing at native resolution is actually worth.
|
||||
//!
|
||||
//! cargo run -p dr-ui --example face_native -- DET.onnx EMB.onnx FILE [FILE…]
|
||||
//! cargo run -p dr-ui --example face_native -- DET.onnx EMB.onnx [--export DIR] FILE [FILE…]
|
||||
//!
|
||||
//! Renders each file once at native resolution, then indexes it twice: the way
|
||||
//! FR-CULL-8 now specifies, and the way it used to be done — everything, both
|
||||
@@ -13,6 +13,10 @@
|
||||
//! this is evidence about what the new code does, on the same photographs, with
|
||||
//! nothing between the two runs but the resolution.
|
||||
//!
|
||||
//! `--export DIR` also writes each native render out as a JPEG, so the
|
||||
//! model-free tooling in `dr-face`'s examples — `eyes` above all — can be
|
||||
//! run over native pixels rather than proxies (docs/faces.md §17.4).
|
||||
//!
|
||||
//! The models must have had their input dims frozen first; see
|
||||
//! `tools/fix-face-model-shapes.sh`.
|
||||
|
||||
@@ -23,11 +27,18 @@ const MODEL_ID: &str = "w600k_mbf";
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
let mut args: Vec<String> = std::env::args().skip(1).collect();
|
||||
let export = args.iter().position(|a| a == "--export").map(|i| {
|
||||
args.remove(i);
|
||||
PathBuf::from(args.remove(i))
|
||||
});
|
||||
if args.len() < 3 {
|
||||
eprintln!("usage: face_native DETECTOR.onnx EMBEDDER.onnx FILE [FILE…]");
|
||||
eprintln!("usage: face_native DETECTOR.onnx EMBEDDER.onnx [--export DIR] FILE [FILE…]");
|
||||
std::process::exit(2);
|
||||
}
|
||||
if let Some(d) = &export {
|
||||
std::fs::create_dir_all(d).expect("export dir");
|
||||
}
|
||||
let (detector_model, embedder_model) = (PathBuf::from(&args[0]), PathBuf::from(&args[1]));
|
||||
|
||||
let Some(gpu) = pollster::block_on(dr_gpu::GpuContext::new_headless()).ok() else {
|
||||
@@ -76,10 +87,27 @@ fn main() {
|
||||
}
|
||||
};
|
||||
let (w, h) = (frame.width as usize, frame.height as usize);
|
||||
|
||||
let native =
|
||||
dr_ui::faces::index_native(&mut detector, &mut embedder, &frame.rgba, w, h, &options)
|
||||
if let Some(dir) = &export {
|
||||
let stem = std::path::Path::new(path)
|
||||
.file_stem()
|
||||
.map(|s| s.to_string_lossy().into_owned())
|
||||
.unwrap_or_default();
|
||||
match dr_thumbs::codec::encode_rgba(frame.width, frame.height, &frame.rgba) {
|
||||
Ok(bytes) => std::fs::write(dir.join(format!("{stem}.jpg")), bytes).expect("write"),
|
||||
Err(e) => println!("{path}: export: {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
let native = dr_ui::faces::index_native(
|
||||
&mut detector,
|
||||
&mut embedder,
|
||||
None,
|
||||
&frame.rgba,
|
||||
w,
|
||||
h,
|
||||
&options,
|
||||
)
|
||||
.unwrap_or_default();
|
||||
|
||||
// The old path, reproduced exactly: one buffer at 1024, used for both
|
||||
// detection and the crop.
|
||||
@@ -89,9 +117,10 @@ fn main() {
|
||||
rgba: frame.rgba.clone(),
|
||||
};
|
||||
small.downscale_to(dr_thumbs::ThumbSize::Large.edge());
|
||||
let proxy = dr_ui::faces::index_preview(&mut detector, &mut embedder, &small, &options)
|
||||
.map(|(f, _)| f)
|
||||
.unwrap_or_default();
|
||||
let proxy =
|
||||
dr_ui::faces::index_preview(&mut detector, &mut embedder, None, &small, &options)
|
||||
.map(|(f, _)| f)
|
||||
.unwrap_or_default();
|
||||
|
||||
let mean = |v: &[dr_catalog::faces::DetectedFace]| {
|
||||
if v.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user