cosense3d.agents.core package

Submodules

cosense3d.agents.core.base_runner module

class cosense3d.agents.core.base_runner.BaseRunner(dataloader, controller, gpus=0, log_every=10, hooks=None, **kwargs)[source]

Bases: object

init()[source]
property logdir
next_batch()[source]
run()[source]
set_logdir(logdir)[source]
setup_logger(*args, **kwargs)[source]
vis_data(keys=None, **kwargs)[source]

cosense3d.agents.core.cav_manager module

class cosense3d.agents.core.cav_manager.CAVManager(lidar_range, prototype=None, memory_len=1, all_grad=False, num_grad_cav=1, seq_len=0, cpm_statistic=False, **kwargs)[source]

Bases: object

apply_cav_function(func_name)[source]
forward(with_loss, training_mode, **kwargs)[source]
get_cav_with_id(id)[source]
has_cav(cav_id)[source]
receive_request(request)[source]
receive_response(response)[source]
reset()[source]
send_request()[source]
send_response()[source]
update_cav_info(valid_agent_ids=None, lidar_poses=None, **data)[source]
update_cpm_statistic(response)[source]

cosense3d.agents.core.data_manager module

class cosense3d.agents.core.data_manager.DataManager(cav_manager, lidar_range, voxel_size=None, aug=None, pre_process=[], loc_err=None)[source]

Bases: object

add_loc_err(batch_dict, seq_len)[source]
apply_preprocess()[source]
boxes_to_vis_format(boxes, labels, id_appendix=0)[source]
distribute_to_cav(valid_agent_ids=None, **data)[source]
distribute_to_seq_cav(data)[source]
distribute_to_seq_list(batch_dict, seq_len)[source]
gather(cav_list, data_keys)[source]
gather_batch(batch_idx, key, to_numpy=False)[source]
gather_cav_data(key)[source]
gather_ego_data(key)[source]
gather_vis_data(batch_idx=0, keys=['points'])[source]
generate_augment_params(batch_dict, seq_len)[source]
generate_global_non_empty_mask()[source]
generate_local_non_empty_mask(ego_only=False)[source]
get_gt_boxes_as_vis_format(batch_idx, coor='global', successors=False)[source]
get_vis_data_bev(batch_idx=0, keys='bev')[source]
get_vis_data_detection(batch_idx=0, keys='detection')[source]

Parameters

batch_idx: batch index key: the default key for detection is ‘detection’, customized key can also be used, depending on which key is used for saving detection result in the CAV data pool.

Returns

detection: result with boxes and labels converted to the visualizing format.

get_vis_data_input(batch_idx=0, keys=None)[source]

Parameters

batch_idx key: additional gt keys that are not standarlized in consense3d data API

Returns

get_vis_data_meta(batch_idx=0, keys=None)[source]
remove_global_empty_boxes()[source]
remove_local_empty_boxes(ego_only=False)[source]
sample_global_bev_tgt_pts(sam_res=0.4, map_res=0.2, range=50, max_num_pts=5000, discrete=False)[source]
scatter(cav_list, data_dict)[source]
update(cav_id, data_key, data)[source]
vis_global_data_plt(vis_funcs, seq_len=1)[source]

cosense3d.agents.core.forward_runner module

class cosense3d.agents.core.forward_runner.ForwardRunner(shared_modules, data_manager, dist=False, chunk_size=24, **kwargs)[source]

Bases: Module

forward(tasks, with_grad=True, **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.

frame_loss(tasks, **kwargs)[source]
gather_cav_ids(tasks)[source]
loss(tasks, **kwargs)[source]
to_gpu(gpu_id)[source]
training: bool

cosense3d.agents.core.gui module

class cosense3d.agents.core.gui.GUI(mode, cfg)[source]

Bases: QMainWindow

change_color_mode()[source]
change_glcolor()[source]
change_visible(name)[source]
connect_events_to_funcs()[source]
get_toolbar()[source]
initGUI()[source]
refresh()[source]
setRunner(runner)[source]
setupUI(cfg)[source]
start()[source]
step()[source]
stop()[source]

cosense3d.agents.core.hooks module

class cosense3d.agents.core.hooks.BaseHook(**kwargs)[source]

Bases: object

post_epoch(runner, **kwargs)[source]
post_iter(runner, **kwargs)[source]
pre_epoch(runner, **kwargs)[source]
pre_iter(runner, **kwargs)[source]
set_logger(logger)[source]
class cosense3d.agents.core.hooks.CPMStatisticHook(device='cuda:0', **kwargs)[source]

Bases: BaseHook

post_epoch(runner, **kwargs)[source]
set_logger(logger)[source]
class cosense3d.agents.core.hooks.CheckPointsHook(max_ckpt=3, epoch_every=None, iter_every=None, **kwargs)[source]

Bases: BaseHook

post_epoch(runner, **kwargs)[source]
post_iter(runner, **kwargs)[source]
static save(runner, name)[source]
class cosense3d.agents.core.hooks.DetectionNMSHook(nms_thr, pre_max_size, det_key='detection', **kwargs)[source]

Bases: BaseHook

post_iter(runner, **kwargs)[source]
class cosense3d.agents.core.hooks.EvalBEVSemsegHook(test_range, test_res=0.4, save_result=False, eval_static=True, bev_semseg_key='bev_semseg', gt_bev_key='bevmap', gt_boxes_key='global_bboxes_3d', **kwargs)[source]

Bases: BaseHook

cal_ious(preds, gt_map, tag, token=None)[source]
crop_map(bevmap)[source]
gt_dynamic_map(boxes)[source]
gt_static_map(bevmap)[source]
iou(conf, unc, gt, obs_mask=None)[source]
post_epoch(runner, **kwargs)[source]
post_iter(runner, **kwargs)[source]
set_logger(logger)[source]
class cosense3d.agents.core.hooks.EvalDetectionBEVHook(pc_range, iou_thr=[0.5, 0.7], save_result=False, det_key='detection', gt_key='global_bboxes_3d', **kwargs)[source]

Bases: BaseHook

filter_box_ranges(boxes, scores=None, labels=None, indices=None, times=None)[source]
format_final_result(out_dict)[source]
post_epoch(runner, **kwargs)[source]
post_iter(runner, **kwargs)[source]
set_logger(logger)[source]
class cosense3d.agents.core.hooks.EvalDetectionHook(pc_range, iou_thr=[0.5, 0.7], metrics=['CoSense3D'], save_result=False, det_key='detection', gt_key='global_bboxes_3d', **kwargs)[source]

Bases: BaseHook

eval_cosense3d_final()[source]
filter_box_ranges(boxes, scores=None, labels=None, indices=None, times=None)[source]
format_final_result(out_dict)[source]
post_epoch(runner, **kwargs)[source]
post_iter(runner, **kwargs)[source]
set_logger(logger)[source]
class cosense3d.agents.core.hooks.Hooks(cfg)[source]

Bases: object

set_logger(logger)[source]
class cosense3d.agents.core.hooks.MemoryUsageHook(device='cuda:0', **kwargs)[source]

Bases: BaseHook

post_iter(runner, **kwargs)[source]
class cosense3d.agents.core.hooks.TrainTimerHook(**kwargs)[source]

Bases: BaseHook

post_iter(runner, **kwargs)[source]
pre_epoch(runner, **kwargs)[source]

cosense3d.agents.core.task_manager module

class cosense3d.agents.core.task_manager.TaskManager[source]

Bases: object

reformat_tasks(task_list)[source]
summarize_loss_tasks(tasks)[source]
summarize_tasks(tasks)[source]
task_to_ordered_dict(tasks)[source]

cosense3d.agents.core.test_runner module

class cosense3d.agents.core.test_runner.TestRunner(load_from=None, logdir=None, **kwargs)[source]

Bases: BaseRunner

load(load_from)[source]
run()[source]
run_itr(data)[source]
setup_logger(ckpt, logdir)[source]
step()[source]

cosense3d.agents.core.train_runner module

class cosense3d.agents.core.train_runner.TrainRunner(max_epoch, optimizer, lr_scheduler, gpus=0, resume_from=None, load_from=None, run_name='default', log_dir='work_dir', use_wandb=False, debug=False, **kwargs)[source]

Bases: BaseRunner

resume(resume_from, load_from)[source]
run()[source]
run_epoch()[source]
run_itr(**kwargs)
setup_logger(resume_from, run_name, log_dir, use_wandb)[source]
step()[source]

cosense3d.agents.core.vis_runner module

class cosense3d.agents.core.vis_runner.VisRunner(**kwargs)[source]

Bases: BaseRunner

load(load_from)[source]
run()[source]
run_itr(data)[source]
step()[source]

Module contents