InstanceBank class for managing and tracking object instances across frames.
This class implements functionality to maintain and update feature representations of object instances across time, supporting object tracking and temporal association.
Definition at line 61 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/postprocess/instance_bank.h.


Public Member Functions | |
| InstanceBank (int num_anchor, int embed_dims, const torch::Tensor &anchor, AnchorHandler *anchor_handler=nullptr, int num_temp_instances=0, float default_time_interval=0.5, float confidence_decay=0.6, bool anchor_grad=true, bool feat_grad=true, float max_time_interval=2.0, int reid_dims=-1, int gpu_id=-1) | |
| Constructor for InstanceBank. More... | |
| void | init_weight () |
| Initialize weights with proper initialization schemes. More... | |
| void | reset () |
| Reset internal state. More... | |
| std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > | get (int batch_size, const MetaData &metas, const DNMetaData *dn_metas=nullptr) |
| Get features, anchors and time intervals for the current batch. More... | |
| std::tuple< torch::Tensor, torch::Tensor > | update (torch::Tensor instance_feature, torch::Tensor anchor, torch::Tensor confidence) |
| Update instance features and anchors. More... | |
| void | cache (torch::Tensor instance_feature, torch::Tensor anchor, torch::Tensor confidence, const MetaData *metas=nullptr, const std::vector< torch::Tensor > *feature_maps=nullptr) |
| Cache features, anchors and metadata for temporal association. More... | |
| torch::Tensor | get_instance_id (torch::Tensor confidence, torch::Tensor anchor=torch::Tensor(), float threshold=-1.0) |
| Get instance IDs based on confidence scores. More... | |
| void | update_instance_id (torch::Tensor instance_id_tensor, torch::Tensor confidence=torch::Tensor()) |
| Update instance IDs based on confidence scores. More... | |
| torch::Tensor | getMask () const |
| Get the mask tensor. More... | |
| InstanceBank (int num_anchor, int embed_dims, const torch::Tensor &anchor, AnchorHandler *anchor_handler=nullptr, int num_temp_instances=0, float default_time_interval=0.5, float confidence_decay=0.6, bool anchor_grad=true, bool feat_grad=true, float max_time_interval=2.0, int reid_dims=-1, int gpu_id=-1) | |
| Constructor for InstanceBank. More... | |
| void | init_weight () |
| Initialize weights with proper initialization schemes. More... | |
| void | reset () |
| Reset internal state. More... | |
| std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > | get (int batch_size, const MetaData &metas, const DNMetaData *dn_metas=nullptr) |
| Get features, anchors and time intervals for the current batch. More... | |
| std::tuple< torch::Tensor, torch::Tensor > | update (torch::Tensor instance_feature, torch::Tensor anchor, torch::Tensor confidence) |
| Update instance features and anchors. More... | |
| void | cache (torch::Tensor instance_feature, torch::Tensor anchor, torch::Tensor confidence, const MetaData *metas=nullptr, const std::vector< torch::Tensor > *feature_maps=nullptr) |
| Cache features, anchors and metadata for temporal association. More... | |
| torch::Tensor | get_instance_id (torch::Tensor confidence, torch::Tensor anchor=torch::Tensor(), float threshold=-1.0) |
| Get instance IDs based on confidence scores. More... | |
| void | update_instance_id (torch::Tensor instance_id_tensor, torch::Tensor confidence=torch::Tensor()) |
| Update instance IDs based on confidence scores. More... | |
| torch::Tensor | getMask () const |
| Get the mask tensor. More... | |
| InstanceBank::InstanceBank | ( | int | num_anchor, |
| int | embed_dims, | ||
| const torch::Tensor & | anchor, | ||
| AnchorHandler * | anchor_handler = nullptr, |
||
| int | num_temp_instances = 0, |
||
| float | default_time_interval = 0.5, |
||
| float | confidence_decay = 0.6, |
||
| bool | anchor_grad = true, |
||
| bool | feat_grad = true, |
||
| float | max_time_interval = 2.0, |
||
| int | reid_dims = -1, |
||
| int | gpu_id = -1 |
||
| ) |
Constructor for InstanceBank.
| num_anchor | Maximum number of anchors to use |
| embed_dims | Dimension of the embedding features |
| anchor | Initial anchor tensor |
| anchor_handler | Optional handler for anchor projection |
| num_temp_instances | Number of temporary instances to track |
| default_time_interval | Default time interval between frames |
| confidence_decay | Decay factor for confidence scores |
| anchor_grad | Whether to enable gradients for anchor parameters |
| feat_grad | Whether to enable gradients for feature parameters |
| max_time_interval | Maximum time interval to consider valid |
| reid_dims | Optional re-identification feature dimension |
| gpu_id | Device ID to use for computations |
| InstanceBank::InstanceBank | ( | int | num_anchor, |
| int | embed_dims, | ||
| const torch::Tensor & | anchor, | ||
| AnchorHandler * | anchor_handler = nullptr, |
||
| int | num_temp_instances = 0, |
||
| float | default_time_interval = 0.5, |
||
| float | confidence_decay = 0.6, |
||
| bool | anchor_grad = true, |
||
| bool | feat_grad = true, |
||
| float | max_time_interval = 2.0, |
||
| int | reid_dims = -1, |
||
| int | gpu_id = -1 |
||
| ) |
Constructor for InstanceBank.
| num_anchor | Maximum number of anchors to use |
| embed_dims | Dimension of the embedding features |
| anchor | Initial anchor tensor |
| anchor_handler | Optional handler for anchor projection |
| num_temp_instances | Number of temporary instances to track |
| default_time_interval | Default time interval between frames |
| confidence_decay | Decay factor for confidence scores |
| anchor_grad | Whether to enable gradients for anchor parameters |
| feat_grad | Whether to enable gradients for feature parameters |
| max_time_interval | Maximum time interval to consider valid |
| reid_dims | Optional re-identification feature dimension |
| gpu_id | Device ID to use for computations |
| void InstanceBank::cache | ( | torch::Tensor | instance_feature, |
| torch::Tensor | anchor, | ||
| torch::Tensor | confidence, | ||
| const MetaData * | metas = nullptr, |
||
| const std::vector< torch::Tensor > * | feature_maps = nullptr |
||
| ) |
Cache features, anchors and metadata for temporal association.
| instance_feature | Instance features to cache |
| anchor | Anchors to cache |
| confidence | Confidence scores |
| metas | Optional metadata |
| feature_maps | Optional feature maps |
| void InstanceBank::cache | ( | torch::Tensor | instance_feature, |
| torch::Tensor | anchor, | ||
| torch::Tensor | confidence, | ||
| const MetaData * | metas = nullptr, |
||
| const std::vector< torch::Tensor > * | feature_maps = nullptr |
||
| ) |
Cache features, anchors and metadata for temporal association.
| instance_feature | Instance features to cache |
| anchor | Anchors to cache |
| confidence | Confidence scores |
| metas | Optional metadata |
| feature_maps | Optional feature maps |
| std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> InstanceBank::get | ( | int | batch_size, |
| const MetaData & | metas, | ||
| const DNMetaData * | dn_metas = nullptr |
||
| ) |
Get features, anchors and time intervals for the current batch.
| batch_size | Size of the batch |
| metas | Metadata for the current frames |
| dn_metas | Optional denoising metadata |
| std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> InstanceBank::get | ( | int | batch_size, |
| const MetaData & | metas, | ||
| const DNMetaData * | dn_metas = nullptr |
||
| ) |
Get features, anchors and time intervals for the current batch.
| batch_size | Size of the batch |
| metas | Metadata for the current frames |
| dn_metas | Optional denoising metadata |
| torch::Tensor InstanceBank::get_instance_id | ( | torch::Tensor | confidence, |
| torch::Tensor | anchor = torch::Tensor(), |
||
| float | threshold = -1.0 |
||
| ) |
Get instance IDs based on confidence scores.
| confidence | Confidence scores for instances |
| anchor | Optional anchor tensor |
| threshold | Optional confidence threshold (negative value means no threshold) |
| torch::Tensor InstanceBank::get_instance_id | ( | torch::Tensor | confidence, |
| torch::Tensor | anchor = torch::Tensor(), |
||
| float | threshold = -1.0 |
||
| ) |
Get instance IDs based on confidence scores.
| confidence | Confidence scores for instances |
| anchor | Optional anchor tensor |
| threshold | Optional confidence threshold (negative value means no threshold) |
|
inline |
Get the mask tensor.
Definition at line 169 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/postprocess/instance_bank.h.
|
inline |
Get the mask tensor.
Definition at line 169 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/postprocess/instance_bank.h.
| void InstanceBank::init_weight | ( | ) |
Initialize weights with proper initialization schemes.
| void InstanceBank::init_weight | ( | ) |
Initialize weights with proper initialization schemes.
| void InstanceBank::reset | ( | ) |
Reset internal state.
| void InstanceBank::reset | ( | ) |
Reset internal state.
| std::tuple<torch::Tensor, torch::Tensor> InstanceBank::update | ( | torch::Tensor | instance_feature, |
| torch::Tensor | anchor, | ||
| torch::Tensor | confidence | ||
| ) |
Update instance features and anchors.
| instance_feature | Current instance features |
| anchor | Current anchors |
| confidence | Confidence scores |
| std::tuple<torch::Tensor, torch::Tensor> InstanceBank::update | ( | torch::Tensor | instance_feature, |
| torch::Tensor | anchor, | ||
| torch::Tensor | confidence | ||
| ) |
Update instance features and anchors.
| instance_feature | Current instance features |
| anchor | Current anchors |
| confidence | Confidence scores |
| void InstanceBank::update_instance_id | ( | torch::Tensor | instance_id_tensor, |
| torch::Tensor | confidence = torch::Tensor() |
||
| ) |
Update instance IDs based on confidence scores.
| instance_id_tensor | Current instance IDs |
| confidence | Optional confidence scores |
| void InstanceBank::update_instance_id | ( | torch::Tensor | instance_id_tensor, |
| torch::Tensor | confidence = torch::Tensor() |
||
| ) |
Update instance IDs based on confidence scores.
| instance_id_tensor | Current instance IDs |
| confidence | Optional confidence scores |