otx.algo.object_detection_3d.heads#

heads modules for 3d object detection.

Classes

DepthPredictor(depth_num_bins, depth_min, ...)

Depth predictor and depth encoder.

DepthAwareTransformerBuilder(model_name)

DepthAwareTransformerBuilder.

class otx.algo.object_detection_3d.heads.DepthAwareTransformerBuilder(model_name: str)[source]#

Bases: object

DepthAwareTransformerBuilder.

Create the DepthAwareTransformer.

class otx.algo.object_detection_3d.heads.DepthPredictor(depth_num_bins: int, depth_min: float, depth_max: float, hidden_dim: int, activation: ~typing.Callable[[...], ~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.ReLU'>)[source]#

Bases: Module

Depth predictor and depth encoder.

Initialize depth predictor and depth encoder.

Parameters:
  • depth_num_bins (int) – The number of depth bins.

  • depth_min (float) – The minimum depth value.

  • depth_max (float) – The maximum depth value.

  • hidden_dim (int) – The dimension of the hidden layer.

  • activation (Callable[..., nn.Module], optional) – The activation function. Defaults to nn.ReLU.

forward(feature: list[Tensor], mask: Tensor, pos: Tensor) tuple[Tensor, Tensor, Tensor, Tensor][source]#

Forward pass of the DepthPredictor.

Parameters:
  • feature (List[torch.Tensor]) – The list of input feature tensors.

  • mask (torch.Tensor) – The mask tensor.

  • pos (torch.Tensor) – The positional tensor.

Returns:

The output tensors.
  • depth_logits: The depth logits tensor.

  • depth_embed: The depth embedding tensor.

  • weighted_depth: The weighted depth tensor.

  • depth_pos_embed_ip: The interpolated depth positional embedding tensor.

Return type:

Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]

interpolate_1d(coord: Tensor, embed: Embedding) Tensor[source]#

Interpolate 1D embeddings based on coordinates.

Parameters:
  • coord (torch.Tensor) – The coordinate tensor.

  • embed (nn.Embedding) – The embedding module.

Returns:

The interpolated embeddings.

Return type:

torch.Tensor

interpolate_depth_embed(depth: Tensor) Tensor[source]#

Interpolate depth embeddings based on depth values.

Parameters:

depth (torch.Tensor) – The depth tensor.

Returns:

The interpolated depth embeddings.

Return type:

torch.Tensor