Skip to content

update selfie-logic#124

Open
WenjinFu wants to merge 3 commits into
mainfrom
add-selfie-logic
Open

update selfie-logic#124
WenjinFu wants to merge 3 commits into
mainfrom
add-selfie-logic

Conversation

@WenjinFu
Copy link
Copy Markdown
Contributor

This pull request introduces a new module, selfie_logic.py, which encapsulates the logic for the selfie enrollment pipeline in a stateless, testable, and reusable way. It also refactors the gallery embedding methods for clarity and batch processing, adds new configuration options for the selfie pipeline, and improves the handling of frame state and sample deduplication. These changes enable robust, multi-frame, quality-gated selfie enrollment with deduplication and identity management.

Selfie enrollment pipeline logic:

  • Added new selfie_logic.py module containing all stateless logic for selfie enrollment, including engagement scoring, ambiguity detection, quality checks, identity name validation, deduplication, and running mean updates for multi-frame processing. This centralizes and documents the decision logic, making it reusable and easier to maintain.
  • Registered the new selfie_logic module in the package __init__.py.

Gallery embedding and batch enrollment:

  • Refactored the gallery embedding method: renamed _embed_single to embed_aligned and made it public for use by both internal and external callers (e.g., the selfie pipeline).
  • Added add_aligned_no_stats method to gallery.py for efficient batch enrollment: allows adding multiple aligned snapshots without recomputing stats after each, and supports passing precomputed embeddings to avoid redundant computation. Also added a recompute_stats public method for batch stat updates.

Selfie pipeline configuration and state:

  • Extended the runtime configuration with new selfie pipeline parameters, such as collection window, sample count limits, engagement and quality thresholds, and deduplication/consistency thresholds. These parameters are hot-tunable via /config.
  • Enhanced the _FrameState class to track last_ts, a monotonic timestamp used by the selfie pipeline to detect frame changes and prevent redundant processing. [1] [2] [3]

Minor improvements:

  • Improved docstrings and parameter validation throughout the updated and new methods.

These changes collectively provide a robust foundation for multi-frame, quality-controlled, and deduplicated selfie enrollment in the system.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants