Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the bugs associated with blender datas #2704

Merged
merged 49 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
09cc1d1
fix the bug when camera.distortion_params is None
KevinXu02 Dec 25, 2023
a4e640b
Handle background color override when using blender.
KevinXu02 Dec 25, 2023
bd07a71
fix bare except
KevinXu02 Dec 25, 2023
2fcd556
format
KevinXu02 Dec 25, 2023
00d10a1
Update background color override in Blender dataparser
KevinXu02 Dec 25, 2023
2bf8a06
Merge branch 'main' into main
KevinXu02 Jan 3, 2024
2158946
Add ability to download EyefulTower dataset
VasuAgrawal Dec 7, 2023
ba5ce12
wip before I copy linning's stuff in
VasuAgrawal Dec 8, 2023
f95b4eb
Generate per-resolution cameras.xml
VasuAgrawal Dec 9, 2023
f811bd2
Generate transforms.json at download
VasuAgrawal Dec 12, 2023
59e1cf6
Fix a couple of quotes
VasuAgrawal Jan 10, 2024
688c39b
Use official EyefulTower splits for train and val
VasuAgrawal Jan 10, 2024
25b6d58
Disable projectaria-tools on windows
VasuAgrawal Jan 11, 2024
0e7d29e
Fix extra imports
VasuAgrawal Jan 11, 2024
5393ee4
Add a new nerfacto method tund for EyefulTower
VasuAgrawal Jan 11, 2024
8fb0a8b
Split eyefultower download into a separate file
VasuAgrawal Jan 12, 2024
ad91608
Merge branch 'main' into main
KevinXu02 Jan 14, 2024
c481c29
Fix typo
KevinXu02 Jan 14, 2024
88c644a
Merge branch 'main' of https://github.com/nerfstudio-project/nerfstud…
VasuAgrawal Jan 16, 2024
ac5200a
Add some fisheye support for eyeful data
VasuAgrawal Jan 16, 2024
6998760
Reformatted imports to not be dumb
VasuAgrawal Jan 16, 2024
82d4f5e
Apparently this file was missed when formatting originally
VasuAgrawal Jan 16, 2024
c912066
Merge branch 'main' into main
KevinXu02 Jan 18, 2024
bf6d7b7
Added 1k resolution scenes
VasuAgrawal Jan 18, 2024
7126694
revert method_configs.py to original values
VasuAgrawal Jan 18, 2024
e24ffe0
Also add 1k exrs
VasuAgrawal Jan 18, 2024
a022a57
Add option to modify bg color in gaussian splatting
KevinXu02 Jan 19, 2024
950f990
Merge branch 'main' of https://github.com/KevinXu02/nerfstudio
KevinXu02 Jan 19, 2024
c95d3f3
Merge branch 'main' into main
KevinXu02 Jan 19, 2024
999e63c
fix back the config, bg color should work now
KevinXu02 Jan 19, 2024
bae5a5f
removed camera optimizer for gs to align with main
KevinXu02 Jan 19, 2024
6c3c576
Merge branch 'main' into main
KevinXu02 Jan 19, 2024
44581bf
Address feedback
VasuAgrawal Jan 19, 2024
544cb81
Revert changes to pyproject.toml, to be added in a later PR
VasuAgrawal Jan 19, 2024
59333c9
Merge branch 'main' of https://github.com/nerfstudio-project/nerfstud…
VasuAgrawal Jan 19, 2024
d1abe18
Oops, probably shouldn't have gotten rid of awscli ...
VasuAgrawal Jan 19, 2024
be6792f
adding support for bg color, tested and reformatted now
KevinXu02 Jan 19, 2024
a142ba7
Merge branch 'main' into main
KevinXu02 Jan 19, 2024
8afc649
formatted
KevinXu02 Jan 19, 2024
a10c777
formatted
KevinXu02 Jan 19, 2024
a791591
merged main
ethanweber Jan 19, 2024
cdd1d15
changed glob variable name
ethanweber Jan 19, 2024
36c8a59
Merge commit 'cdd1d1507e78c92fdf0c192a2b2739950dec7d7c'
KevinXu02 Jan 19, 2024
9a5e08c
Merge branch 'main' of github.com:nerfstudio-project/nerfstudio into …
brentyi Jan 20, 2024
18c5343
Refactor background color variable name
KevinXu02 Jan 20, 2024
910369e
Merge branch 'main' of https://github.com/KevinXu02/nerfstudio
KevinXu02 Jan 20, 2024
77835c5
prevent viser overriding
kerrj Jan 20, 2024
e198008
Merge branch 'main' of https://github.com/KevinXu02/nerfstudio into k…
kerrj Jan 20, 2024
5b84a92
Merge branch 'main' into main
kerrj Jan 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion nerfstudio/data/datamanagers/full_images_datamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(
self.train_dataset = self.create_train_dataset()
self.eval_dataset = self.create_eval_dataset()
if len(self.train_dataset) > 500 and self.config.cache_images == "gpu":
CONSOLE.print("Train dataset has over 500 images, overriding cach_images to cpu", style="bold yellow")
CONSOLE.print("Train dataset has over 500 images, overriding cache_images to cpu", style="bold yellow")
self.config.cache_images = "cpu"
self.cached_train, self.cached_eval = self.cache_images(self.config.cache_images)
self.exclude_batch_keys_from_device = self.train_dataset.exclude_batch_keys_from_device
Expand All @@ -130,6 +130,7 @@ def cache_images(self, cache_images_option):
camera = self.train_dataset.cameras[i].reshape(())
K = camera.get_intrinsics_matrices().numpy()
if camera.distortion_params is None:
cached_train.append(data)
continue
distortion_params = camera.distortion_params.numpy()
image = data["image"].numpy()
Expand Down Expand Up @@ -205,6 +206,7 @@ def cache_images(self, cache_images_option):
camera = self.eval_dataset.cameras[i].reshape(())
K = camera.get_intrinsics_matrices().numpy()
if camera.distortion_params is None:
cached_eval.append(data)
continue
distortion_params = camera.distortion_params.numpy()
image = data["image"].numpy()
Expand Down
11 changes: 6 additions & 5 deletions nerfstudio/data/dataparsers/blender_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from nerfstudio.data.scene_box import SceneBox
from nerfstudio.utils.colors import get_color
from nerfstudio.utils.io import load_from_json
from nerfstudio.model_components.renderers import force_background_color_override


@dataclass
Expand Down Expand Up @@ -57,13 +58,13 @@ def __init__(self, config: BlenderDataParserConfig):
self.data: Path = config.data
self.scale_factor: float = config.scale_factor
self.alpha_color = config.alpha_color

def _generate_dataparser_outputs(self, split="train"):
if self.alpha_color is not None:
alpha_color_tensor = get_color(self.alpha_color)
self.alpha_color_tensor = get_color(self.alpha_color)
force_background_color_override(self.alpha_color_tensor)
else:
alpha_color_tensor = None
self.alpha_color_tensor = None

def _generate_dataparser_outputs(self, split="train"):
meta = load_from_json(self.data / f"transforms_{split}.json")
image_filenames = []
poses = []
Expand Down Expand Up @@ -98,7 +99,7 @@ def _generate_dataparser_outputs(self, split="train"):
dataparser_outputs = DataparserOutputs(
image_filenames=image_filenames,
cameras=cameras,
alpha_color=alpha_color_tensor,
alpha_color=self.alpha_color_tensor,
scene_box=scene_box,
dataparser_scale=self.scale_factor,
)
Expand Down
6 changes: 6 additions & 0 deletions nerfstudio/model_components/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ def background_color_override_context(mode: Float[Tensor, "3"]) -> Generator[Non
BACKGROUND_COLOR_OVERRIDE = old_background_color


def force_background_color_override(mode: Float[Tensor, "3"]) -> None:
"""Force background color override."""
global BACKGROUND_COLOR_OVERRIDE
BACKGROUND_COLOR_OVERRIDE = mode


class RGBRenderer(nn.Module):
"""Standard volumetric rendering.

Expand Down
11 changes: 6 additions & 5 deletions nerfstudio/models/gaussian_splatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,15 @@ def get_outputs(self, camera: Cameras) -> Dict[str, Union[torch.Tensor, List]]:
if self.training:
# currently relies on the branch vickie/camera-grads
self.camera_optimizer.apply_to_camera(camera)
if self.training:
background = torch.rand(3, device=self.device)
# get the background color
if renderers.BACKGROUND_COLOR_OVERRIDE is not None:
background = renderers.BACKGROUND_COLOR_OVERRIDE.to(self.device)
else:
# logic for setting the background of the scene
if renderers.BACKGROUND_COLOR_OVERRIDE is not None:
background = renderers.BACKGROUND_COLOR_OVERRIDE
if self.training:
background = torch.rand(3, device=self.device)
else:
background = self.back_color.to(self.device)

if self.crop_box is not None and not self.training:
crop_ids = self.crop_box.within(self.means).squeeze()
if crop_ids.sum() == 0:
Expand Down
Loading