Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shaokai/sa transfer learning #2389

Merged
merged 27 commits into from
Nov 6, 2023

Conversation

yeshaokai
Copy link
Collaborator

SuperAnimal transfer learning API, example and docs

@MMathisLab MMathisLab requested a review from jeylau September 18, 2023 16:39
@@ -1,12 +1,14 @@
# Project definitions (do not edit)
# Project definitions (do not edit)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd revert changes automatically made to this file.

Copy link
Contributor

@jeylau jeylau left a comment

Choose a reason for hiding this comment

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

Two small changes to bring and looking good!

yeshaokai and others added 2 commits September 21, 2023 11:34
Co-authored-by: Jessy Lauer <30733203+jeylau@users.noreply.github.com>
@yeshaokai
Copy link
Collaborator Author

Changes made @jeylau

@jeylau jeylau self-requested a review September 21, 2023 10:34
@MMathisLab MMathisLab added ModelZoo related to models/code for modezoo.deeplabcut.org enhancement New feature or request labels Oct 3, 2023
@jeylau jeylau requested a review from n-poulsen October 17, 2023 11:07
@MMathisLab
Copy link
Member

This looks great to me, with clear docs: all clear @n-poulsen / @AlexEMG ?

Copy link
Collaborator

@n-poulsen n-poulsen left a comment

Choose a reason for hiding this comment

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

black needs to be run on the code, as there are a few style changes to update (i suggested some changes but there are more).

I'd also like us to change the commit history for the PR before merging. There are heavy artifacts that we added and then removed from the branch (removed in commits removed artifacts and removed more artifacts), but they're still in the git history.

@@ -95,6 +95,7 @@ def format_multianimal_training_data(
return train_data



Copy link
Collaborator

Choose a reason for hiding this comment

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

there should only be 2 blank lines between functions :)

Suggested change

@@ -717,6 +719,7 @@ def to_matlab_cell(array):
return train_data, matlab_data



Copy link
Collaborator

Choose a reason for hiding this comment

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

2 blank lines again

Suggested change

@@ -728,6 +731,7 @@ def create_training_dataset(
net_type=None,
augmenter_type=None,
posecfg_template=None,
superanimal_name = ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

just a bit of styling to follow the rest of the file

Suggested change
superanimal_name = ""
superanimal_name="",

@@ -832,16 +840,28 @@ def create_training_dataset(

# Loading metadata from config file:
cfg = auxiliaryfunctions.read_config(config)
dlc_root_path = auxiliaryfunctions.get_deeplabcut_path()

if superanimal_name!="":
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think all these suggestions can be applied at once by running black on the code.

Suggested change
if superanimal_name!="":
if superanimal_name != "":

if posecfg_template:
if not posecfg_template.endswith("pose_cfg.yaml"):
if not posecfg_template.endswith("pose_cfg.yaml") and not posecfg_template.endswith("superquadruped.yaml") and not posecfg_template.endswith("supertopview.yaml"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

this line is too long, apply black

@@ -119,7 +119,10 @@ def before_adapt_inference(self, make_video=False, **kwargs):
customized_test_config=self.customized_pose_config,
)
if kwargs.pop("plot_trajectories", True):
_plot_trajectories(datafiles[0])
if len(datafiles) == 0:
print ('No data files found for plotting trajectory')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
print ('No data files found for plotting trajectory')
print('No data files found for plotting trajectory')

@@ -45,7 +45,8 @@ def train(
traintime_resize=False,
video_path="",
superanimal=None,
trim_ends = None # trim the both ends of the video for video adaptation
trim_ends = None, # trim the both ends of the video for video adaptation
Copy link
Collaborator

Choose a reason for hiding this comment

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

trim_ends is not used in the function

@yeshaokai
Copy link
Collaborator Author

@n-poulsen ran black and removed unused parameters

@MMathisLab
Copy link
Member

Let's fix merge conflicts?

@jeylau
Copy link
Contributor

jeylau commented Nov 6, 2023

Thanks @yeshaokai for running black! I've fixed the merge conflict; looking good to me now.

@AlexEMG AlexEMG merged commit 11f12d8 into DeepLabCut:main Nov 6, 2023
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ModelZoo related to models/code for modezoo.deeplabcut.org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants