otx.core.model.detection_3d#

Class definition for 3d object detection model entity used in OTX.

Classes

MonoDETRModel(inference_adapter, configuration)

A wrapper for MonoDETR 3d object detection model.

OTX3DDetectionModel(label_info, model_name, ...)

Base class for the 3d detection models used in OTX.

OV3DDetectionModel(model_name, model_type, ...)

3d detection model compatible for OpenVINO IR inference.

class otx.core.model.detection_3d.MonoDETRModel(inference_adapter: InferenceAdapter, configuration: dict[str, Any], preload: bool = False)[source]#

Bases: ImageModel

A wrapper for MonoDETR 3d object detection model.

Initializes a 3d detection model.

Parameters:
  • inference_adapter (InferenceAdapter) – inference adapter containing the underlying model.

  • configuration (dict, optional) – configuration overrides the model parameters (see parameters() method).

  • preload (bool, optional) – forces inference adapter to load the model. Defaults to False.

postprocess(outputs: dict[str, ndarray], meta: dict[str, Any]) dict[str, Any][source]#

Applies SCC decoded to the model outputs.

Parameters:
  • outputs (dict[str, np.ndarray]) – raw outputs of the model

  • meta (dict[str, Any]) – meta information about the input data

Returns:

postprocessed model outputs

Return type:

dict[str, Any]

preprocess(inputs: dict[str, ndarray]) tuple[dict[str, Any], ...][source]#

Preprocesses the input data for the model.

Parameters:

inputs (dict[str, np.ndarray]) – a dict with image, calibration matrix, and image size

Returns:

a tuple with the preprocessed inputs and meta information

Return type:

tuple[dict[str, Any], …]

class otx.core.model.detection_3d.OTX3DDetectionModel(label_info: LabelInfoTypes, model_name: str, input_size: tuple[int, int], optimizer: OptimizerCallable = <function _default_optimizer_callable>, scheduler: LRSchedulerCallable | LRSchedulerListCallable = <function _default_scheduler_callable>, metric: MetricCallable = <class 'otx.core.metrics.average_precision_3d.KittiMetric'>, torch_compile: bool = False, score_threshold: float = 0.1)[source]#

Bases: OTXModel[Det3DBatchDataEntity, Det3DBatchPredEntity]

Base class for the 3d detection models used in OTX.

Initialize the 3d detection model.

static decode_detections_for_kitti_format(dets: ndarray, img_size: ndarray, calib_matrix: list[ndarray], class_names: list[str], threshold: float = 0.2) list[dict[str, ndarray]][source]#

Decode the detection results for KITTI format.

get_classification_layers(prefix: str = 'model.') dict[str, dict[str, int]][source]#

Get final classification layer information for incremental learning case.

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

Returns a dummy input for 3d object detection model.

class otx.core.model.detection_3d.OV3DDetectionModel(model_name: str, model_type: str = 'mono_3d_det', async_inference: bool = True, max_num_requests: int | None = None, use_throughput_mode: bool = True, model_api_configuration: dict[str, Any] | None = None, metric: MetricCallable = <class 'otx.core.metrics.average_precision_3d.KittiMetric'>, score_threshold: float = 0.2, **kwargs)[source]#

Bases: OVModel[Det3DBatchDataEntity, Det3DBatchPredEntity]

3d 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 3d detection model compatible for OTX testing pipeline.

static extract_dets_from_outputs(outputs: dict[str, Tensor], topk: int = 50) tuple[Tensor, ...][source]#

Extract detection results from model outputs.

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

Returns a dummy input for 3d object detection model.

transform_fn(data_batch: Det3DBatchDataEntity) dict[source]#

Data transform function for PTQ.