rofunc.utils.visualab.segment.sam_seg#

1.  Module Contents#

1.1.  Functions#

sam_generate

sam_predict

Use mouse to select points or a box, and segment the object with prompt in the image.

1.2.  API#

rofunc.utils.visualab.segment.sam_seg.sam_generate(image, sam_checkpoint='sam_vit_h_4b8939.pth', model_type='vit_h')[source]#
rofunc.utils.visualab.segment.sam_seg.sam_predict(image, use_point=False, use_box=False, choose_best_mask=True, sam_checkpoint='sam_vit_h_4b8939.pth', model_type='vit_h')[source]#

Use mouse to select points or a box, and segment the object with prompt in the image.

Parameters:
  • image – image to segment

  • use_point – whether to use pos/neg points to segment

  • use_box – whether to use a box to segment

  • choose_best_mask – whether to only choose the best mask

  • sam_checkpoint – checkpoint path of sam model

  • model_type – sam model type

Returns: