facebookresearch / facebookresearch/sam2

Request for Python version of connected_components and Performance Comparison Inquiry

Open
#243 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
19.9k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Hi @ronghanghu

In the previous issues, many people mentioned the installation problems with _C, such as #53 #59 #22 , and I have encountered similar issues:
```
UserWarning: cannot import name '_C' from 'sam2'

Skipping the post-processing step due to the error above.
You can still use SAM 2 and it's OK to ignore the error above,
although some post-processing functionality may be limited
(which doesn't affect the results in most cases; see
https://github.com/facebookresearch/segment-anything-2/blob/main/INSTALL.md).
```
Although it can run ignoring this warning, I still want to understand the impact of this post-processing on the results.

By observing the files in csrc, it was found that there is a function similar to the `union-find algorithm` called `connected_components`.
Could you provide a pure `Python` version of this function? This would be more installation-friendly, especially for people who are not convenient to update the CUDA driver : ).

Or is there a significant difference in time consumption between the CUDA-based implementation and the Python-based implementation? How much exactly is it? In which scenarios would there be a larger difference?

Looking forward to your reply, thank you very much.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.