Skip to content

Conversation

@xiu-cs
Copy link
Owner

@xiu-cs xiu-cs commented Aug 4, 2025

This pull request introduces several new functionalities and improvements across multiple modules, focusing on enhanced file handling, model checkpoint management, debugging, and video processing. Below is a summary of the most significant changes:

New Features:

  • File Download from Hugging Face Hub: Added a new function download_from_huggingface_hub in deeplabcut/common_tools/download.py to facilitate downloading files from the Hugging Face Hub into a specified local directory. This includes support for subfolder paths and examples for usage.
  • JSON Indentation Utility: Introduced convert_json_indent_folder_level in deeplabcut/common_tools/json_tools.py to reformat JSON files with proper indentation, ensuring better readability and organization.

Model Checkpoint Management:

  • Epoch Retrieval for Checkpoints: Added get_checkpoint_epoch in deeplabcut/modelzoo/video_inference.py to extract the current epoch number from PyTorch checkpoint files. This is used to dynamically generate checkpoint paths during adaptation training. [1] [2] [3]
  • Dynamic Checkpoint Naming: Updated video_inference_superanimal to handle checkpoint paths dynamically based on current and adapted epochs, ensuring compatibility with various training stages. [1] [2]

Debugging Enhancements:

  • Debugging Keypoints and Bounding Boxes: Added debug print statements in deeplabcut/pose_estimation_pytorch/data/utils.py to log keypoints and bounding box data when anomalies (e.g., all-zero values) are detected. [1] [2]
  • Batch Debugging in Training: Included comments and debug print statements in deeplabcut/pose_estimation_pytorch/runners/train.py to provide insights into batch structure and dataset paths during training. [1] [2]

Miscellaneous Improvements:

  • Torch Import: Added the torch library import in deeplabcut/modelzoo/video_inference.py to support new checkpoint-related functionality.
  • Video Metadata Handling: Enhanced proc_video in deeplabcut/utils/make_labeled_video.py to load additional video-related data (full_data) for improved processing.

These changes collectively improve the functionality, maintainability, and debugging capabilities of the codebase.

xiu-cs and others added 30 commits November 19, 2024 09:51
Co-authored-by: n-poulsen <45132115+n-poulsen@users.noreply.github.com>
…lelte the redunant snapshots at the end"

This reverts commit 31d8652.
- adding in CZI badge! 🔥
* Benchmarking user guide
* Update Benchmarking_shuffle_guide.md
* Update _toc.yml

---------

Co-authored-by: Mackenzie Mathis <mathis@rowland.harvard.edu>
Co-authored-by: Mackenzie Mathis <mackenzie.mathis@epfl.ch>
Co-authored-by: Anna Stuckert <anna.stuckert97@gmail.com>
Co-authored-by: Marc Canela <marc.canela@outlook.com>
- broken link fix
…#2736)

* Create OtherData.md

- new doc, old wiki page!

* Update _toc.yml

- add to toc
* Create citation.md

* Update _toc.yml

* Update README.md
xiu-cs added 7 commits May 9, 2025 20:32
	•	Added a get_checkpoint_epoch function to retrieve the current epoch from a PyTorch checkpoint.
	•	Updated checkpoint handling logic to calculate the adapted checkpoint path.
…efully. Returns 0 if 'epoch' is not found in the checkpoint, improving robustness.
@xiu-cs xiu-cs self-assigned this Aug 4, 2025
@xiu-cs xiu-cs requested a review from Copilot August 4, 2025 13:13

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Repository owner deleted a comment from Copilot AI Aug 4, 2025
Repository owner deleted a comment from Copilot AI Aug 4, 2025
Repository owner deleted a comment from Copilot AI Aug 4, 2025
@xiu-cs xiu-cs requested a review from Copilot August 4, 2025 13:38

This comment was marked as outdated.

xiu-cs and others added 3 commits August 4, 2025 15:42
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Updated the method to convert dynamic skeleton keypoint names to numerical indices directly from the class attribute, improving clarity and functionality. Added detailed docstring to explain the method's purpose and usage.
@xiu-cs xiu-cs requested a review from Copilot August 4, 2025 13:55
Repository owner deleted a comment from Copilot AI Aug 4, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances checkpoint management, debugging capabilities, and file utilities across the DeepLabCut codebase. The changes focus on improving model checkpoint handling during video inference, adding debugging tools for pose estimation, and introducing utility functions for file downloads and JSON formatting.

Key Changes:

  • Added checkpoint epoch retrieval functionality for dynamic checkpoint path generation during adaptation training
  • Enhanced debugging capabilities with print statements for keypoints, bounding boxes, and batch structure analysis
  • Introduced utility functions for downloading files from Hugging Face Hub and JSON indentation formatting

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
deeplabcut/modelzoo/video_inference.py Added checkpoint epoch retrieval function and torch import for checkpoint management
deeplabcut/pose_estimation_pytorch/runners/train.py Added debugging comments and print statements for batch structure analysis
deeplabcut/pose_estimation_pytorch/data/utils.py Added debug prints for detecting anomalous keypoints and bounding boxes
deeplabcut/pose_estimation_pytorch/data/image.py Added commented safety checks for zero-dimension bounding boxes
deeplabcut/pose_estimation_pytorch/apis/evaluation.py Added extensive visualization functionality for PFM-specific prediction analysis
deeplabcut/utils/make_labeled_video.py Enhanced video processing to load additional video metadata
deeplabcut/common_tools/json_tools.py New utility for reformatting JSON files with proper indentation
deeplabcut/common_tools/download.py New utility for downloading files from Hugging Face Hub
.circleci/data Added CircleCI data path configuration

else:
return 0

def get_checkpoint_epoch(checkpoint_path):
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The function get_checkpoint_epoch is defined twice with identical signatures at lines 38 and 54. This will cause the second definition to overwrite the first, making the first function unreachable.

Copilot uses AI. Check for mistakes.
xiu-cs and others added 3 commits August 4, 2025 15:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Simplified the method's docstring to enhance clarity while maintaining its functionality. Removed unnecessary comments to streamline the code.
Repository owner deleted a comment from Copilot AI Aug 4, 2025
Repository owner deleted a comment from Copilot AI Aug 4, 2025
Repository owner deleted a comment from Copilot AI Aug 4, 2025
@xiu-cs xiu-cs merged commit 52ef557 into main Aug 4, 2025
1 of 4 checks passed
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.

8 participants