NVIDIA DeepStream SDK API Reference

9.2 Release
SparseBox3DKeyPointsGenerator Class Reference

Detailed Description

Class for generating 3D bounding box key points based on anchors.

This class implements the AnchorHandler interface for generating key points from 3D box anchors and providing anchor projection functionality.

Definition at line 34 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/postprocess/sparse_box_3d_generator.h.

Inheritance diagram for SparseBox3DKeyPointsGenerator:
Collaboration diagram for SparseBox3DKeyPointsGenerator:

Public Member Functions

 SparseBox3DKeyPointsGenerator (int embed_dims=256, int num_learnable_pts=0, const std::vector< std::tuple< float, float, float >> &fix_scale={{0.0, 0.0, 0.0}})
 Constructor for SparseBox3DKeyPointsGenerator. More...
 
void init_weight ()
 Initialize weights with proper initialization schemes. More...
 
std::variant< torch::Tensor, std::tuple< torch::Tensor, std::vector< torch::Tensor > > > forward (const torch::Tensor &anchor, const torch::Tensor &instance_feature=torch::Tensor(), const std::vector< torch::Tensor > &T_cur2temp_list={}, const torch::Tensor &cur_timestamp=torch::Tensor(), const std::vector< torch::Tensor > &temp_timestamps={})
 Forward pass to generate key points from anchors. More...
 
std::vector< torch::Tensor > anchor_projection (const torch::Tensor &anchors, const std::vector< torch::Tensor > &transforms, const std::vector< torch::Tensor > &time_intervals) override
 Project anchors using transformation matrices and time intervals. More...
 
 SparseBox3DKeyPointsGenerator (int embed_dims=256, int num_learnable_pts=0, const std::vector< std::tuple< float, float, float >> &fix_scale={{0.0, 0.0, 0.0}})
 Constructor for SparseBox3DKeyPointsGenerator. More...
 
void init_weight ()
 Initialize weights with proper initialization schemes. More...
 
std::variant< torch::Tensor, std::tuple< torch::Tensor, std::vector< torch::Tensor > > > forward (const torch::Tensor &anchor, const torch::Tensor &instance_feature=torch::Tensor(), const std::vector< torch::Tensor > &T_cur2temp_list={}, const torch::Tensor &cur_timestamp=torch::Tensor(), const std::vector< torch::Tensor > &temp_timestamps={})
 Forward pass to generate key points from anchors. More...
 
std::vector< torch::Tensor > anchor_projection (const torch::Tensor &anchors, const std::vector< torch::Tensor > &transforms, const std::vector< torch::Tensor > &time_intervals) override
 Project anchors using transformation matrices and time intervals. More...
 

Static Public Member Functions

static std::vector< torch::Tensor > anchor_projection_static (const torch::Tensor &anchor, const std::vector< torch::Tensor > &T_src2dst_list, const torch::Tensor &src_timestamp=torch::Tensor(), const std::vector< torch::Tensor > &dst_timestamps={}, const std::vector< torch::Tensor > &time_intervals={})
 Static method to project anchors using various parameters. More...
 
static torch::Tensor distance (const torch::Tensor &anchor)
 Calculate Euclidean distance of anchors from origin in 2D. More...
 
static std::vector< torch::Tensor > anchor_projection_static (const torch::Tensor &anchor, const std::vector< torch::Tensor > &T_src2dst_list, const torch::Tensor &src_timestamp=torch::Tensor(), const std::vector< torch::Tensor > &dst_timestamps={}, const std::vector< torch::Tensor > &time_intervals={})
 Static method to project anchors using various parameters. More...
 
static torch::Tensor distance (const torch::Tensor &anchor)
 Calculate Euclidean distance of anchors from origin in 2D. More...
 

Constructor & Destructor Documentation

◆ SparseBox3DKeyPointsGenerator() [1/2]

SparseBox3DKeyPointsGenerator::SparseBox3DKeyPointsGenerator ( int  embed_dims = 256,
int  num_learnable_pts = 0,
const std::vector< std::tuple< float, float, float >> &  fix_scale = {{0.0, 0.0, 0.0}} 
)

Constructor for SparseBox3DKeyPointsGenerator.

Parameters
embed_dimsDimension of embedding features
num_learnable_ptsNumber of learnable key points
fix_scaleFixed scale values for key points (array of 3D points)

◆ SparseBox3DKeyPointsGenerator() [2/2]

SparseBox3DKeyPointsGenerator::SparseBox3DKeyPointsGenerator ( int  embed_dims = 256,
int  num_learnable_pts = 0,
const std::vector< std::tuple< float, float, float >> &  fix_scale = {{0.0, 0.0, 0.0}} 
)

Constructor for SparseBox3DKeyPointsGenerator.

Parameters
embed_dimsDimension of embedding features
num_learnable_ptsNumber of learnable key points
fix_scaleFixed scale values for key points (array of 3D points)

Member Function Documentation

◆ anchor_projection() [1/2]

std::vector<torch::Tensor> SparseBox3DKeyPointsGenerator::anchor_projection ( const torch::Tensor &  anchors,
const std::vector< torch::Tensor > &  transforms,
const std::vector< torch::Tensor > &  time_intervals 
)
overridevirtual

Project anchors using transformation matrices and time intervals.

Parameters
anchorsInput anchors to project
transformsTransformation matrices for coordinate transforms
time_intervalsTime intervals for temporal projection
Returns
Vector of projected anchor tensors

Implements AnchorHandler.

◆ anchor_projection() [2/2]

std::vector<torch::Tensor> SparseBox3DKeyPointsGenerator::anchor_projection ( const torch::Tensor &  anchors,
const std::vector< torch::Tensor > &  transforms,
const std::vector< torch::Tensor > &  time_intervals 
)
overridevirtual

Project anchors using transformation matrices and time intervals.

Parameters
anchorsInput anchors to project
transformsTransformation matrices for coordinate transforms
time_intervalsTime intervals for temporal projection
Returns
Vector of projected anchor tensors

Implements AnchorHandler.

◆ anchor_projection_static() [1/2]

static std::vector<torch::Tensor> SparseBox3DKeyPointsGenerator::anchor_projection_static ( const torch::Tensor &  anchor,
const std::vector< torch::Tensor > &  T_src2dst_list,
const torch::Tensor &  src_timestamp = torch::Tensor(),
const std::vector< torch::Tensor > &  dst_timestamps = {},
const std::vector< torch::Tensor > &  time_intervals = {} 
)
static

Static method to project anchors using various parameters.

Parameters
anchorInput anchor tensor
T_src2dst_listList of transformation matrices
src_timestampOptional source timestamp
dst_timestampsOptional destination timestamps
time_intervalsOptional time intervals
Returns
Vector of projected anchor tensors

◆ anchor_projection_static() [2/2]

static std::vector<torch::Tensor> SparseBox3DKeyPointsGenerator::anchor_projection_static ( const torch::Tensor &  anchor,
const std::vector< torch::Tensor > &  T_src2dst_list,
const torch::Tensor &  src_timestamp = torch::Tensor(),
const std::vector< torch::Tensor > &  dst_timestamps = {},
const std::vector< torch::Tensor > &  time_intervals = {} 
)
static

Static method to project anchors using various parameters.

Parameters
anchorInput anchor tensor
T_src2dst_listList of transformation matrices
src_timestampOptional source timestamp
dst_timestampsOptional destination timestamps
time_intervalsOptional time intervals
Returns
Vector of projected anchor tensors

◆ distance() [1/2]

static torch::Tensor SparseBox3DKeyPointsGenerator::distance ( const torch::Tensor &  anchor)
static

Calculate Euclidean distance of anchors from origin in 2D.

Parameters
anchorInput anchor tensor
Returns
Tensor of distances

◆ distance() [2/2]

static torch::Tensor SparseBox3DKeyPointsGenerator::distance ( const torch::Tensor &  anchor)
static

Calculate Euclidean distance of anchors from origin in 2D.

Parameters
anchorInput anchor tensor
Returns
Tensor of distances

◆ forward() [1/2]

std::variant<torch::Tensor, std::tuple<torch::Tensor, std::vector<torch::Tensor> > > SparseBox3DKeyPointsGenerator::forward ( const torch::Tensor &  anchor,
const torch::Tensor &  instance_feature = torch::Tensor(),
const std::vector< torch::Tensor > &  T_cur2temp_list = {},
const torch::Tensor &  cur_timestamp = torch::Tensor(),
const std::vector< torch::Tensor > &  temp_timestamps = {} 
)

Forward pass to generate key points from anchors.

Parameters
anchorAnchor tensors [batch_size, num_anchor, dim]
instance_featureOptional instance features for learnable points
T_cur2temp_listOptional transformation matrices
cur_timestampOptional current timestamp
temp_timestampsOptional temporal timestamps
Returns
key points tensor or tuple of key points and temporal key points

◆ forward() [2/2]

std::variant<torch::Tensor, std::tuple<torch::Tensor, std::vector<torch::Tensor> > > SparseBox3DKeyPointsGenerator::forward ( const torch::Tensor &  anchor,
const torch::Tensor &  instance_feature = torch::Tensor(),
const std::vector< torch::Tensor > &  T_cur2temp_list = {},
const torch::Tensor &  cur_timestamp = torch::Tensor(),
const std::vector< torch::Tensor > &  temp_timestamps = {} 
)

Forward pass to generate key points from anchors.

Parameters
anchorAnchor tensors [batch_size, num_anchor, dim]
instance_featureOptional instance features for learnable points
T_cur2temp_listOptional transformation matrices
cur_timestampOptional current timestamp
temp_timestampsOptional temporal timestamps
Returns
key points tensor or tuple of key points and temporal key points

◆ init_weight() [1/2]

void SparseBox3DKeyPointsGenerator::init_weight ( )

Initialize weights with proper initialization schemes.

◆ init_weight() [2/2]

void SparseBox3DKeyPointsGenerator::init_weight ( )

Initialize weights with proper initialization schemes.


The documentation for this class was generated from the following file: