[MS-1540] Enable age and gender estimation in face capture processing - #1777
[MS-1540] Enable age and gender estimation in face capture processing#1777meladRaouf wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Enables optional age and gender estimation as part of face capture processing, propagating the new fields from detector implementations through capture event reporting and API payload serialization, while shifting the enrichment step to run only once on the final accepted captures.
Changes:
- Extended face detection models and event payloads to include
ageandgenderfields. - Updated
FaceDetector.analyze(...)and implementations (ROC v1/v3 + SimFace) to accept anestimateAgeAndGenderflag. - Added capture-flow enrichment logic + tests to ensure age/gender inference runs only once on final accepted captures (and fallback), avoiding per-retry redundant inference.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| infra/events/src/main/java/com/simprints/infra/events/event/domain/models/FaceCaptureEvent.kt | Adds age/gender to persisted domain event payload model. |
| infra/event-sync/src/main/java/com/simprints/infra/eventsync/event/remote/models/ApiFaceCapturePayload.kt | Adds age/gender to API payload and maps domain → API. |
| face/infra/base-bio-sdk/src/main/java/com/simprints/face/infra/basebiosdk/detection/FaceDetector.kt | Extends detector API with estimateAgeAndGender (default false) and documents intended usage. |
| face/infra/base-bio-sdk/src/main/java/com/simprints/face/infra/basebiosdk/detection/Face.kt | Extends Face model with age + gender probabilities. |
| face/infra/roc-v1/src/main/java/com/simprints/face/infra/rocv1/detection/RocV1Detector.kt | Wires ROC v1 native outputs for age/gender into returned Face. |
| face/infra/roc-v3/src/main/java/com/simprints/face/infra/rocv3/detection/RocV3Detector.kt | Wires ROC v3 native outputs for age/gender into returned Face. |
| face/infra/simface/src/main/java/com/simprints/face/infra/simface/detection/SimFaceDetector.kt | Updates SimFace detector to match new analyze signature. |
| face/capture/src/main/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackViewModel.kt | Adds end-of-flow enrichment that re-analyzes accepted captures with estimateAgeAndGender = true. |
| face/capture/src/main/java/com/simprints/face/capture/usecases/SimpleCaptureEventReporter.kt | Includes age/gender when mapping face detections to event payloads. |
| face/capture/src/test/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackViewModelTest.kt | Adds tests verifying enrichment happens once (and not per spoof-check retry). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- SimFaceDetector: restore 1-arg analyze() overload for source compatibility with existing direct call sites (Kotlin doesn't allow default values on override parameters). - LiveFeedbackViewModel: freeze frame processing by switching to VALIDATING phase before enrichment/event writes in sendEventsAndFinish(), preventing concurrent mutation of userCaptures/fallbackCapture when spoof check is DISABLED/RECORDED. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f1bde6f to
7ee4f4e
Compare
7ee4f4e to
39462b9
Compare
|
| override fun analyze(bitmap: Bitmap): Face? = runBlocking { | ||
| // Overload preserving source compatibility with the previous 1-arg API for direct callers | ||
| // of this concrete type (the interface already defaults `estimateAgeAndGender` to false). | ||
| fun analyze(bitmap: Bitmap): Face? = analyze(bitmap, estimateAgeAndGender = false) |
There was a problem hiding this comment.
Am I missing something or is there no way to enable this outside of the code? Are you planning to add the custom configuration for it or will it be enabled by default?


MS-1540
Will be released in: 2026.3.0
Notable changes
LiveFeedbackViewModel.enrichCapturesWithAgeAndGender()only runsfaceDetector.analyze(..., estimateAgeAndGender = true)once, on the final accepted set of captures + fallback (insendEventsAndFinish), instead of on every failed spoof-check retry to avoid redundant native inference on discarded samples.age/genderfields toFace,FaceDetector.analyze, event payload (ApiFaceCapturePayload) andFaceCaptureEvent, and wired estimation throughRocV1Detector,RocV3Detector, andSimFaceDetector.Testing guidance
LiveFeedbackViewModelTest— includes new tests verifying enrichment happens exactly once on the accepted captures and is not repeated on failed spoof-check retries.Additional work checklist