Transforms using Segment Anything Model

class datumaro.plugins.sam_transforms.SAMBboxToInstanceMask(extractor: IDataset, inference_server_type: InferenceServerType = InferenceServerType.ovms, host: str = 'localhost', port: int = 9000, timeout: float = 10.0, tls_config: Optional[TLSConfig] = None, protocol_type: ProtocolType = ProtocolType.grpc, to_polygon: bool = False, num_workers: int = 0)[source]#

Bases: ModelTransform, CliPlugin

Convert bounding boxes to instance mask using Segment Anything Model.

This transform convert all the Bbox annotations in the dataset item to Mask or Polygon annotations (Mask is default). It uses the Segment Anything Model deployed in the OpenVINO™ Model Server or NVIDIA Triton™ Inference Server instance. To launch the server instance, please see the guide in this link: openvinotoolkit/datumaro

  • extractor – Dataset to transform

  • inference_server_type – Inference server type: InferenceServerType.ovms or InferenceServerType.triton

  • host – Host address of the server instance

  • port – Port number of the server instance

  • timeout – Timeout limit during communication between the client and the server instance

  • tls_config – Configuration required if the server instance is in the secure mode

  • protocol_type – Communication protocol type with the server instance

  • to_polygon – If true, the output Mask annotations will be converted to Polygon annotations.

  • num_workers – The number of worker threads to use for parallel inference. Set to 0 for single-process mode. Default is 0.



Bbox-to-instance mask transform using Segment Anything Model


Segment Anything Model interpreters