cosense3d.modules.fusion package

Submodules

cosense3d.modules.fusion.attn_fusion module

class cosense3d.modules.fusion.attn_fusion.DenseAttentionFusion(feature_dim, neck=None, **kwargs)[source]

Bases: BaseModule

forward(ego_feats, coop_feats=None, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.attn_fusion.SparseAttentionFusion(stride, in_channels, **kwargs)[source]

Bases: BaseModule

format_output(output)[source]
forward(ego_feats, coop_feats=None, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

fuse_feature_at_stride(ego_feat, coop_feat, stride, fuse_key)[source]
training: bool

cosense3d.modules.fusion.box_fusion module

class cosense3d.modules.fusion.box_fusion.BoxFusion(lidar_range, **kwargs)[source]

Bases: BaseModule

cluster_fusion(clusters, scores, labels, times, global_time)[source]

Merge boxes in each cluster with scores as weights for merging

clustering(boxes, scores, labels, times, global_time)[source]
forward(ego_preds, coop_preds, memory, global_times, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

merge_sync_boxes(c, s)[source]
temporal_cluster_fusion(clusters, scores, labels, times, global_time)[source]

Merge boxes in each cluster with scores as weights for merging

training: bool
cosense3d.modules.fusion.box_fusion.limit_period(val, offset=0.5, period=6.283185306)[source]

cosense3d.modules.fusion.fax module

This class is about swap fusion applications

class cosense3d.modules.fusion.fax.Attention(dim, dim_head=32, dropout=0.0, agent_size=6, window_size=7)[source]

Bases: Module

Unit Attention class. Todo: mask is not added yet.

Parameters

dim: int

Input feature dimension.

dim_head: int

The head dimension.

dropout: float

Dropout rate

agent_size: int

The agent can be different views, timestamps or vehicles.

forward(x, mask=None)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.fax.FeedForward(dim, hidden_dim, dropout=0.0)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.fax.PreNormResidual(dim, fn)[source]

Bases: Module

forward(x, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.fax.SwapFusionBlock(input_dim, mlp_dim, dim_head, window_size, agent_size, drop_out)[source]

Bases: Module

Swap Fusion Block contains window attention and grid attention.

forward(x, mask=None)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.fax.SwapFusionBlockMask(input_dim, mlp_dim, dim_head, window_size, agent_size, drop_out)[source]

Bases: Module

Swap Fusion Block contains window attention and grid attention with mask enabled for multi-vehicle cooperation.

forward(x, mask)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.fax.SwapFusionEncoder(input_dim=128, mlp_dim=256, agent_size=5, window_size=8, dim_head=32, drop_out=0.1, depth=3, mask=False, decoder=None, **kwargs)[source]

Bases: BaseModule

Data rearrange -> swap block -> mlp_head

forward(ego_feat, coop_cpm, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool

cosense3d.modules.fusion.keypoints module

class cosense3d.modules.fusion.keypoints.KeypointsFusion(lidar_range, train_from_epoch=0, **kwargs)[source]

Bases: BaseModule

cluster_fusion(clusters, scores)[source]

Merge boxes in each cluster with scores as weights for merging

clustering(boxes, scores)[source]
forward(ego_feats, coop_feats, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
cosense3d.modules.fusion.keypoints.limit_period(val, offset=0.5, period=6.283185306)[source]

cosense3d.modules.fusion.maxout_fusion module

class cosense3d.modules.fusion.maxout_fusion.BEVMaxoutFusion(**kwargs)[source]

Bases: BaseModule

forward(ego_feats, coop_feats, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.maxout_fusion.SparseBEVMaxoutFusion(pc_range, resolution, **kwargs)[source]

Bases: BaseModule

format_output(output)[source]
forward(ego_feats, coop_feats, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool

cosense3d.modules.fusion.naive_fusion module

class cosense3d.modules.fusion.naive_fusion.NaiveFusion(stride, **kwargs)[source]

Bases: BaseModule

format_output(output)[source]
forward(ego_feats, coop_feats=None, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

fuse_feature_at_stride(ego_feat, coop_feat, stride, fuse_key)[source]
training: bool

cosense3d.modules.fusion.spatial_query_fusion module

class cosense3d.modules.fusion.spatial_query_fusion.SpatialQueryAlignFusionRL(in_channels, pc_range, resolution, num_pose_feat=64, **kwargs)[source]

Bases: BaseModule

align_coordinates(ego_bctr, ego_rl, ego_rl_pred, ego_pose, cpfeat)[source]
format_output(output, **kwargs)[source]
forward(det_local, roadline, roadline_preds, ego_queries, ego_pose_corrected, ego_poses, ego_poses_aug, cpms, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.spatial_query_fusion.SpatialQueryFusion(in_channels, pc_range, resolution, **kwargs)[source]

Bases: BaseModule

format_output(output)[source]
forward(ego_feats, coop_feats, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool

cosense3d.modules.fusion.temporal_fusion module

class cosense3d.modules.fusion.temporal_fusion.LocalNaiveFusion(in_channels, feature_stride, lidar_range, pos_dim=3, topk_ref_pts=1024, ref_pts_stride=2, transformer_itrs=1, global_ref_time=0, **kwargs)[source]

Bases: BaseModule

This is a naive replacement of LocalTemporalFusion by only selecting the topk points for later spatial fusion

forward(local_roi, global_roi, bev_feat, mem_dict, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

gather_topk(rois, bev_feats, stride, topk)[source]
training: bool
class cosense3d.modules.fusion.temporal_fusion.LocalTemporalFusion(in_channels, transformer, feature_stride, lidar_range, pos_dim=3, num_pose_feat=128, topk_ref_pts=1024, topk_feat=512, num_propagated=256, memory_len=1024, ref_pts_stride=2, transformer_itrs=1, global_ref_time=0, norm_fusion=False, **kwargs)[source]

Bases: BaseModule

Modified from TemporalFusion to standardize input and output keys

embed_pos(pos, dim=None)[source]
forward(local_roi, global_roi, bev_feat, mem_dict, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

gather_topk(rois, bev_feats, stride, topk)[source]
init_weights()[source]
temporal_alignment(query_pos, tgt, ref_pts, ref_feat, mem_dict, ref_time=None)[source]
training: bool
class cosense3d.modules.fusion.temporal_fusion.LocalTemporalFusionV1(in_channels, transformer, feature_stride, lidar_range, pos_dim=3, num_pose_feat=128, topk_ref_pts=1024, topk_feat=512, num_propagated=256, memory_len=1024, ref_pts_stride=2, transformer_itrs=1, global_ref_time=0, norm_fusion=False, **kwargs)[source]

Bases: LocalTemporalFusion

forward(rois, bev_feat, mem_dict, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.temporal_fusion.LocalTemporalFusionV2(in_channels, transformer, feature_stride, lidar_range, pos_dim=3, num_pose_feat=128, topk_ref_pts=1024, topk_feat=512, num_propagated=256, memory_len=1024, ref_pts_stride=2, transformer_itrs=1, global_ref_time=0, norm_fusion=False, **kwargs)[source]

Bases: LocalTemporalFusion

forward(local_roi, bev_feat, mem_dict, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class cosense3d.modules.fusion.temporal_fusion.LocalTemporalFusionV3(in_channels, transformer, feature_stride, lidar_range, pos_dim=3, num_pose_feat=128, topk_ref_pts=1024, topk_feat=512, num_propagated=256, memory_len=1024, ref_pts_stride=2, transformer_itrs=1, global_ref_time=0, norm_fusion=False, **kwargs)[source]

Bases: BaseModule

TemporalFusion with feature flow

embed_pos(pos, dim=None)[source]
forward(local_roi, global_roi, bev_feat, mem_dict, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

gather_topk(rois, bev_feats, stride, topk)[source]
init_weights()[source]
temporal_alignment(query_pos, tgt, ref_pts, ref_feat, mem_dict, ref_time=None)[source]
training: bool
class cosense3d.modules.fusion.temporal_fusion.TemporalFusion(in_channels, transformer, feature_stride, lidar_range, pos_dim=3, num_pose_feat=128, topk_ref_pts=1024, topk_feat=512, num_propagated=256, memory_len=1024, ref_pts_stride=2, transformer_itrs=1, global_ref_time=0, **kwargs)[source]

Bases: BaseModule

embed_pos(pos, dim=None)[source]
forward(rois, bev_feat, mem_dict, time_scale=None, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

gather_topk(rois, bev_feats, stride, topk)[source]
init_weights()[source]
temporal_alignment(query_pos, tgt, ref_pts, ref_feat, mem_dict, ref_time=None)[source]
training: bool
class cosense3d.modules.fusion.temporal_fusion.TemporalLidarFusion(in_channels, transformer, feature_stride, lidar_range, pos_dim=3, num_pose_feat=64, topk=2048, num_propagated=256, memory_len=1024, num_query=644, **kwargs)[source]

Bases: BaseModule

embed_pos(pos, dim=None)[source]
forward(rois, bev_feat, mem_dict, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

gather_topk(rois, bev_feats)[source]
init_weights()[source]
temporal_alignment(query_pos, tgt, ref_pts, mem_dict)[source]
training: bool

Module contents