robotic_sdk.ml_models package

Subpackages

Submodules

robotic_sdk.ml_models.anomaly_detection module

class robotic_sdk.ml_models.anomaly_detection.AnomalyDetectionModel(model_name: str, parameters: dict)

Bases: Model

A class representing the anomaly detection model.

__init__(model_name: str, parameters: dict)

Initializes the AnomalyDetectionModel.

Parameters:
  • model_name (str) – The name of the model.

  • parameters (dict) – A dictionary of parameters for the model.

load_model(model_path: str)

Load the model from the specified path.

Parameters:

model_path (str) – The path to the model file.

Returns:

The instance of the model.

Return type:

self

perform_inference(data_x)

Perform inference using the model.

Parameters:

data_x – The data to perform inference on.

Returns:

The result of the inference.

save_model(model_path: str)

Save the model at the specified path.

Parameters:

model_path (str) – The path to save the model file.

Returns:

The instance of the model.

Return type:

self

train_model(data_x) None

Train the model with the provided data.

Parameters:

data_x – The training data.

robotic_sdk.ml_models.gpt module

robotic_sdk.ml_models.grounded_segmentation module

robotic_sdk.ml_models.metrics module

robotic_sdk.ml_models.metrics.calculate_iou(detections: list, ground_truth_mask: ndarray)

Calculate the Intersection over Union (IoU) score for a list of detections against a ground truth mask.

Parameters:
  • detections (list) – A list of detection objects, where each object contains a mask attribute. The mask attribute is assumed to be a binary 2D numpy array representing the detected area.

  • ground_truth_mask (np.ndarray) – A binary 2D numpy array representing the ground truth area for comparison.

Returns:

The average IoU score for all detections.

Return type:

float

robotic_sdk.ml_models.model module

class robotic_sdk.ml_models.model.Model(model_name: str, parameters: dict | None = None)

Bases: ABC

Abstract base class for all models.

__init__(model_name: str, parameters: dict | None = None)

Initializes the Model instance.

Parameters:
  • model_name (str) – The name of the model.

  • parameters (dict) – The hyperparameters for the model.

Raises:

ValueError – If the configuration is not set before creating any model instances.

abstract load_model(model_path: str) None

Loads the model from the given path.

Parameters:

model_path (str) – The path to the model file.

Returns:

None

abstract perform_inference(**kwargs)

Abstract method to perform inference.

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

None

abstract save_model(model_path: str) None

Abstract method to save the model at the given path.

Parameters:

model_path (str) – The path to save the model file.

Returns:

None

abstract train_model() None

Abstract method to train the model.

Returns:

None

robotic_sdk.ml_models.model_info module

robotic_sdk.ml_models.qwen2vl module

robotic_sdk.ml_models.segment_anything module

robotic_sdk.ml_models.zero_shot_segmentation module

Module contents