Spaces:
Sleeping
Sleeping
|
Download docs/implementation_plan.md from NamanBhatia-NB/ClipSense_AI: direct link, hf CLI and curl.
- Browser
- Download file 5.89 kB
-
https://huggingface.co/spaces/NamanBhatia-NB/ClipSense_AI/resolve/main/docs/implementation_plan.md
- Command line
-
hf download hf://spaces/NamanBhatia-NB/ClipSense_AI/docs/implementation_plan.md
-
curl -L -o implementation_plan.md https://huggingface.co/spaces/NamanBhatia-NB/ClipSense_AI/resolve/main/docs/implementation_plan.md
5.89 kB
| # Implementation Plan - ClipSense Architecture & W1: Modular Architecture and Schemas | |
| ## Architecture Overview | |
| ClipSense is a multimodal video clipping system designed around four independent evidence experts, continuous floating-point temporal reasoning, and explicit code-level evidence arbitration: | |
| ``` | |
| Input Video | |
| β | |
| Multimodal Data Extraction | |
| βββ Timestamped Transcript (WhisperX word alignments) | |
| βββ Video Frames (Scene cuts + sampled frames) | |
| βββ Audio Prosody (F0 pitch + RMS dynamics via Librosa/SciPy) | |
| βββ Speaker / Conversation Information (Turn structure & pause timeline) | |
| β | |
| Four Independent Evidence Experts | |
| βββ Transcript Expert (Semantic importance & contextual completeness) | |
| βββ Visual Expert (Visual activity, shot pacing, pluggable representations) | |
| βββ Prosody Expert (Acoustic emphasis, dynamic pitch variation) | |
| βββ Conversation Expert (Conversational structure, turn exchanges) | |
| β | |
| Structured Temporal Evidence (Preserved independently; NO score collapse) | |
| β | |
| Evidence Aggregation & Auxiliary Normalization | |
| (Continuous timestamps preserved; auxiliary temporal grid for indexing) | |
| β | |
| Multimodal Temporal Evidence Reasoner (MTER) | |
| (Programmatic overlap/agreement, conflict analysis, semantic verification) | |
| β | |
| Final Temporal Boundaries | |
| β | |
| Temporal Boundary Refinement / Rule-Based Boundary Optimization | |
| (Fine-grained adjustments, pause snapping, dead-air trimming) | |
| β | |
| Downstream Video Render (LR-ASD active speaker, 9:16 reframe, ASS subtitles, FFmpeg) | |
| β | |
| Final Short Clip | |
| ``` | |
| ## Alignment on Architectural Constraints | |
| 1. **Single Repository**: Single ClipSense codebase; no baseline/research fragmentation. | |
| 2. **Four Independent Experts**: Transcript, Visual, Prosody, and Conversation. | |
| 3. **No Premature Score Collapse**: Expert outputs are kept as independent structured temporal proposals. No scalar aggregation before MTER. | |
| 4. **Authoritative Continuous Timestamps**: Floating-point timestamps (`float` in seconds) are strictly preserved. The 1-second grid is strictly an auxiliary view. | |
| 5. **Confidence Estimates**: Terminology uses "confidence estimate" rather than calibrated probabilities. | |
| 6. **Configurable Baselines & Thresholds**: No hard-coded research claims (e.g. pitch z-score > 2.0); all thresholds reside in `app/config.py`. | |
| 7. **Overlapping Proposals Allowed**: Proposals from multiple experts can and should overlap for agreement analysis. | |
| 8. **Boundary Refinement**: Termed "Temporal Boundary Refinement" or "Rule-based Boundary Optimization" (never "neurosymbolic"). | |
| 9. **Semantic Completeness Criteria in MTER**: Natural semantic start, sufficient context, key content retained, conversational payoff, no mid-sentence ending. | |
| 10. **Role Separation**: MTER selects supported temporal regions; Boundary Optimizer performs fine-grained boundary adjustments. | |
| 11. **Programmatic MTER Pipeline**: Overlap/agreement, conflict detection, proposal reconciliation, evidence-strength comparison, semantic verification, boundary selection. | |
| 12. **W1βW5 Scope**: | |
| - W1: Architecture + schemas | |
| - W2: Multimodal extraction | |
| - W3: Transcript + Conversation Experts | |
| - W4: Visual + Prosody Experts | |
| - W5: Common evidence bundle + timestamp normalization + MTER interface + deterministic prototype | |
| 13. **Honest Scope**: No claims of full MTER implementation or performance improvements during W1βW5. | |
| 14. **No PyAnnote**: Diarization and turn transitions derived from WhisperX and acoustic silences. | |
| 15. **Pluggable Visual Encoder**: Abstract interface allowing interchangeable visual representations. | |
| 16. **No Unsupported Concepts**: Avoid claims of virality prediction, emotion recognition, or viewer retention. | |
| 17. **Source Metadata**: `TemporalProposal` carries `ProposalSourceMetadata` recording source type, temporal resolution, and anchor. | |
| 18. **W1 Implementation First**: Implement only W1 now. | |
| --- | |
| ## W1 Deliverables | |
| ### `backend/` | |
| - `core/schemas.py`: Pydantic contracts for extraction, 4 independent experts, proposals, continuous timestamps, evidence bundles, and MTER criteria. | |
| - `app/config.py`: Centralized configurable thresholds and baseline parameters. | |
| - `core/storage.py`: Storage and ephemeral workspace management. | |
| - `pipeline/experts/base.py`: Base expert contract and pluggable visual encoder protocol. | |
| - `pipeline/orchestrator.py`: Pipeline orchestrator stub with invariant validation. | |
| - `tests/test_w1_architecture.py`: Automated verification suite for W1 contracts. | |
| --- | |
| ## W2 Deliverables | |
| ### `backend/` | |
| - `pipeline/extraction/transcript_extractor.py`: WhisperX transcription and forced alignment with word-level continuous timestamps, speaker metadata, PyTorch 2.6+ checkpoint compatibility patch, and strict mode. | |
| - `pipeline/extraction/frame_extractor.py`: Uniform frame sampling (1 fps) and scene cut detection preserving frame-level continuous timestamps. | |
| - `pipeline/extraction/prosody_extractor.py`: Physical acoustic feature extraction (autocorrelation F0 pitch, RMS energy, dynamic range, voicing fraction, speaking rate) over continuous sliding windows. | |
| - `pipeline/extraction/conversation_extractor.py`: Speaker turn parsing, silence gap boundaries (>0.7s), and dialogue exchange metrics with pause-based fallback. | |
| - `pipeline/extraction/extractor_pipeline.py`: Pipeline coordinator with stage caching, deterministic `manifest.json` generation, terminal checkmarks (`[β]`), and timestamp duration validation. | |
| - `tests/test_w2_extractors.py`: Unit tests for frame, prosody, and conversation extractors. | |
| - `tests/test_w2_smoke.py`: End-to-end extraction pipeline smoke test. | |
| - `tests/run_representative_validation.py`: Official strict-mode validation script on 90.0-second conversational sample (`tests/sample_conversational_90s.mp4`) with real WhisperX inference. | |