(last_depth, ndepth, depth_inteval_pixel)
| 474 | |
| 475 | |
| 476 | def get_cur_depth_range_samples_n(last_depth, ndepth, depth_inteval_pixel): |
| 477 | # cur_depth: (B, H, W) |
| 478 | # return depth_range_values: (B, D, H, W) |
| 479 | last_depth_min = (last_depth - (ndepth+2) / 2 * depth_inteval_pixel) # (B, H, W) |
| 480 | last_depth_max = (last_depth + (ndepth-2) / 2 * depth_inteval_pixel) |
| 481 | # cur_depth_min = (cur_depth - ndepth / 2 * depth_inteval_pixel).clamp(min=0.0) #(B, H, W) |
| 482 | # cur_depth_max = (cur_depth_min + (ndepth - 1) * depth_inteval_pixel).clamp(max=max_depth) |
| 483 | |
| 484 | new_interval = (last_depth_max - last_depth_min) / (ndepth - 1) # (B, H, W) |
| 485 | |
| 486 | depth_range_samples = last_depth_min.unsqueeze(1) + (torch.arange(0, ndepth, device=last_depth.device, |
| 487 | dtype=last_depth.dtype, |
| 488 | requires_grad=False).reshape(1, -1, 1, |
| 489 | 1) * new_interval.unsqueeze(1)) |
| 490 | |
| 491 | return depth_range_samples, (ndepth * depth_inteval_pixel) / (ndepth - 1) |
| 492 | def get_cur_depth_range_samples_p(last_depth, ndepth, depth_inteval_pixel): |
| 493 | # cur_depth: (B, H, W) |
| 494 | # return depth_range_values: (B, D, H, W) |
no outgoing calls
no test coverage detected