Visitar URL original
Adding cropping to pose_estimation_pytorch/apis/analyze_videos.py by YankoFelipe · Pull Request #2737 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Adding docstring plus addressing comments
  • Loading branch information
YankoFelipe committed Sep 16, 2024
commit 25f11bdf492ba38e77df8a44d3d4524562f50cd7
8 changes: 8 additions & 0 deletions deeplabcut/pose_estimation_pytorch/apis/analyze_videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ def analyze_videos(
identity_only: sub-call for auto_track. If ``True`` and animal identity was
learned by the model, assembly and tracking rely exclusively on identity
prediction.
cropping: list or None, optional, default=None
List of cropping coordinates as [x1, x2, y1, y2].
Note that the same cropping parameters will then be used for all videos.
If different video crops are desired, run ``analyze_videos`` on individual
videos with the corresponding cropping coordinates.

Returns:
The scorer used to analyze the videos
Expand Down Expand Up @@ -257,6 +262,9 @@ def analyze_videos(
cfg, model_cfg, snapshot_index, detector_snapshot_index,
)

if cropping is None and cfg.get("cropping", False):
cropping = cfg["x1"], cfg["x2"], cfg["y1"], cfg["y2"]

# Get general project parameters
bodyparts = model_cfg["metadata"]["bodyparts"]
unique_bodyparts = model_cfg["metadata"]["unique_bodyparts"]
Expand Down