Replies: 4 comments 3 replies
-
Hi @gracegliu, Sure thing -- we don't have this built-in, but I think we can write up a quick example of this. Do you mind sharing your SLP file? Cheers, Talmo |
Beta Was this translation helpful? Give feedback.
-
Thanks so much! I have submitted my file. |
Beta Was this translation helpful? Give feedback.
-
Thanks @gracegliu! Here's a notebook that does what you requested. This uses You can run this yourself in Google Colab, or locally if you install For reference, here's the bit of code that minimally does this: import sleap_io as sio
labels = sio.load_file("help.1799.slp")
cutoff = 0.4
for lf in labels:
for inst in lf:
for point in inst.points.values():
if point.score < cutoff:
point.visible = False
labels.save("filtered_labels.slp") Let me know if you have any questions! Talmo |
Beta Was this translation helpful? Give feedback.
-
Hi Talmo,
Thanks so much! I will give that a shot.
Best,
Grace
…________________________________
From: Talmo Pereira ***@***.***>
Sent: Thursday, June 6, 2024 5:27 PM
To: talmolab/sleap ***@***.***>
Cc: Liu, Grace Geyu ***@***.***>; Mention ***@***.***>
Subject: Re: [talmolab/sleap] Mass-selecting nodes with low prediction scores (Discussion #1799)
Thanks @gracegliu<https://github.com/gracegliu>! Here's a notebook<https://colab.research.google.com/drive/1jKSK6aAG_qptPZIEOfL9Ojxv4SVoxpHa?usp=sharing> that does what you requested. This uses sleap-io<https://io.sleap.ai/> to load the labels file, which we then use to visualize the distribution of point scores, pick a cutoff, and set all points with scores below that value to not be visible, before saving the resulting labels back out.
You can run this yourself in Google Colab, or locally if you install sleap-io. You can then open the resulting file in SLEAP as you would normally.
Let me know if you have any questions!
Talmo
—
Reply to this email directly, view it on GitHub<#1799 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BARQUZKY5637Y5CZI7FRURLZGDH33AVCNFSM6AAAAABI5FM6WKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TMOJUGIYDO>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
In my single-animal videos, I will occasionally get a handful of frames where only some of my nodes are not visible (ie, mouse rearing, front paws not visible). In these instances, SLEAP will sometimes mislabel those non-visible nodes to parts of the field, ie, reflections in the acrylic chamber and so on, with very low confidence. However, the prediction scores for the visible nodes (back paws) are still high and those are correctly labeled. Is it possible to mass-select all nodes with low prediction scores and set them as invisible without deleting the instance?
Beta Was this translation helpful? Give feedback.
All reactions