otx.core.model.keypoint_detection#

Class definition for keypoint detection model entity used in OTX.

Classes

OTXKeypointDetectionModel(label_info, ...)

Base class for the keypoint detection models used in OTX.

OVKeypointDetectionModel(model_name, ...)

Keypoint detection model compatible for OpenVINO IR inference.

class otx.core.model.keypoint_detection.OTXKeypointDetectionModel(label_info: LabelInfoTypes, data_input_params: DataInputParams, model_name: str = 'keypoint_detection_model', optimizer: OptimizerCallable = <function _default_optimizer_callable>, scheduler: LRSchedulerCallable | LRSchedulerListCallable = <function _default_scheduler_callable>, metric: MetricCallable = <function _pck_measure_callable>, torch_compile: bool = False)[source]#

Bases: OTXModel

Base class for the keypoint detection models used in OTX.

label_info (LabelInfoTypes): Information about the labels. data_input_params (DataInputParams): Parameters for data input. model_name (str, optional): Name of the model. Defaults to “keypoint_detection_model”. optimizer (OptimizerCallable, optional): Callable for the optimizer. Defaults to DefaultOptimizerCallable. scheduler (LRSchedulerCallable | LRSchedulerListCallable, optional): Callable for the learning rate scheduler.

Defaults to DefaultSchedulerCallable.

metric (MetricCallable, optional): Callable for the metric. Defaults to PCKMeasureCallable. torch_compile (bool, optional): Whether to use torch compile. Defaults to False.

Base class for the keypoint detection models used in OTX.

Initialize the base model with the given parameters.

Parameters:
  • label_info (LabelInfoTypes) – Information about the labels used in the model.

  • data_input_params (DataInputParams) – Parameters of the input data such as input size, mean, and std.

  • model_name (str, optional) – Name of the model. Defaults to “OTXModel”.

  • optimizer (OptimizerCallable, optional) – Callable for the optimizer. Defaults to DefaultOptimizerCallable.

  • scheduler (LRSchedulerCallable | LRSchedulerListCallable) – Callable for the learning rate scheduler. Defaults to DefaultSchedulerCallable.

  • metric (MetricCallable, optional) – Callable for the metric. Defaults to NullMetricCallable.

  • torch_compile (bool, optional) – Flag to indicate if torch.compile should be used. Defaults to False.

  • tile_config (TileConfig, optional) – Configuration for tiling. Defaults to TileConfig(enable_tiler=False).

Returns:

None

configure_metric() None[source]#

Configure the metric.

forward_for_tracing(image: Tensor) Tensor | tuple[Tensor][source]#

Model forward function used for the model tracing during model exportation.

get_dummy_input(batch_size: int = 1) TorchDataBatch[source]#

Generates a dummy input, suitable for launching forward() on it.

Parameters:

batch_size (int, optional) – number of elements in a dummy input sequence. Defaults to 1.

Returns:

An entity containing randomly generated inference data.

Return type:

TorchDataBatch

class otx.core.model.keypoint_detection.OVKeypointDetectionModel(model_name: str, model_type: str = 'keypoint_detection', async_inference: bool = True, max_num_requests: int | None = None, use_throughput_mode: bool = True, model_api_configuration: dict[str, ~typing.Any] | None = None, metric: ~typing.Callable[[~otx.core.types.label.LabelInfo], ~torchmetrics.metric.Metric | ~torchmetrics.collections.MetricCollection] = <function _pck_measure_callable>, **kwargs)[source]#

Bases: OVModel

Keypoint detection model compatible for OpenVINO IR inference.

It can consume OpenVINO IR model path or model name from Intel OMZ repository and create the OTX keypoint detection model compatible for OTX testing pipeline.

Initialize the base model with the given parameters.

Parameters:
  • label_info (LabelInfoTypes) – Information about the labels used in the model.

  • data_input_params (DataInputParams) – Parameters of the input data such as input size, mean, and std.

  • model_name (str, optional) – Name of the model. Defaults to “OTXModel”.

  • optimizer (OptimizerCallable, optional) – Callable for the optimizer. Defaults to DefaultOptimizerCallable.

  • scheduler (LRSchedulerCallable | LRSchedulerListCallable) – Callable for the learning rate scheduler. Defaults to DefaultSchedulerCallable.

  • metric (MetricCallable, optional) – Callable for the metric. Defaults to NullMetricCallable.

  • torch_compile (bool, optional) – Flag to indicate if torch.compile should be used. Defaults to False.

  • tile_config (TileConfig, optional) – Configuration for tiling. Defaults to TileConfig(enable_tiler=False).

Returns:

None

configure_metric() None[source]#

Configure the metric.