From a6a3dedc0e2abcd93466ab2b656c7855e33f036b Mon Sep 17 00:00:00 2001 From: Matias Turkulainen <30566358+maturk@users.noreply.github.com> Date: Wed, 17 Jan 2024 21:22:34 +0200 Subject: [PATCH] camtoworld is already a tensor in sdfstudio_data (#2777) camtoworld is already a tensor --- nerfstudio/data/datasets/sdf_dataset.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nerfstudio/data/datasets/sdf_dataset.py b/nerfstudio/data/datasets/sdf_dataset.py index a94ce04db..7342efa9a 100644 --- a/nerfstudio/data/datasets/sdf_dataset.py +++ b/nerfstudio/data/datasets/sdf_dataset.py @@ -21,6 +21,7 @@ from typing import Dict import numpy as np import torch +from torch import Tensor from nerfstudio.data.dataparsers.base_dataparser import DataparserOutputs from nerfstudio.data.datasets.base_dataset import InputDataset @@ -64,7 +65,7 @@ class SDFDataset(InputDataset): return metadata - def get_depths_and_normals(self, depth_filepath: Path, normal_filename: Path, camtoworld: np.ndarray): + def get_depths_and_normals(self, depth_filepath: Path, normal_filename: Path, camtoworld: Tensor): """function to process additional depths and normal information Args: depth_filepath: path to depth file @@ -83,7 +84,7 @@ class SDFDataset(InputDataset): normal = normal * 2.0 - 1.0 # omnidata output is normalized so we convert it back to normal here normal = torch.from_numpy(normal).float() - rot = torch.from_numpy(camtoworld[:3, :3]) + rot = camtoworld[:3, :3] normal_map = normal.reshape(3, -1) normal_map = torch.nn.functional.normalize(normal_map, p=2, dim=0)