Skip to content

add new way to visualize low-likelihood pose estimates#2158

Closed
ludovicbellier wants to merge 5 commits intoDeepLabCut:mainfrom
ludovicbellier:labeled_video_pcutoff_mode
Closed

add new way to visualize low-likelihood pose estimates#2158
ludovicbellier wants to merge 5 commits intoDeepLabCut:mainfrom
ludovicbellier:labeled_video_pcutoff_mode

Conversation

@ludovicbellier
Copy link
Contributor

Hi team DLC!

During a recent project (I work at Inscopix, by the way =)) a colleague was wondering where low-likelihood labels would be placed if we could see them, which made me realize I couldn't find any existing way to visualize that: by default labels with likelihood <= pcutoff are not plotted when creating a labelled video; we can sure drop pcutoff to 0 but then all frames are labeled and there is no way to differentiate between above and below pcutoff labels.

Here is a simple PR keeping the default mode ("hide"), so it won't go in the way of existing scripts, and adding a "darken" mode when label colors are darkened when body part likelihood gets at or below pcutoff.

Also added a way to override pcutoff and dotsize values from config.yaml directly in the function call, so that these parameters could be changed more conveniently and, more importantly, by users without writing access to config.yaml but still wanting to use the related trained model.

Looking forward to discussing these features with you, and again, thank you for putting out there such a great package!
Have a beautiful weekend,
Ludovic

@MMathisLab
Copy link
Member

HI @ludovicbellier super idea! thanks very much -- I can see where this becomes handy in several ways; @jeylau want to check for maDLC compatibility? otherwise, lgtm also cc @AlexEMG - fine for you? We also need to consider backwards compatibility with config file

@jeylau
Copy link
Contributor

jeylau commented Mar 7, 2023

This is cool! An alternative would have been to display low-confidence keypoints as unfilled circles (as is done with when viewing outlier keypoints during refinement I think), but I do not see an advantage for doing so.
It is backward compatible too as no new variable is read from the config file; only the mode is passed in in memory in the dictionary 😊

@jeylau jeylau self-requested a review March 7, 2023 08:57
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.

Remove duplicate argument

pcutoff=0.6,
skeleton=[],
skeleton_color="white",
dotsize=8,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one should be removed too (causes the test failures)

@ludovicbellier
Copy link
Contributor Author

Thanks @MMathisLab and @jeylau for your replies, and glad you like it! Agreed on alternative ways to plot this: I just went for color change as this was the simplest to implement (as labels are plotted using sklearn.draw.disk), but using other markers or mapping dotsize to likelihood (e.g., half the size when below likelihood threshold) would also be efficient at visually conveying this information!

remove duplicated `dotsize` input argument in function `create_labeled_video`
@AlexEMG AlexEMG self-requested a review March 18, 2023 14:34
@MMathisLab MMathisLab requested a review from n-poulsen May 18, 2023 12:32
@MMathisLab MMathisLab added the enhancement New feature or request label May 25, 2023
@n-poulsen
Copy link
Contributor

An alternative implementation of this same feature (alpha represents likelihood of keypoints) was added with pull request #2319.

@n-poulsen n-poulsen closed this Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request high-priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants