Skip to content

Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods#3092

Merged
AlexEMG merged 6 commits intomainfrom
maxim/fix_convert_detections2tracklets_snapshot_indexes
Sep 16, 2025
Merged

Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods#3092
AlexEMG merged 6 commits intomainfrom
maxim/fix_convert_detections2tracklets_snapshot_indexes

Conversation

@maximpavliv
Copy link
Copy Markdown
Contributor

@maximpavliv maximpavliv commented Sep 12, 2025

Summary

This PR fixes a bug in the PyTorch analyze_videos pipeline and extends the API for consistency across high-level methods.

Bug Fix

  • Issue: When calling analyze_videos() with non-default snapshot_index or detector_snapshot_index arguments, predictions used the correct indexes, but the tracking stages (convert_detections2tracklets() and stitch_tracklets()) always defaulted to the values from config.yaml. This caused crashes.

  • Fix: Routed the argument-specified indexes through to the tracking methods, ensuring consistent behavior.

API Extension

  • Added **torch_kwargs to the following methods:

    • create_labeled_videos
    • create_video_with_all_detections
    • plot_trajectories
    • filterpredictions
    • extract_outlier_frames
    • analyzeskeleton
  • Similarly to analyze_videos, these methods now support overriding snapshot_index and detector_snapshot_index via arguments, in addition to the existing config.yaml options.

This keeps the PyTorch backend consistent with TensorFlow while providing more flexibility to users.

@maximpavliv maximpavliv changed the title Add snapshot_index and detector_snapshot_index parameters to API methods Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods Sep 12, 2025
@maximpavliv maximpavliv changed the title Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods Fix snapshot index handling in PyTorch analyze_videos() and extend overrides to other methods Sep 12, 2025
@maximpavliv maximpavliv changed the title Fix snapshot index handling in PyTorch analyze_videos() and extend overrides to other methods Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods Sep 12, 2025
@maximpavliv maximpavliv changed the title Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods [WIP] Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods Sep 12, 2025
@maximpavliv maximpavliv added the WORK IN PROGRESS! developers are currently working on this feature... stay tuned. label Sep 12, 2025
@maximpavliv maximpavliv force-pushed the maxim/fix_convert_detections2tracklets_snapshot_indexes branch from 9409664 to 2ce7d29 Compare September 12, 2025 10:51
@maximpavliv maximpavliv changed the title [WIP] Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods Fix snapshot index handling in PyTorch analyze_videos and extend overrides to other methods Sep 12, 2025
@maximpavliv maximpavliv added bug fix! fix for a real buggy one... DLC3.0🔥 and removed WORK IN PROGRESS! developers are currently working on this feature... stay tuned. labels Sep 12, 2025
@arashsm79
Copy link
Copy Markdown
Contributor

Tested the different methods with some videos with this PR across a bunch of projects and different snapshots for both the pose and detector models.
Everything worked fine. Thanks.
LGTM.

@AlexEMG AlexEMG merged commit 62df09a into main Sep 16, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix! fix for a real buggy one... DLC3.0🔥

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants