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

Extract frames to label by content #7

Open
sfmig opened this issue Nov 28, 2024 · 1 comment
Open

Extract frames to label by content #7

sfmig opened this issue Nov 28, 2024 · 1 comment

Comments

@sfmig
Copy link
Contributor

sfmig commented Nov 28, 2024

Given a video, we would like to be able to extract frames based on their pixel content.

Both DLC and SLEAP provide this option.

I understand the approach is roughly PCA -> k-means clutering -> sampling from those clusters.

Is there an efficient implementation of this out there?

@sfmig
Copy link
Contributor Author

sfmig commented Nov 29, 2024

Is there an efficient implementation of this out there?

We could check out information retrieval / visual search techniques. I came across FAISS, a library for efficient similarity search and clustering of dense vectors, with support for running some of the algorithms on the GPU.

There is a very nice blogpost with more details about FAISS here

We could:

  • compute embeddings for regularly-spaced frames using DINOv2 or similar (in this blog post they suggest SIFT features)
  • then k-means cluster these image embeddings using FAISS
  • finally, sample a few images from each cluster.

I found a notebook that may be useful, doing something very similar to the above for image retrieval.

It would be nice to check:

  • if this approach is faster than SLEAP / DLC methods (basically is this worth it or is it overkill?)
  • eventually, it could be cool to check if this has a significant effect on the trained model (e.g., are frames extracted in this way more "informative" and therefore we can do away with less of them?)

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

No branches or pull requests

1 participant