Skip to content

Sequential detection fixes and optimizations#246

Merged
Glat0s merged 1 commit into
VisoMasterFusion:devfrom
Elricfae:dev
May 14, 2026
Merged

Sequential detection fixes and optimizations#246
Glat0s merged 1 commit into
VisoMasterFusion:devfrom
Elricfae:dev

Conversation

@Elricfae
Copy link
Copy Markdown
Contributor

🎯 Smart Temporal Tracking System — Replacing Fast-Path Batch Processing

Overview:
This PR introduces a temporal memory-based face tracking system that intelligently bridges gaps in identity recognition caused by profile angles, occlusions, and motion blur. It replaces the previous "fast-path" and "force_recognition_in_batch" approach with a more robust frame-to-frame continuity mechanism.

Key Changes:

1. Temporal Memory Integration (sequential_detector.py)

  • Added _temporal_memory state to track verified faces across frames
  • Implements a two-pass filtering strategy:
    • Pass 1 (Strict): Standard ArcFace identity verification via UI thresholds
    • Pass 2 (Rescue): Temporal matching using IoU + embedding cosine similarity (>0.75 threshold) for faces rejected in Pass 1
  • Temporal memory resets per frame to prevent identity drift

2. Jump-Cut Protection

  • Frames verified faces with cosine similarity checks to prevent sudden identity swaps between frames
  • Only accepts temporal matches with >0.75 similarity (indicating continuous physical movement vs. jump cuts)

3. Frame Worker Architecture Fix (frame_worker.py)

  • Added is_sequentially_tracked flag to distinguish between faces vetted by sequential detector vs. inline detection
  • Temporally-rescued faces bypass strict UI similarity thresholds (set to 0.0) in the FrameWorker
  • Ensures rescued faces aren't rejected a second time downstream

4. Removed Batch-Mode Hacks

  • ❌ Removed force_recognition_in_batch global flag
  • ❌ Removed fast-path single-face bypass logic
  • ❌ Removed relaxed-threshold fallback passes
  • ❌ Removed batch-specific UI state injection in job_manager_actions.py and video_control_actions.py

5. Early Exit Optimization

  • Added fast return path when no faces survive filtering (skips landmark detection entirely)

6. Improved Output Safety

  • Refined array casting logic to handle dynamic landmark dimensions (5, 68, 203, 478+ points)
  • Better NaN/Inf sanitization with fewer redundant copies

Why This Works Better:

  • ✅ Handles occlusions and profile angles naturally via temporal continuity
  • ✅ No more UI state pollution from batch processing
  • ✅ Cleaner, more maintainable code (removed 200+ lines of batch-specific logic)
  • ✅ Temporally-aware identity rescue without compromising performance
  • ✅ Works seamlessly for both batch and real-time processing

@Elricfae Elricfae added the minor New feature, backwards compatible label May 14, 2026
@Glat0s Glat0s merged commit f2313a6 into VisoMasterFusion:dev May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New feature, backwards compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants