(params, curr_time_idx, forward_prop)
| 407 | return params, variables |
| 408 | |
| 409 | def initialize_camera_pose(params, curr_time_idx, forward_prop): |
| 410 | with torch.no_grad(): |
| 411 | if curr_time_idx > 1 and forward_prop: |
| 412 | # Initialize the camera pose for the current frame based on a constant velocity model |
| 413 | # Rotation |
| 414 | prev_rot1 = F.normalize(params['cam_unnorm_rots'][..., curr_time_idx-1].detach()) |
| 415 | prev_rot2 = F.normalize(params['cam_unnorm_rots'][..., curr_time_idx-2].detach()) |
| 416 | new_rot = F.normalize(prev_rot1 + (prev_rot1 - prev_rot2)) |
| 417 | params['cam_unnorm_rots'][..., curr_time_idx] = new_rot.detach() |
| 418 | # Translation |
| 419 | prev_tran1 = params['cam_trans'][..., curr_time_idx-1].detach() |
| 420 | prev_tran2 = params['cam_trans'][..., curr_time_idx-2].detach() |
| 421 | new_tran = prev_tran1 + (prev_tran1 - prev_tran2) |
| 422 | params['cam_trans'][..., curr_time_idx] = new_tran.detach() |
| 423 | else: |
| 424 | # Initialize the camera pose for the current frame |
| 425 | params['cam_unnorm_rots'][..., curr_time_idx] = params['cam_unnorm_rots'][..., curr_time_idx-1].detach() |
| 426 | params['cam_trans'][..., curr_time_idx] = params['cam_trans'][..., curr_time_idx-1].detach() |
| 427 | |
| 428 | return params |
| 429 | |
| 430 | def dense_semantic_slam(config: dict): |
| 431 | # Loading Config |
no outgoing calls
no test coverage detected