Skip to content

Defer video/pose frame-count check off project load (KLAUS-505)#412

Open
gbeane wants to merge 3 commits into
mainfrom
feature/klaus-505-defer-frame-check
Open

Defer video/pose frame-count check off project load (KLAUS-505)#412
gbeane wants to merge 3 commits into
mainfrom
feature/klaus-505-defer-frame-check

Conversation

@gbeane

@gbeane gbeane commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Removes the up-front video/pose frame-count validation from project load. Today every video file is opened via cv2.VideoCapture at 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_check now defaults to False; when True it performs the (now opt-in) up-front sweep.
  • The check is deferred to when a video is actually opened: CentralWidget.load_video shows a non-blocking warning (MessageDialog) on a video/pose frame mismatch, at zero extra I/O (the pose and player are already open).
  • Feature-extraction workers log a warning on mismatch for headless/batch runs.
  • New get_fps_and_nframes reads 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_check to False in Project/VideoManager, making the up-front sweep opt-in.
  • Add deferred mismatch reporting: GUI warning on CentralWidget.load_video() and worker-side logging in parallel_workers.
  • Introduce get_fps_and_nframes() to read FPS and frame count from one cv2.VideoCapture open; 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.

Comment thread src/jabs/ui/main_window/central_widget.py Outdated
Comment thread src/jabs/video_reader/utilities.py
@gbeane gbeane requested review from bergsalex and keithshep July 14, 2026 20:49
…er-frame-check

# Conflicts:
#	tests/ui/test_central_widget.py
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