FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Adding cropping to pose_estimation_pytorch/apis/analyze_videos.py by YankoFelipe · Pull Request #2737 · DeepLabCut/DeepLabCut · GitHub

Adding cropping to pose_estimation_pytorch/apis/analyze_videos.py - #2737

Merged
n-poulsen merged 3 commits into
DeepLabCut:pytorch_dlcfrom
YankoFelipe:pytorch_dlc_analyze_crop
Sep 30, 2024
Merged

Adding cropping to pose_estimation_pytorch/apis/analyze_videos.py#2737
n-poulsen merged 3 commits into
DeepLabCut:pytorch_dlcfrom
YankoFelipe:pytorch_dlc_analyze_crop

Conversation

Copy link
Copy Markdown
Contributor

Hello DeepLabCut!

I'm integrating DLC-Pytorch into my project (2D/single animal) and I needed to add cropping functionality to deeplabcut.analyze_videos. Unfortunately I wasn't able to run the test scripts due different errors so I'd appreciate if someone from the team can run them, the log files of my runs are below. I tested the output of deeplabcut.analyze_videos with my data and it looked good so far.

testscript.py: https://datashare.mpcdf.mpg.de/s/UXTZAoKIejb0iKx
testscript_pytorch_multi_animal.py: https://datashare.mpcdf.mpg.de/s/AZsJ18QsA74CeRG
testscript_pytorch_single_animal.py: https://datashare.mpcdf.mpg.de/s/OrIwKmmMmkCwRho

The change is mostly moving VideoWriter.set_bbox to the parent class and pass cropping to VideoIterator. Everything was performed in 24ba111 aka. 3.0.0rc4 on SUSE Linux 15.5.

Best,
Yanko

Copy link
Copy Markdown
Contributor Author

I can't add the reviewers @AlexEMG

n-poulsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@YankoFelipe this is awesome, thank you for implementing the cropping feature!

There are a few changes that I think should be made to match the tensorflow implementation of cropping.

As is done in the tensorflow implementation, I would read the cropping parameters from the project configuration file if no cropping parameters were passed (e.g., in analyze_videos, after the if batch_size is None: batch_size = cfg.get("batch_size", 1) lines ):

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

When calling metadata = _generate_metadata(, I would also pass the cropping parameters that were used (this can be done through a VideoIterator object instead of passing a VideoReader) so they can be stored in the video analysis metadata file.

Copy link
Copy Markdown

Hi DeepLabCut! I am using Deeplabcut 3.0.0rc4 on windows11. Deeplabcut failed to crop the video when analyze new videos using the parameters in config file. I tried via GUI and command, but both of them didn't work. Will there be a new release to fix this issue? Thank you!!

Copy link
Copy Markdown
Contributor

hey @Jiachen24 - yes, a new release will be made with the fixes from this branch :)

n-poulsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good to me! Thanks @YankoFelipe!

n-poulsen merged commit 5f41812 into DeepLabCut:pytorch_dlc Sep 30, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL