Revert the detection floor: it guards the wrong resolution
Reverts 53f7cdf and e92d22d. The floor those added sat on Detector::detect, refusing any buffer under 1025px on the reasoning that a small buffer finds no faces. That reasoning does not survive §4.1: the detector letterboxes every input to 640x640, so a face occupying 2% of the frame presents at 12px to the model whether it is handed a 1024px buffer or a 6000px one. Detector input is precisely the quantity that does not matter. Worse than merely useless, it blocks the design FR-CULL-8 now specifies, where the detector is deliberately fed a downscale and the crop is taken from the native render. A guard on detect() rejects exactly that call. What the measurement actually supports is a floor on the *crop* source, which is where resolution converts into embedding quality, and which faces.crop_px already records: 47% of the reference library's faces were upsampled to reach 112x112. That floor is a separate change against the native-resolution path and does not belong on the detector. The 23x faces-per-image gap by source_edge that motivated the original commit is kept in faces.md §7b, restated as the unexplained observation it is rather than the causal claim it was written as. V12 stands: those runs cropped at 1024 whatever detection did, and that is reason enough to look at them again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-37
@@ -3249,7 +3249,6 @@ pub fn spawn_face_sweep(
|
||||
let models = std::cell::RefCell::new((&mut detector, &mut embedder));
|
||||
|
||||
let (mut done, mut images, mut found, mut failed) = (0usize, 0usize, 0usize, 0usize);
|
||||
let mut too_small = 0usize;
|
||||
let mut offline = false;
|
||||
|
||||
// TRACES: FR-NC-6c
|
||||
@@ -3274,7 +3273,6 @@ pub fn spawn_face_sweep(
|
||||
let mut discard = Vec::new();
|
||||
let mut attempted = 0usize;
|
||||
let mut failed = 0usize;
|
||||
let mut too_small = 0usize;
|
||||
let mut offline = false;
|
||||
for req in lane {
|
||||
attempted += 1;
|
||||
@@ -3334,29 +3332,6 @@ pub fn spawn_face_sweep(
|
||||
};
|
||||
indexed.push((req.image_id, faces, edge, keep));
|
||||
}
|
||||
// Not a failure, and it must not
|
||||
// be retried as one. The largest
|
||||
// preview this file has is below the
|
||||
// detector's floor, so the next sweep
|
||||
// would fetch the same bytes and
|
||||
// refuse them again, for ever. A
|
||||
// marker at the true edge settles it:
|
||||
// the image leaves the work list, and
|
||||
// `source_edge` records what it was
|
||||
// examined at, so a later floor or a
|
||||
// bigger proxy can come back for it on
|
||||
// purpose rather than by accident.
|
||||
Err(dr_face::FaceError::ProxyTooSmall {
|
||||
edge, ..
|
||||
}) => {
|
||||
too_small += 1;
|
||||
indexed.push((
|
||||
req.image_id,
|
||||
Vec::new(),
|
||||
edge,
|
||||
None,
|
||||
));
|
||||
}
|
||||
Err(e) => {
|
||||
log::debug!("face sweep: {}: {e}", req.path);
|
||||
failed += 1;
|
||||
@@ -3375,15 +3350,14 @@ pub fn spawn_face_sweep(
|
||||
}
|
||||
}
|
||||
}
|
||||
(indexed, attempted, failed, too_small, offline)
|
||||
(indexed, attempted, failed, offline)
|
||||
}
|
||||
}))
|
||||
.await;
|
||||
|
||||
for (indexed, attempted, lane_failed, lane_too_small, lane_offline) in results {
|
||||
for (indexed, attempted, lane_failed, lane_offline) in results {
|
||||
done += attempted;
|
||||
failed += lane_failed;
|
||||
too_small += lane_too_small;
|
||||
offline |= lane_offline;
|
||||
for (image_id, faces, edge, keep) in indexed {
|
||||
// Before the detections, so a kill between the two
|
||||
@@ -3456,15 +3430,7 @@ pub fn spawn_face_sweep(
|
||||
}
|
||||
|
||||
log::info!(
|
||||
"face sweep: {found} face(s) across {images} image(s), {failed} failed{}{}",
|
||||
if too_small > 0 {
|
||||
format!(
|
||||
", {too_small} whose best preview is under the {}px floor",
|
||||
dr_face::MIN_DETECT_EDGE
|
||||
)
|
||||
} else {
|
||||
String::new()
|
||||
},
|
||||
"face sweep: {found} face(s) across {images} image(s), {failed} failed{}",
|
||||
if offline { ", server went away" } else { "" }
|
||||
);
|
||||
let _ = tx.send(FaceSweepMessage::Finished {
|
||||
|
||||
Reference in New Issue
Block a user