Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
31d8652
Fix: correct the early return error when save_epochs=1 and delelte th…
xiu-cs Nov 19, 2024
12ed9bd
add plot_gt_and_prediction function
xiu-cs Nov 21, 2024
614b1ac
delete the initial attempt at function
xiu-cs Nov 21, 2024
11c322e
add def visualize_coco_predictions(*)
xiu-cs Nov 21, 2024
598d02b
Fix: correct the early return error when save_epochs=1 and delelte th…
xiu-cs Nov 21, 2024
76e10b4
Update deeplabcut/pose_estimation_pytorch/runners/snapshots.py
xiu-cs Nov 22, 2024
0b64247
Merge branch 'pytorch_dlc' into ti/snapshots
xiu-cs Nov 22, 2024
275fff1
add plot_gt_and_prediction function
xiu-cs Nov 21, 2024
564dbe1
delete the initial attempt at function
xiu-cs Nov 21, 2024
41ff721
add def visualize_coco_predictions(*)
xiu-cs Nov 21, 2024
7f6c8c1
Fix: correct the early return error when save_epochs=1 and delelte th…
xiu-cs Nov 21, 2024
b91a3f8
black -> snapshots.py
xiu-cs Nov 22, 2024
f670407
black -> snapshots.py
xiu-cs Nov 22, 2024
971f737
Revert "Fix: correct the early return error when save_epochs=1 and de…
xiu-cs Nov 25, 2024
b2077ee
isort and black -> evaluate.py
xiu-cs Nov 25, 2024
512547e
update
xiu-cs Nov 25, 2024
f02bb36
Update README.md
MMathisLab Sep 5, 2024
3bb5098
Load min_n_links from inference_cfg
segashin Aug 12, 2024
193a243
set min_n_links two locations
segashin Aug 14, 2024
ae13531
Benchmarking user guide (#2716)
dikraMasrour Sep 6, 2024
9fb4799
readme link fix
MMathisLab Sep 6, 2024
c7f20bd
adding docs for using data labeled elsewhere (formatting) (#2736)
MMathisLab Sep 9, 2024
6f09586
Update standardDeepLabCut_UserGuide.md (#2761)
bendichter Oct 18, 2024
9963a2c
Create citation.md (#2767)
MMathisLab Oct 27, 2024
b7a6467
fix tmpdir file creation (#2768)
n-poulsen Oct 28, 2024
41aa1b6
bug fix: None has no lower() attribute (#2780)
n-poulsen Nov 11, 2024
ee0e561
Use architecture-specific snapshots prefixes in video adaptation (#2781)
maximpavliv Nov 14, 2024
c41a138
Video Analysis with Identity - Lowering memory footprint (#2785)
n-poulsen Nov 14, 2024
f2663fb
Timeout retrieving latest package version from the Web (#2782)
maximpavliv Nov 14, 2024
681d968
Fix: correct the early return error when save_epochs=1 and delelte th…
xiu-cs Nov 19, 2024
329402f
add plot_gt_and_prediction function
xiu-cs Nov 21, 2024
6bdf05c
delete the initial attempt at function
xiu-cs Nov 21, 2024
a3e99c4
add def visualize_coco_predictions(*)
xiu-cs Nov 21, 2024
1b98090
Revert "Fix: correct the early return error when save_epochs=1 and de…
xiu-cs Nov 25, 2024
b0c1fd9
isort and black -> evaluate.py
xiu-cs Nov 25, 2024
94a310d
Load scheduler state when resuming training (#2788)
n-poulsen Nov 21, 2024
5443212
Fix: correct the early return error when save_epochs=1 and delelte th…
xiu-cs Nov 21, 2024
3807963
Update deeplabcut/pose_estimation_pytorch/runners/snapshots.py
xiu-cs Nov 22, 2024
4e7ed49
DeepLabCut 3.0 - Video Analysis with `use_shelve=True` (#2790)
n-poulsen Nov 22, 2024
6128ae2
update
xiu-cs Nov 25, 2024
fe9e850
add def visualize_coco_predictions(*)
xiu-cs Nov 21, 2024
d6e2a0a
Fix: correct the early return error when save_epochs=1 and delelte th…
xiu-cs Nov 21, 2024
049f7fa
black -> snapshots.py
xiu-cs Nov 22, 2024
56222ed
update
xiu-cs Nov 25, 2024
421af7d
update from coco_ploting
xiu-cs Nov 25, 2024
7369cdc
update
xiu-cs Nov 25, 2024
5611e01
fix the vis for multi-animal
xiu-cs Nov 26, 2024
da99c66
add plot_gt_and_prediction function
xiu-cs Nov 21, 2024
2643d6b
delete the initial attempt at function
xiu-cs Nov 21, 2024
3aa926b
add def visualize_coco_predictions(*)
xiu-cs Nov 21, 2024
f0a24f7
isort and black -> evaluate.py
xiu-cs Nov 25, 2024
1fdd31e
modify the output_dir
xiu-cs Nov 26, 2024
bec1cff
Revert "black -> snapshots.py"
xiu-cs Nov 26, 2024
17fe504
revert changes to snapshots
xiu-cs Nov 26, 2024
bf80861
optimize the input params
xiu-cs Nov 26, 2024
694a814
rename the function and fix the multi-animal ploting problem
xiu-cs Nov 26, 2024
a731901
use num_individuals
xiu-cs Nov 26, 2024
74e8954
optimize the codes
xiu-cs Nov 26, 2024
c4b5a4a
add show_ground_truth param for future use
xiu-cs Nov 26, 2024
e33a745
black
xiu-cs Nov 26, 2024
c56a1f8
merge ti/coco_plotting to latest
xiu-cs Nov 27, 2024
6110d5b
modify
xiu-cs Dec 2, 2024
80fce45
save bboxes in _full.pickle
maximpavliv Nov 13, 2024
f39f03b
Plot bounding boxes in network evaluation
maximpavliv Nov 15, 2024
566aa39
Plot bboxes in create_video_with_all_detections
maximpavliv Nov 18, 2024
ec7d643
Plot bounding boxes in create_labeled_video
maximpavliv Nov 19, 2024
e5372e6
black
maximpavliv Nov 22, 2024
4017639
rename method
maximpavliv Dec 5, 2024
4e9f48a
add param description
maximpavliv Dec 5, 2024
3eacc3c
fix param default value
maximpavliv Dec 5, 2024
4dfdc10
plot bounding boxes in visualize_predictions
maximpavliv Dec 9, 2024
320a03f
black
maximpavliv Dec 9, 2024
6004ad2
merge maxim/save_plot_bboxes
xiu-cs Jan 5, 2025
3e1251b
add adaptive dot_size to visualize_predictions(*); dot_size is calcul…
xiu-cs Jan 15, 2025
241ea29
add pfm format plotting function: including skeleton, skeleton_name, …
xiu-cs Mar 6, 2025
5d5c9cb
Merge branch 'main' into latest
xiu-cs Mar 6, 2025
3dda8c0
add pfm plotting: skeleton, skeleton_name, masking
xiu-cs Mar 6, 2025
1c6d898
add libraries for evaluation and visualization in PFM predictions
xiu-cs Mar 6, 2025
66f881d
add dynamic skeleton function to make adjustment based on keypoint co…
xiu-cs Mar 7, 2025
05c12c6
add DynamicSkeleton class for improved dynamic skeleton generation ba…
xiu-cs Mar 7, 2025
331e3a4
DynamicSkeleton class: update keypoint names and enhance parent mappi…
xiu-cs Mar 9, 2025
01bbb21
plot_gt_and_predictions_PFM: improve text position tracking to avoid …
xiu-cs Mar 9, 2025
1763f1a
update parent mapping for tail in DynamicSkeleton and refine dot size…
xiu-cs Apr 3, 2025
4c46360
add json_tools module; first function: converting and formatting JSON…
xiu-cs Apr 3, 2025
583d5d9
add download_from_huggingface_hub function
xiu-cs May 1, 2025
c6e3630
Merge branch 'main' into latest
xiu-cs May 9, 2025
c5ddbfe
debug
xiu-cs May 11, 2025
508e985
Merge branch 'latest' into pfm
xiu-cs May 11, 2025
89d33a9
SuperAnimal VideoAdaptation: Fix Checkpoint Inconsistency Error
xiu-cs Jun 19, 2025
c64cced
Enhance get_checkpoint_epoch function to handle missing metadata grac…
xiu-cs Jun 19, 2025
634e969
Add import for matplotlib.patches in evaluation.py
xiu-cs Jul 27, 2025
2275cce
Merge branch 'pfm' into latest
xiu-cs Aug 4, 2025
bff93af
Update deeplabcut/pose_estimation_pytorch/apis/evaluation.py
xiu-cs Aug 4, 2025
1ddb028
Merge branch 'main' into latest
xiu-cs Aug 4, 2025
090a0aa
Fix typo in find_nearest_ancestor method name in evaluation.py
xiu-cs Aug 4, 2025
3dfa7aa
Update deeplabcut/pose_estimation_pytorch/apis/evaluation.py
xiu-cs Aug 4, 2025
e6cdf49
Refactor change_name_to_idx_dynamic_skeleton method in evaluation.py
xiu-cs Aug 4, 2025
9b06f41
Update .circleci/data
xiu-cs Aug 4, 2025
8fcc167
Update deeplabcut/pose_estimation_pytorch/runners/train.py
xiu-cs Aug 4, 2025
29393a6
Refactor change_name_to_idx_dynamic_skeleton method in evaluation.py
xiu-cs Aug 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/data
58 changes: 58 additions & 0 deletions deeplabcut/common_tools/download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from huggingface_hub import hf_hub_download
import os

def download_from_huggingface_hub(target_folder_path, repo_id, filename, subfolder=None):
"""
Download a file from the Hugging Face Hub to a specified local directory.

Parameters:
target_folder_path (str): Local directory path where file will be saved
repo_id (str): Hugging Face repository ID (e.g., 'noahcao/sapiens-pose-coco')
filename (str): Name of the file to download
subfolder (str, optional): Path to subfolder within the repository where the file is located

Returns:
str: Full path to the downloaded file

Examples:
>>> # Download a model file from noahcao/sapiens-pose-coco
>>> download_from_huggingface_hub(
... target_folder_path="./models/sapiens",
... repo_id="noahcao/sapiens-pose-coco",
... filename="sapiens_2b_coco_best_coco_AP_822_torchscript.pt2",
... subfolder="sapiens_lite_host/torchscript/pose/checkpoints/sapiens_2b"
... )

>>> # Download a file without specifying a subfolder
>>> download_from_huggingface_hub(
... target_folder_path="./data",
... repo_id="noahcao/sapiens-pose-coco",
... filename="COCO_val2017_detections_AP_H_70_person.json",
... subfolder="sapiens_host/pose/person_detection_results"
... )
"""
# Create the target directory if it does not exist
os.makedirs(target_folder_path, exist_ok=True)

# Download the file from Hugging Face Hub
return hf_hub_download(
repo_id=repo_id,
filename=filename,
subfolder=subfolder,
local_dir=target_folder_path
)

# Example usage:
if __name__ == "__main__":
# Example to download the model from noahcao/sapiens-pose-coco repository
target_dir = "xxxx/sapiens/sapiens_lite_host/torchscript/pose/checkpoints/sapiens_2b"

downloaded_file = download_from_huggingface_hub(
target_folder_path=target_dir,
repo_id="noahcao/sapiens-pose-coco",
filename="sapiens_2b_coco_best_coco_AP_822_torchscript.pt2",
subfolder="sapiens_lite_host/torchscript/pose/checkpoints/sapiens_2b"
)

print(f"File downloaded to: {downloaded_file}")

29 changes: 29 additions & 0 deletions deeplabcut/common_tools/json_tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import json
import os
from pathlib import Path

def convert_json_indent_folder_level(source_folder_path, target_folder_path):
"""
Read JSON files and save them with proper indentation.

Args:
source_folder_path (str): Path to the folder containing original JSON files
target_folder_path (str): Path to save the formatted JSON files
"""
# Create target folder if it doesn't exist
Path(target_folder_path).mkdir(parents=True, exist_ok=True)

# Get all JSON files from source folder
json_files = [f for f in os.listdir(source_folder_path) if f.endswith('.json')]
print(f"Processing {len(json_files)} JSON files...")

for json_file in json_files:
source_path = os.path.join(source_folder_path, json_file)
target_path = os.path.join(target_folder_path, json_file)

# Read source JSON file and save with proper indentation
with open(source_path, 'r') as f:
data = json.load(f)

with open(target_path, 'w') as f:
json.dump(data, f, indent=4)
18 changes: 17 additions & 1 deletion deeplabcut/modelzoo/video_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import json
import os
import torch
from pathlib import Path
from typing import Optional, Union

Expand All @@ -34,6 +35,21 @@
video_to_frames,
)

def get_checkpoint_epoch(checkpoint_path):
"""
Load a PyTorch checkpoint and return the current epoch number.

Args:
checkpoint_path (str): Path to the checkpoint file

Returns:
int: Current epoch number, or None if not found
"""
checkpoint = torch.load(checkpoint_path)
if 'metadata' in checkpoint and 'epoch' in checkpoint['metadata']:
return checkpoint['metadata']['epoch']
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 in the same file (lines 38 and 54). This will cause the second definition to override the first one, making the first implementation unreachable.

Copilot uses AI. Check for mistakes.
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.
"""
Expand Down Expand Up @@ -517,7 +533,6 @@ def video_inference_superanimal(

model_snapshot_prefix = f"snapshot-{model_name}"
detector_snapshot_prefix = f"snapshot-{detector_name}"

config["runner"]["snapshot_prefix"] = model_snapshot_prefix
config["detector"]["runner"]["snapshot_prefix"] = detector_snapshot_prefix

Expand Down Expand Up @@ -599,6 +614,7 @@ def video_inference_superanimal(
detector_batch_size=video_adapt_batch_size,
)


# after video adaptation, re-update the adapted checkpoint path, if the checkpoint does not exist, use the best checkpoint
adapted_detector_checkpoint = (
model_folder
Expand Down
Loading
Loading