Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

SegmentBooster

Refine segmentation masks with Segment Anything Model(SAM)

Example:

For requirements:

install SAM -> https://github.com/facebookresearch/segment-anything
numpy, cv2

demo.py:

from segment_anything import SamAutomaticMaskGenerator, sam_model_registry
SAMtype="..."
SAMcheckpoint="..."
sam = sam_model_registry[SAMtype](checkpoint=SAMcheckpoint)
mask_generator = SamAutomaticMaskGenerator(sam)

from segmentBooster import refineMask
imagePath"..."
segmentationMask="..."#2D numpy array with shape(image.shape), storing pixel level class IDs.

#outputs 2D numpy array with shape(image.shape), storing pixel level class IDs.
refinedMask=refineMask(imagePath,segmentationMask,mask_generator)

About

Refine segmentation masks with Segment Anything Model(SAM)

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages