From 000272f895268a1e85c3b6373cb3514168f8110d Mon Sep 17 00:00:00 2001 From: Konstantin Kozlovtsev Date: Thu, 29 Jun 2023 18:54:59 +0200 Subject: [PATCH] Fix unnecessary encodings calculation in tensorf field (#2145) Fixed unnecessary encodings calculation in tensorf field --- nerfstudio/fields/tensorf_field.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nerfstudio/fields/tensorf_field.py b/nerfstudio/fields/tensorf_field.py index 27d5f3cd4..b3aba4e54 100644 --- a/nerfstudio/fields/tensorf_field.py +++ b/nerfstudio/fields/tensorf_field.py @@ -98,14 +98,14 @@ class TensoRFField(Field): rgb_features = self.color_encoding(positions) rgb_features = self.B(rgb_features) - d_encoded = self.direction_encoding(d) - rgb_features_encoded = self.feature_encoding(rgb_features) - if self.use_sh: sh_mult = self.sh(d)[:, :, None] rgb_sh = rgb_features.view(sh_mult.shape[0], sh_mult.shape[1], 3, sh_mult.shape[-1]) rgb = torch.relu(torch.sum(sh_mult * rgb_sh, dim=-1) + 0.5) else: + d_encoded = self.direction_encoding(d) + rgb_features_encoded = self.feature_encoding(rgb_features) + out = self.mlp_head(torch.cat([rgb_features, d, rgb_features_encoded, d_encoded], dim=-1)) # type: ignore rgb = self.field_output_rgb(out)