segmentation module#
- class selective_blur.masking.segmentation.Segmenter(image_path: str, model: str = 'tiny')[source]#
Bases:
objectClass to segment an image from user selection in a jupyter notebook leveraging Segment Anything 2
- choose_mask(mask_number: int)[source]#
- Parameters:
mask_number (int) – choice between the three mask proposals displayed when select_from_image is executed (choices available are 0, 1 or 2)
- Raises:
ValueError – if mask_number is not 0, 1 or 2
- select_from_image()[source]#
Allows to select with a point or a bounding box the subjects that will be segmented from an image (Jupyter Widget). After user submits the selection, three candidates masks (np.ndarray with dtype bool), saved in self.masks are displayed along with their confidence scores.