Defer video/pose frame-count check off project load (KLAUS-505)#412
Open
gbeane wants to merge 3 commits into
Open
Defer video/pose frame-count check off project load (KLAUS-505)#412gbeane wants to merge 3 commits into
gbeane wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces expensive project-load latency by making the video/pose frame-count validation opt-in at load time and deferring mismatch reporting to (a) GUI video-open time and (b) headless feature-extraction workers, while adding a single-open helper to fetch FPS + frame count.
Changes:
- Default
enable_video_checktoFalseinProject/VideoManager, making the up-front sweep opt-in. - Add deferred mismatch reporting: GUI warning on
CentralWidget.load_video()and worker-side logging inparallel_workers. - Introduce
get_fps_and_nframes()to read FPS and frame count from onecv2.VideoCaptureopen; update tests accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ui/test_central_widget.py | Adds unit tests for the GUI mismatch message helper. |
| tests/project/test_project.py | Updates project-load tests to reflect deferred-by-default behavior and opt-in failure behavior. |
| tests/project/test_parallel_workers.py | Updates worker tests to use get_fps_and_nframes and adds logging coverage for mismatch warnings. |
| src/jabs/video_reader/utilities.py | Adds get_fps_and_nframes() to fetch FPS + frame count from a single video open. |
| src/jabs/ui/main_window/central_widget.py | Adds mismatch message builder and triggers a GUI warning on deferred mismatch detection during video open. |
| src/jabs/project/video_manager.py | Changes enable_video_check default to False and updates docstrings accordingly. |
| src/jabs/project/project.py | Changes enable_video_check default to False and clarifies deferred validation behavior in docs. |
| src/jabs/project/parallel_workers.py | Uses get_fps_and_nframes() and logs warnings on video/pose frame-count mismatches for headless runs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…er-frame-check # Conflicts: # tests/ui/test_central_widget.py
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
Removes the up-front video/pose frame-count validation from project load. Today every video file is opened via
cv2.VideoCaptureat load to compare its frame count against the pose file — the dominant, cache-resistant load cost on large projects.Measured on a 488-video project (external SSD): the video reads were ~24.5s of the load scan (91%), and even a fully warm parallel load went 0.11s → 1.84s solely because of this check.
What changed
enable_video_checknow defaults toFalse; whenTrueit performs the (now opt-in) up-front sweep.CentralWidget.load_videoshows a non-blocking warning (MessageDialog) on a video/pose frame mismatch, at zero extra I/O (the pose and player are already open).get_fps_and_nframesreads fps + frame count from a single video open.Rationale
The training / feature / prediction pipeline is pose-driven — features come from the pose file and labels are indexed to pose frames. A video/pose frame mismatch does not corrupt features or predictions; it only affects frame-display alignment in the labeling GUI. So the correct home for the check is video-open time, not project load.
Tests
Full suite green. New/updated coverage: the deferred default performs no video opens, the opt-in path (
enable_video_check=True) still raises on an unreadable video, the worker logs on mismatch, and the GUI mismatch message helper.Jira: KLAUS-505