Skip to content

[MS-1540] Enable age and gender estimation in face capture processing - #1777

Open
meladRaouf wants to merge 2 commits into
mainfrom
feature/enable-gender-and-age-in-roc
Open

[MS-1540] Enable age and gender estimation in face capture processing#1777
meladRaouf wants to merge 2 commits into
mainfrom
feature/enable-gender-and-age-in-roc

Conversation

@meladRaouf

@meladRaouf meladRaouf commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

MS-1540
Will be released in: 2026.3.0

Notable changes

  • Enable age and gender estimation during face capture processing.
  • LiveFeedbackViewModel.enrichCapturesWithAgeAndGender() only runs faceDetector.analyze(..., estimateAgeAndGender = true) once, on the final accepted set of captures + fallback (in sendEventsAndFinish), instead of on every failed spoof-check retry to avoid redundant native inference on discarded samples.
  • Added age/gender fields to Face, FaceDetector.analyze, event payload (ApiFaceCapturePayload) and FaceCaptureEvent, and wired estimation through RocV1Detector, RocV3Detector, and SimFaceDetector.

Testing guidance

  • Run LiveFeedbackViewModelTest — includes new tests verifying enrichment happens exactly once on the accepted captures and is not repeated on failed spoof-check retries.
  • Manually verify captured face events include age/gender data when the feature is enabled.
  • A/B performance analysis is here

Additional work checklist

  • Effect on other features and security has been considered
  • Design document marked as "In development" (if applicable)
  • External (Gitbook) and internal (Confluence) Documentation is up to date (or ticket created)
  • Test cases in Testiny are up to date (or ticket created)
  • Other teams notified about the changes (if applicable)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 age and gender fields.
  • Updated FaceDetector.analyze(...) and implementations (ROC v1/v3 + SimFace) to accept an estimateAgeAndGender flag.
  • 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.

meladRaouf added a commit that referenced this pull request Aug 12, 2026
- 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>
@meladRaouf
meladRaouf force-pushed the feature/enable-gender-and-age-in-roc branch from f1bde6f to 7ee4f4e Compare August 12, 2026 07:11
@meladRaouf
meladRaouf marked this pull request as ready for review August 12, 2026 09:10
@meladRaouf
meladRaouf force-pushed the feature/enable-gender-and-age-in-roc branch from 7ee4f4e to 39462b9 Compare August 12, 2026 11:11
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
74.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants