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

Add way to "filter out" low confidence keypoints #1676

Open
2 tasks done
Dref360 opened this issue Nov 19, 2024 · 1 comment
Open
2 tasks done

Add way to "filter out" low confidence keypoints #1676

Dref360 opened this issue Nov 19, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Dref360
Copy link

Dref360 commented Nov 19, 2024

Search before asking

  • I have searched the Supervision issues and found no similar feature requests.

Description

In pose estimation, low confidence keypoints should be set to 0.
It would be great to include this in supervision instead of asking the user to do it.

Proposal:

kpts = KeyPoints(xy=...,
                 confidence=...,)

kpts = kpts.with_threshold(threshold=0.5)

All keypoints with confidence lower than 0.5 would be set to 0.

Use case

Useful when visualizing skeletons with low confidence.

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@Dref360 Dref360 added the enhancement New feature or request label Nov 19, 2024
@miteshashar
Copy link

miteshashar commented Feb 14, 2025

@Dref360 I am trying to better understand the utility of this.

Setting the key points below the threshold to 0(if that is what you mean) could in some cases result in a low %age of key points remaining in place – the ones satisfying the threshold.
The key points determine the shape of the pose. And hence, this would effectively result in just a less sparse pose structure. Which is why I am unable to grasp what you are trying to visualize.

To visually understand what is the impact on the skeletons when I mute key points below a certain threshold, I ran a small experiment to visualize it.

Below is a sample of these illustrations, there are more on the repo.

3.webm.mp4

What would you do with the KeyPoints object having key points below the confidence threshold muted? It would be great if you can point to some plausible use cases you are trying to achieve to clarify whether I am misunderstanding what your requirement is.

Also, now with slightly better initial understanding of Supervision's code, I feel the method you have proposed is a very thin abstraction and can be achieved simply with one line of code, since kpts.xy and kpts.confidence are just NumPy arrays:

THRESHOLD = 0.5
REPLACEMENT = 0
kpts.xy[kpts.confidence < THRESHOLD] = REPLACEMENT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants