segment-anything
segment-anything copied to clipboard
Add granularity parameter to control segmented object size
Fixes #770
Add granularity parameter to control segmented object granularity.
-
segment_anything/automatic_mask_generator.py
- Add
granularityparameter toSamAutomaticMaskGeneratorclass constructor. - Update
generatemethod to blend smaller segments into larger ones based on thegranularityparameter. - Add
blend_segmentsmethod to handle the blending logic based on thegranularityparameter.
- Add
-
scripts/amg.py
- Add
--granularitycommand-line argument to set the granularity of segmented objects. - Pass the
granularityargument to theSamAutomaticMaskGeneratorclass.
- Add
-
README.md
- Update documentation to include information about the new
granularityparameter. - Add examples of how to use the
granularityparameter in theGetting Startedsection.
- Update documentation to include information about the new