datumaro.plugins.sam_transforms.interpreters.sam_encoder#

Classes

SAMEncoderInterpreter()

class datumaro.plugins.sam_transforms.interpreters.sam_encoder.SAMEncoderInterpreter[source]#

Bases: IModelInterpreter

h_model = 1024#
w_model = 1024#
preprocess(inp: DatasetItem) Tuple[ndarray | Dict[str, ndarray], PrepInfo][source]#

Preprocessing an dataset item input.

Parameters:

img – DatasetItem input

Returns:

It returns a tuple of preprocessed input and preprocessing information. The preprocessing information will be used in the postprocessing step. One use case for this would be an affine transformation of the output bounding box obtained by object detection models. Input images for those models are usually resized to fit the model input dimensions. As a result, the postprocessing step should refine the model output bounding box to match the original input image size.

postprocess(pred: Dict[str, ndarray] | List[Dict[str, ndarray]], info: PrepInfo) List[Annotation][source]#

Postprocess a model prediction.

Parameters:
  • pred – Model prediction

  • info – Preprocessing information coming from the preprocessing step

Returns:

A list of annotations which is created from the model predictions

get_categories()[source]#

It should be implemented if the model generate a new categories