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

Define granularity of segmented areas #770

Open
abrahamezzeddine opened this issue Jun 29, 2024 · 1 comment · May be fixed by #785
Open

Define granularity of segmented areas #770

abrahamezzeddine opened this issue Jun 29, 2024 · 1 comment · May be fixed by #785

Comments

@abrahamezzeddine
Copy link

Hello,

I am wondering if it is possible to determine the granularity of the segmented objects?

It seems to detect objects that are of course well defined, but very small. These small objects are not of interest of me and I would like to blend those smaller segments into larger segments.

For example, instead of segmenting a chair into 8 segments, I want to segment it as one single object.

@daeunni
Copy link

daeunni commented Sep 9, 2024

@abrahamezzeddine Me too, did you address this issue?

HendricksJudy added a commit to HendricksJudy/segment-anything that referenced this issue Oct 22, 2024
Fixes facebookresearch#770

Add granularity parameter to control segmented object granularity.

* **segment_anything/automatic_mask_generator.py**
  - Add `granularity` parameter to `SamAutomaticMaskGenerator` class constructor.
  - Update `generate` method to blend smaller segments into larger ones based on the `granularity` parameter.
  - Add `blend_segments` method to handle the blending logic based on the `granularity` parameter.

* **scripts/amg.py**
  - Add `--granularity` command-line argument to set the granularity of segmented objects.
  - Pass the `granularity` argument to the `SamAutomaticMaskGenerator` class.

* **README.md**
  - Update documentation to include information about the new `granularity` parameter.
  - Add examples of how to use the `granularity` parameter in the `Getting Started` section.
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

Successfully merging a pull request may close this issue.

2 participants