feat: prioritize detected faces for automatic gravity - #11
Conversation
Greptile SummaryThe PR adds face-first automatic gravity using YuNet, retains U²-Net saliency as the fallback, shares the ONNX Runtime environment across model sessions, and exposes the selected source through the API and telemetry. Changes since the previous review move the documentation comparison images into the public asset directory and reference them using the site’s established root-absolute URL convention.
Confidence Score: 5/5The PR appears safe to merge, with no outstanding correctness, security, or repository-rule issues identified. The current implementation consistently prioritizes reliable face detections, preserves saliency fallback on errors or absent faces, safely shares the ONNX Runtime environment, and packages the required model and documentation assets. Important Files Changed
Reviews (6): Last reviewed commit: "fix(docs): package comparison images wit..." | Re-trigger Greptile |
1bc0be2 to
62f0f7e
Compare
Summary
sourceresponse field, face/source metrics, configurableFACE_SCORE_THRESHOLD, model provenance, Docker packaging, and docsThis performs face detection only. It does not identify people or generate/store biometric embeddings. Deliberately blurred faces, including the supplied example, remain on the saliency fallback rather than lowering the threshold enough to accept false positives.
Validation
mise run cimake test-integrationwith ONNX Runtime 1.23.2make test-integration-fp32with ONNX Runtime 1.23.2npm run buildandnpx tsc --noEmitindocs/source=face; landscape, back-facing person, and strongly blurred face selectsource=saliencysource=face, gravity(0.5100, 0.5237), confidence0.8814source=saliency, unchanged gravity(0.5119, 0.6294), confidence1.0The real-model suite also covers existing non-human fixtures, concurrent model sessions, cancellation, raw/multipart equivalence, and saliency fallback behavior.
Before / after verification
Each comparison runs the same checked-in fixture through saliency-only behavior on the left and face-first behavior on the right. Orange marks the old saliency point, green marks the selected primary face, yellow marks an additional detected face, and blue marks an unchanged saliency fallback. These comparison renders are attached to this description only and are not stored in the branch.
1. Centered face — saliency (0.4760, 0.6078) → face (0.4849, 0.2705)
2. Face on the left — saliency (0.2450, 0.6374) → face (0.2625, 0.2304)
3. Face on the right — saliency (0.7882, 0.6162) → face (0.7758, 0.2938)
4. Three-quarter profile — saliency (0.3705, 0.6348) → face (0.4268, 0.3377)
5. Partial occlusion — saliency (0.4985, 0.6113) → face (0.4956, 0.3202)
6. Low light — saliency (0.5939, 0.6063) → face (0.5942, 0.3759)
7. Two faces — saliency (0.3160, 0.6148) → primary face (0.3188, 0.3368)
8. Back-facing person — saliency fallback unchanged at (0.3789, 0.6337)
9. Strongly blurred face — saliency fallback unchanged at (0.4884, 0.6575)
10. No-person landscape — saliency fallback unchanged at (0.7406, 0.8016)