cosense3d.modules.heads package

Submodules

cosense3d.modules.heads.bev module

class cosense3d.modules.heads.bev.BEV(data_info, in_dim, stride, target_assigner, loss_cls, num_cls=1, class_names_each_head=None, down_sample_tgt=False, generate_roi_scr=True, **kwargs)[source]

Bases: BaseModule

down_sample(coor, feat)[source]
format_input(stensor_list)[source]
format_output(output, B=None)[source]
forward(stensor_list, **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.

loss(batch_list, gt_boxes, gt_labels, **kwargs)[source]

This must be implemented in head module.

training: bool
class cosense3d.modules.heads.bev.BEVMultiResolution(strides, strides_for_loss, **kwargs)[source]

Bases: BaseModule

forward(stensor_list, *args, **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.

loss(batch_list, gt_boxes, gt_labels, **kwargs)[source]

This must be implemented in head module.

training: bool
class cosense3d.modules.heads.bev.ContiAttnBEV(out_channels, data_info, in_dim, stride, context_decoder, target_assigner, loss_cls, class_names_each_head=None, **kwargs)[source]

Bases: ContinuousBEV

get_evidence(ref_pts, coor, feat)[source]
training: bool
class cosense3d.modules.heads.bev.ContiGevBEV(out_channels, data_info, in_dim, stride, context_decoder, target_assigner, loss_cls, class_names_each_head=None, **kwargs)[source]

Bases: ContinuousBEV

get_evidence(ref_pts, coor, feat)[source]
training: bool
class cosense3d.modules.heads.bev.ContinuousBEV(out_channels, data_info, in_dim, stride, context_decoder, target_assigner, loss_cls, class_names_each_head=None, **kwargs)[source]

Bases: BaseModule

down_sample(coor, feat)[source]
format_input(stensor_list)[source]
format_output(output, B=None)[source]
forward(stensor_list, gt_boxes, gt_labels, **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.

get_evidence(ref_pts, coor, feat)[source]
loss(batch_list, **kwargs)[source]

This must be implemented in head module.

sample_reference_points(centers, gt_boxes, gt_labels)[source]
training: bool

cosense3d.modules.heads.bev_dense module

Seg head for bev understanding

class cosense3d.modules.heads.bev_dense.BevRoIDenseHead(in_dim, stride, num_cls=1, loss_cls=None, **kwargs)[source]

Bases: BaseModule

forward(input, **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.

loss(bev_preds, bev_tgt, **kwargs)[source]

This must be implemented in head module.

training: bool
class cosense3d.modules.heads.bev_dense.BevSegHead(target, input_dim, output_class, loss_cls, **kwargs)[source]

Bases: BaseModule

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.

loss(dynamic_bev_preds, dynamic_bev, **kwargs)[source]

This must be implemented in head module.

training: bool

cosense3d.modules.heads.det_anchor_dense module

class cosense3d.modules.heads.det_anchor_dense.DetAnchorDense(in_channels, loss_cls, loss_box, num_classes=1, stride=None, target_assigner=None, get_boxes_when_training=False, box_stamper=None, **kwargs)[source]

Bases: BaseModule

static add_sin_difference(boxes1, boxes2, dim=6)[source]
format_output(output, B)[source]
forward(bev_feat_list, points=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.

init_weights()[source]
loss(preds, gt_boxes, gt_labels, **kwargs)[source]

The dense bev maps show have the shape ((b, c, h, w))

predictions(preds)[source]
training: bool

cosense3d.modules.heads.det_anchor_sparse module

class cosense3d.modules.heads.det_anchor_sparse.DetAnchorSparse(in_channels, loss_cls, loss_box, num_classes=1, target_assigner=None, get_boxes_when_training=False, get_roi_scores=False, **kwargs)[source]

Bases: BaseModule

static add_sin_difference(boxes1, boxes2, dim=6)[source]
format(output, coor, B)[source]
forward(stensor_list, **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.

init_weights()[source]
loss(preds, stensor_list, gt_boxes, gt_labels, **kwargs)[source]

This must be implemented in head module.

predictions(coors, preds)[source]
training: bool

cosense3d.modules.heads.det_center_sparse module

class cosense3d.modules.heads.det_center_sparse.DetCenterSparse(data_info, stride, class_names_each_head, shared_conv_channel, cls_head_cfg, reg_head_cfg, reg_channels, cls_assigner, box_assigner, loss_cls, loss_box, center_threshold=0.5, generate_roi_scr=False, norm='BN', **kwargs)[source]

Bases: BaseModule

format_input(stensor_list)[source]
format_output(output, B=None)[source]
forward(stensor_list, **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.

loss(batch_list, gt_boxes, gt_labels, gt_mask=None, **kwargs)[source]

This must be implemented in head module.

predictions(preds)[source]
training: bool
class cosense3d.modules.heads.det_center_sparse.MultiLvlDetCenterSparse(nlvls, sparse, *args, **kwargs)[source]

Bases: DetCenterSparse

format_input(feat_in)[source]
format_output(output, B=None, reference_inds=None)[source]
forward(feat_in, **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.

loss(batch_list, gt_boxes, gt_labels, **kwargs)[source]

This must be implemented in head module.

predictions(preds)[source]
training: bool
class cosense3d.modules.heads.det_center_sparse.SeparatedClsHead(class_names_each_head, in_channel, one_hot_encoding=True, use_bias=False, norm='BN', **kwargs)[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.heads.det_center_sparse.UnitedClsHead(class_names_each_head, in_channel, one_hot_encoding=True, use_bias=False, norm='BN', **kwargs)[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.heads.det_center_sparse.UnitedRegHead(reg_channels, in_channel, combine_channels=True, sigmoid_keys=None, use_bias=False, norm='BN', **kwargs)[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

cosense3d.modules.heads.det_roi_refine module

class cosense3d.modules.heads.det_roi_refine.KeypointRoIHead(num_cls, in_channels, n_fc_channels, roi_grid_pool, target_assigner, dp_ratio=0.3, train_from_epoch=0, **kwargs)[source]

Bases: BaseModule

forward(preds, **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.

static get_dense_grid_points(rois, batch_size_rcnn, grid_size)[source]

Get the local coordinates of each grid point of a roi in the coordinate system of the roi(origin lies in the center of this roi.

get_global_grid_points_of_roi(rois)[source]
loss(out, gt_boxes, epoch, **kwargs)[source]

Parameters

output_dict : dict target_dict : dict

roi_grid_pool(preds)[source]
training: bool

cosense3d.modules.heads.img_focal module

class cosense3d.modules.heads.img_focal.ImgFocal(in_channels, embed_dims, num_classes, center_assigner, box_assigner, loss_cls2d, loss_centerness, loss_bbox2d, loss_iou2d, loss_centers2d, with_depth=False, **kwargs)[source]

Bases: BaseModule

static apply_center_offset(locations, center_offset)[source]
Parameters:
  • locations – (1, H, W, 2)

  • pred_ltrb – (N, H, W, 4)

static apply_ltrb(locations, pred_ltrb)[source]
Parameters:
  • locations – (1, H, W, 2)

  • pred_ltrb – (N, H, W, 4)

format_output(out_dict, img_feat)[source]
forward(img_feat, img_coor, **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.

loss(batch_list, labels2d, centers2d, bboxes2d, img_size, **kwargs)[source]

This must be implemented in head module.

training: bool

cosense3d.modules.heads.lidar_petr_head module

class cosense3d.modules.heads.lidar_petr_head.LidarPETRHead(in_channels, transformer, feature_stride, lidar_range, topk=2048, memory_len=256, num_query=644, **kwargs)[source]

Bases: BaseModule

format_input(input)[source]
forward(rois, bev_feat, memory, **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]
training: bool

cosense3d.modules.heads.multitask_head module

class cosense3d.modules.heads.multitask_head.MultiTaskHead(heads, strides, losses, formatting=None, **kwargs)[source]

Bases: BaseModule

forward(tensor_list, *args, **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.

loss(*args, **kwargs)[source]

This must be implemented in head module.

training: bool

cosense3d.modules.heads.nbr_attn_bev module

class cosense3d.modules.heads.nbr_attn_bev.NbrAttentionBEV(data_info, in_dim, stride, annealing_step, sampling, target_assigner=None, class_names_each_head=None, **kwargs)[source]

Bases: BaseModule

downsample_tgt_pts(tgt_label, max_sam)[source]
format_input(stensor_list)[source]
format_output(output, B=None)[source]
forward(stensor_list, **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.

generate_reference_points(centers)[source]
get_tgt(batch_list, gt_boxes, gt_labels, **kwargs)[source]
loss(batch_list, gt_boxes, gt_labels, **kwargs)[source]

This must be implemented in head module.

training: bool

cosense3d.modules.heads.petr_head module

class cosense3d.modules.heads.petr_head.PETRHead(embed_dims, pc_range, code_weights, num_classes, box_assigner, loss_cls, loss_bbox, loss_iou=None, num_reg_fcs=2, num_pred=3, use_logits=True, **kwargs)[source]

Bases: BaseModule

forward(feat_in, **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.

init_weights()[source]
loss(petr_out, gt_boxes, gt_labels, det, **kwargs)[source]

This must be implemented in head module.

training: bool

cosense3d.modules.heads.query_guided_petr_head module

class cosense3d.modules.heads.query_guided_petr_head.QueryGuidedPETRHead(embed_dims, pc_range, code_weights, num_classes, cls_assigner, box_assigner, loss_cls, loss_box, num_reg_fcs=3, num_pred=3, use_logits=False, reg_channels=None, sparse=False, pred_while_training=False, **kwargs)[source]

Bases: BaseModule

forward(feat_in, **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.

get_pred_boxes(bbox_preds, ref_pts)[source]
get_predictions(cls_scores, det_boxes, pred_boxes, batch_inds=None)[source]
init_weights()[source]
loss(petr_out, gt_boxes_global, gt_labels_global, *args, **kwargs)[source]

This must be implemented in head module.

training: bool

Module contents