Skip to content

Conversation

@gitttt-1234
Copy link
Collaborator

Summary

Fixes an issue where running inference with video_index on multiple videos from the same .slp file would overwrite the output file. The output path now includes the video name to create unique filenames for each video.

Problem

When running predictions on a multi-video .slp file using the video_index parameter:

  • All predictions would save to the same output path (e.g., labels.predictions.slp)
  • Running inference on different videos would overwrite previous results
  • Users had to manually specify unique output_path for each video

Solution

When video_index is provided and output_path is None:

  • Extract the video filename from output.videos[video_index]
  • Append the video name (stem) to the output path
  • Format: <labels_file>.<video_name>.predictions.slp
  • Falls back to video_{index} if filename is not a simple string

Example

Before:

run_inference(data_path="labels.slp", video_index=0)  # → labels.predictions.slp
run_inference(data_path="labels.slp", video_index=1)  # → labels.predictions.slp (overwrites!)

After:

run_inference(data_path="labels.slp", video_index=0)  # video1.mp4 → labels.video1.predictions.slp
run_inference(data_path="labels.slp", video_index=1)  # video2.mp4 → labels.video2.predictions.slp

Changes

  • Modified run_inference() in sleap_nn/predict.py to append video name when video_index is specified
  • Added test_video_index_output_path() test to verify the behavior

Testing

  • New test verifies video name is included in output path when using video_index
  • Existing tests continue to pass (no breaking changes)
  • Behavior unchanged when video_index is None or output_path is explicitly provided

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

gitttt-1234 and others added 2 commits November 21, 2025 11:51
When running inference with video_index parameter to predict on a specific
video from a multi-video .slp file, the output path now includes the video
name to prevent overwrites. This allows users to run predictions on multiple
videos from the same .slp file without manually specifying output paths.

Changes:
- Modified run_inference() to append video filename stem to output path
  when video_index is provided and output_path is None
- Format: <labels_file>.<video_name>.predictions.slp
- Falls back to video_{index} if filename is not a simple string
- Added test_video_index_output_path() to verify behavior

Example:
- Before: labels.slp + video_index=0 → labels.predictions.slp
- After:  labels.slp + video_index=0 (video1.mp4) → labels.video1.predictions.slp

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.83%. Comparing base (ff91433) to head (d4a8e26).
⚠️ Report is 68 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #378      +/-   ##
==========================================
- Coverage   95.28%   93.83%   -1.46%     
==========================================
  Files          49       49              
  Lines        6765     7185     +420     
==========================================
+ Hits         6446     6742     +296     
- Misses        319      443     +124     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gitttt-1234 gitttt-1234 merged commit 5ec062b into main Nov 21, 2025
12 of 13 checks passed
@gitttt-1234 gitttt-1234 deleted the divya/video-specific-output-path branch November 21, 2025 21:01
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