Skip to content

Refine segmentation masks with Segment Anything Model(SAM)

Notifications You must be signed in to change notification settings

99eren99/SegmentBooster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages