(path, binarize=True, resolution=128, device="cpu")
| 6 | |
| 7 | |
| 8 | def load_sdfgrid2vox(path, binarize=True, resolution=128, device="cpu"): |
| 9 | sdfgrid = np.load(path)["sdf_grid"][:] |
| 10 | sdfgrid = torch.from_numpy(sdfgrid).float().to(device) |
| 11 | |
| 12 | if max(sdfgrid.shape) != resolution: |
| 13 | new_shape = [int(x * resolution / max(sdfgrid.shape)) for x in sdfgrid.shape] |
| 14 | sdfgrid = -F.adaptive_max_pool3d(-sdfgrid[None, None], new_shape)[0, 0] |
| 15 | |
| 16 | if binarize: |
| 17 | sdfgrid = sdfgrid <= 0 |
| 18 | return sdfgrid |
| 19 | |
| 20 | |
| 21 | def load_voxgrid(path, resolution=128, device="cpu"): |
no outgoing calls
no test coverage detected