| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Introduce optional safeties and helpers to VideoSelectionWidget: add constructor flags sync_videotype_with_selection and strict_videotype_filter (defaults preserve existing behavior). New methods: selected_suffixes, get_effective_videotype, get_files_grouped_by_suffix, _set_videotype_silently and _build_video_filter. update_videos now uses the built filter and can silently infer/update the videotype dropdown when a single-suffix selection is added, logging the inference or warning on mixed suffixes. These changes enable stricter file-dialog filtering and optional automatic videotype synchronization without clearing the current selection.
Introduce AnalyzeVideosOptions dataclass and refactor AnalyzeVideos flow to separate option collection, batching and execution. Collect GUI state in _collect_options, group selected videos by extension via _get_video_batches, and run per-extension processing in _run_pipeline with post-processing in _run_postprocessing_for_group. Preserve multianimal behavior (calibration, tracking, CSV conversion) and sync default_track_method to config before launching the worker. Also add improved logging/error handling, handle dynamic/cropping flags more robustly, and adjust VideoSelectionWidget construction to hide and sync videotype selection.
There was a problem hiding this comment.
Refactors the DeepLabCut GUI “Analyze Videos” tab to make video-type handling more robust by inferring/grouping selected videos by file extension, and to streamline how analysis/post-processing options are collected and executed.
Changes:
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| deeplabcut/gui/tabs/analyze_videos.py | Introduces options dataclass, batches analysis by suffix, and runs post-processing per batch in the worker thread. |
| deeplabcut/gui/components.py | Adds videotype inference/grouping helpers and optional UI safeties (sync dropdown, strict dialog filtering). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Add validation to VideoSelectionWidget.set_root_videotype: normalize the provided videotype and check it against the QComboBox items. If the videotype is empty or not present in the combo box, keep the current selection and emit a warning instead of changing state. Only update the widget and root.video_type when the value is valid. This prevents silently setting unsupported or empty videotypes and preserves the existing selection.
Normalize and centralize videotype handling and improve video-selection UX. - Add _normalize_videotype to enforce lowercase, dot-less videotype values and use it across the widget (initial dropdown, silent set, update_videotype, get_effective_videotype). - Add typing hints and small docstring fixes for properties and methods. - Improve file dialog filtering: introduce _all_supported_video_patterns and a refactored _build_video_filter that respects strict_videotype_filter and falls back to showing all supported types when appropriate. - Enhance selected-videos display to show suffix summaries and batch info when multiple suffixes are selected. - Add helper get_files_grouped_by_suffix typing and minor logging/message formatting improvements. These changes make videotype state consistent, avoid accidental leading dots/case issues, produce clearer UI feedback, and build more predictable file-dialog filters.
Tighten and clarify type annotations in AnalyzeVideosOptions: change displayed_bodyparts from list[str] to tuple[str, ...]; specify cropping as tuple[int, int, int, int] | None; and set dynamic_cropping_params to tuple[bool, float, int]. These updates improve static type checking and express intended immutability/structure of these fields.
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Convert displayed_bodyparts to a tuple (or empty tuple) when plotting trajectories to ensure an immutable/consistent type is passed downstream. When an exception occurs while analyzing a group of videos, build a single message string, log it with exc_info, and re-raise a RuntimeError (chaining the original exception) so the failure is propagated for higher-level handling.
Add logic to deduplicate video parent directories and convert H5 outputs to CSV once per unique folder. Imports pathlib.Path and adds _get_unique_video_parent_folders to collect resolved parent folders, plus _convert_outputs_to_csv_once_per_folder which logs and calls deeplabcut.analyze_videos_converth5_to_csv(folder, listofvideos=False). The conversion is now invoked from _run_pipeline when options.auto_track and options.save_as_csv to avoid repeated per-video/batch conversions.
| Back | FazBrowse Home | New Git URL |
Scope
This helps in setting up a robust foundation for future changes related to video selection and type inference.
Tested successfully on a mix of mp4/avi videos, analysis runs as expected and results are correct.
Goals
Streamline UX for analyzing videos, making it simpler to run on mixed videos.
Intended to help close #3260, further fixes may be made accordingly
Backward compatibility note
Automated summary
This pull request introduces significant improvements to the video analysis workflow in the DeepLabCut GUI, focusing on more robust handling of video file types, improved batch processing, and cleaner separation of options and logic. Key changes include enhanced video type inference and filtering, a new options dataclass, and a refactored analysis pipeline that processes videos in groups by file extension.
Video selection and file type handling:
Analysis workflow refactor:
Post-processing improvements: