feat: Speaker Reaction Detection module (Goal 2 / Mid-Point Milestone)#21
Open
bhuvan-somisetty wants to merge 2 commits into
Open
feat: Speaker Reaction Detection module (Goal 2 / Mid-Point Milestone)#21bhuvan-somisetty wants to merge 2 commits into
bhuvan-somisetty wants to merge 2 commits into
Conversation
Signed-off-by: bhuvan-somisetty <somisettybhuvan5@gmail.com>
Implements the mid-point milestone from issue PlanetRead#2: visual analysis of video frames around each detected audio event to assign a reaction confidence score. src/vision/extractor.py — FrameExtractor Extracts a configurable reaction window (default: 100 ms before onset, 1 500 ms after end, sampled at 5 fps) from any OpenCV-readable video. All cv2 imports are deferred so the module is importable without OpenCV. src/vision/reaction.py — ReactionDetector Analyses a FrameWindow and returns a ReactionResult (score in [0, 1]). Three signals are fused with fixed weights (45 / 35 / 20): 1. Optical-flow motion magnitude via cv2.calcOpticalFlowFarneback 2. MediaPipe Face Mesh nose-tip shift (head turns / flinches) 3. Mouth-open ratio from lip/eye landmarks (surprise expressions) If mediapipe is absent, head/mouth scores fall back to 0 and only motion contributes — no ImportError at runtime. 52 tests pass (26 new + 26 existing Goal 1 tests), no ML stack required. Refs PlanetRead#2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Goal 2 — Speaker Reaction Detection Module from issue #2, completing the mid-point milestone.
src/vision/extractor.py—FrameExtractor: extracts a configurable reaction window (100 ms before onset → 1 500 ms after event end, sampled at 5 fps) from any OpenCV-readable video file. Heavycv2imports are deferred so the module is importable without OpenCV installed.src/vision/reaction.py—ReactionDetector: analyses aFrameWindowand returns aReactionResultwith areaction_scorein [0, 1]. Three signals are fused with fixed weights (45 / 35 / 20 %):cv2.calcOpticalFlowFarneback) — catches sudden scene-wide movement after the event onsetIf MediaPipe is not installed, head/mouth scores fall back to 0 and motion alone contributes — no
ImportErrorat runtime.Test plan
FrameExtractorandReactionDetector— all cv2 / mediapipe calls are mocked atsys.moduleslevel, no ML stack neededpytest tests/ -v): 26 new (Goal 2) + 26 existing (Goal 1)ReactionResultoutput connects directly into the CC Decision Engine (Goal 3):reaction_scoreis the visual confidence value that will be fused withAudioEvent.confidenceRefs #2