4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 18:44:21 +08:00

Merge branch 'main' into justin/fix_crop

This commit is contained in:
Matthew Tancik 2023-08-20 11:11:07 -07:00 committed by GitHub
commit 81e67245ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 58 additions and 34 deletions

View File

@ -72,6 +72,8 @@ We are committed to providing learning resources to help you understand the basi
Have feature requests? Want to add your brand-spankin'-new NeRF model? Have a new dataset? **We welcome [contributions](https://docs.nerf.studio/en/latest/reference/contributing.html)!** Please do not hesitate to reach out to the nerfstudio team with any questions via [Discord](https://discord.gg/uMbNqcraFc).
Have feedback? We'd love for you to fill out our [Nerfstudio Feedback Form](https://forms.gle/sqN5phJN7LfQVwnP9) if you want to let us know who you are, why you are interested in Nerfstudio, or provide any feedback!
We hope nerfstudio enables you to build faster :hammer: learn together :books: and contribute to our NeRF community :sparkling_heart:.
## Sponsors
@ -298,6 +300,7 @@ If you're interested in learning more on how to create your own pipelines, devel
| 💖 **Community** |
| [Discord](https://discord.gg/uMbNqcraFc) | Join our community to discuss more. We would love to hear from you! |
| [Twitter](https://twitter.com/nerfstudioteam) | Follow us on Twitter @nerfstudioteam to see cool updates and announcements |
| [Feedback Form](TODO) | We welcome any feedback! This is our chance to learn what you all are using Nerfstudio for. |
# Supported Features

View File

@ -67,9 +67,11 @@ Nerfstudio initially launched as an opensource project by Berkeley students in [
We are committed to providing learning resources to help you understand the basics of (if you're just getting started), and keep up-to-date with (if you're a seasoned veteran) all things NeRF. As researchers, we know just how hard it is to get onboarded with this next-gen technology. So we're here to help with tutorials, documentation, and more!
Finally, have feature requests? Want to add your brand-spankin'-new NeRF model? Have a new dataset? **We welcome [contributions](reference/contributing)!**
Have feature requests? Want to add your brand-spankin'-new NeRF model? Have a new dataset? **We welcome [contributions](reference/contributing)!**
Please do not hesitate to reach out to the nerfstudio team with any questions via [Discord](https://discord.gg/uMbNqcraFc).
Have feedback? We'd love for you to fill out our [Nerfstudio Feedback Form](https://forms.gle/sqN5phJN7LfQVwnP9) if you want to let us know who you are, why you are interested in Nerfstudio, or provide any feedback!
We hope nerfstudio enables you to build faster 🔨 learn together 📚 and contribute to our NeRF community 💖.
## Contents
@ -159,6 +161,7 @@ This documentation is organized into 3 parts:
| [Github](https://github.com/nerfstudio-project/nerfstudio) | Official Github Repo |
| [Discord](https://discord.gg/RyVk6w5WWP) | Join Discord Community |
| [Viewer](https://viewer.nerf.studio/) | Web-based Nerf Viewer |
| [Feedback Form](https://forms.gle/sqN5phJN7LfQVwnP9) | Provide Nerfstudio Feedback |
## Sponsors
Sponsors of this work includes [Luma AI](https://lumalabs.ai/) and the [BAIR commons](https://bcommons.berkeley.edu/home).

View File

@ -393,7 +393,7 @@ class PairPixelSampler(PixelSampler): # pylint: disable=too-few-public-methods
# overrides base method
def sample_method( # pylint: disable=no-self-use
self,
batch_size: int,
batch_size: Optional[int],
num_images: int,
image_height: int,
image_width: int,
@ -406,18 +406,25 @@ class PairPixelSampler(PixelSampler): # pylint: disable=too-few-public-methods
chosen_indices = random.sample(range(len(nonzero_indices)), k=self.rays_to_sample)
indices = nonzero_indices[chosen_indices]
else:
s = (self.rays_to_sample, 1)
rays_to_sample = self.rays_to_sample
if batch_size is not None:
assert (
int(batch_size) % 2 == 0
), f"PairPixelSampler can only return batch sizes in multiples of two (got {batch_size})"
rays_to_sample = batch_size // 2
s = (rays_to_sample, 1)
ns = torch.randint(0, num_images, s, dtype=torch.long, device=device)
hs = torch.randint(self.radius, image_height - self.radius, s, dtype=torch.long, device=device)
ws = torch.randint(self.radius, image_width - self.radius, s, dtype=torch.long, device=device)
indices = torch.concat((ns, hs, ws), dim=1)
pair_indices = torch.hstack(
(
torch.zeros(self.rays_to_sample, 1, device=device, dtype=torch.long),
torch.randint(-self.radius, self.radius, (self.rays_to_sample, 2), device=device, dtype=torch.long),
pair_indices = torch.hstack(
(
torch.zeros(rays_to_sample, 1, device=device, dtype=torch.long),
torch.randint(-self.radius, self.radius, (rays_to_sample, 2), device=device, dtype=torch.long),
)
)
)
pair_indices += indices
indices = torch.hstack((indices, pair_indices)).view(self.rays_to_sample * 2, 3)
pair_indices += indices
indices = torch.hstack((indices, pair_indices)).view(rays_to_sample * 2, 3)
return indices

View File

@ -108,7 +108,7 @@ class Optimizers:
Args:
param_group_name: name of scheduler to step forward
"""
if self.config.param_group_name.scheduler: # type: ignore
if "scheduler" in self.config[param_group_name]:
self.schedulers[param_group_name].step()
def zero_grad_all(self) -> None:

View File

@ -121,16 +121,22 @@ nerfstudio_file_ids = {
"redwoods2": grab_file_id("https://drive.google.com/file/d/1rg-4NoXT8p6vkmbWxMOY6PSG4j3rfcJ8/view?usp=sharing"),
"storefront": grab_file_id("https://drive.google.com/file/d/16b792AguPZWDA_YC4igKCwXJqW0Tb21o/view?usp=sharing"),
"vegetation": grab_file_id("https://drive.google.com/file/d/1wBhLQ2odycrtU39y2akVurXEAt9SsVI3/view?usp=sharing"),
"Egypt": "https://data.nerf.studio/nerfstudio/Egypt.zip",
"person": "https://data.nerf.studio/nerfstudio/person.zip",
"kitchen": "https://data.nerf.studio/nerfstudio/kitchen.zip",
"plane": "https://data.nerf.studio/nerfstudio/plane.zip",
"dozer": "https://data.nerf.studio/nerfstudio/dozer.zip",
"floating-tree": "https://data.nerf.studio/nerfstudio/floating-tree.zip",
"aspen": "https://data.nerf.studio/nerfstudio/aspen.zip",
"stump": "https://data.nerf.studio/nerfstudio/stump.zip",
"sculpture": "https://data.nerf.studio/nerfstudio/sculpture.zip",
"Giannini-Hall": "https://data.nerf.studio/nerfstudio/Giannini-Hall.zip",
"Egypt": grab_file_id("https://drive.google.com/file/d/1YktD85afw7uitC3nPamusk0vcBdAfjlF/view?view?usp=sharing"),
"person": grab_file_id("https://drive.google.com/file/d/1HsGMwkPu-R7oU7ySMdoo6Eppq8pKhHF3/view?view?usp=sharing"),
"kitchen": grab_file_id("https://drive.google.com/file/d/1IRmNyNZSNFidyj93Tt5DtaEU9h6eJdi1/view?view?usp=sharing"),
"plane": grab_file_id("https://drive.google.com/file/d/1tnv2NC2Iwz4XRYNtziUWvLJjObkZNo2D/view?view?usp=sharing"),
"dozer": grab_file_id("https://drive.google.com/file/d/1jQJPz5PhzTH--LOcCxvfzV_SDLEp1de3/view?view?usp=sharing"),
"floating-tree": grab_file_id(
"https://drive.google.com/file/d/1mVEHcO2ep13WPx92IPDvdQg66vLQwFSy/view?view?usp=sharing"
),
"aspen": grab_file_id("https://drive.google.com/file/d/1X1PQcji_QpxGfMxbETKMeK8aOnWCkuSB/view?view?usp=sharing"),
"stump": grab_file_id("https://drive.google.com/file/d/1yZFAAEvtw2hs4MXrrkvhVAzEliLLXPB7/view?view?usp=sharing"),
"sculpture": grab_file_id(
"https://drive.google.com/file/d/1CUU_k0Et2gysuBn_R5qenDMfYXEhNsd1/view?view?usp=sharing"
),
"Giannini-Hall": grab_file_id(
"https://drive.google.com/file/d/1UkjWXLN4qybq_a-j81FsTKghiXw39O8E/view?view?usp=sharing"
),
"all": None,
"nerfstudio-dataset": nerfstudio_dataset,
}
@ -184,7 +190,12 @@ def download_capture_name(save_dir: Path, dataset_name: str, capture_name: str,
@dataclass
class NerfstudioDownload(DatasetDownload):
"""Download the nerfstudio dataset."""
"""
Download data in the Nerfstudio format.
If you are interested in the Nerfstudio Dataset subset from the SIGGRAPH 2023 paper,
you can obtain that by using --capture-name nerfstudio-dataset or by visiting Google Drive directly at:
https://drive.google.com/drive/folders/19TV6kdVGcmg3cGZ1bNIUnBBMD-iQjRbG?usp=drive_link.
"""
capture_name: NerfstudioCaptureName = "bww_entrance"

View File

@ -141,31 +141,31 @@ class ControlPanel:
self.add_element(self._train_speed)
self.add_element(self._train_util)
with self.viser_server.gui_folder("Render Options"):
with self.viser_server.add_gui_folder("Render Options"):
self.add_element(self._max_res)
self.add_element(self._output_render)
self.add_element(self._colormap)
# colormap options
with self.viser_server.gui_folder(" "):
with self.viser_server.add_gui_folder(" "):
self.add_element(self._invert, additional_tags=("colormap",))
self.add_element(self._normalize, additional_tags=("colormap",))
self.add_element(self._min, additional_tags=("colormap",))
self.add_element(self._max, additional_tags=("colormap",))
# split options
with self.viser_server.gui_folder("Split Screen"):
with self.viser_server.add_gui_folder("Split Screen"):
self.add_element(self._split)
self.add_element(self._split_percentage, additional_tags=("split",))
self.add_element(self._split_output_render, additional_tags=("split",))
self.add_element(self._split_colormap, additional_tags=("split",))
with self.viser_server.gui_folder(" "):
with self.viser_server.add_gui_folder(" "):
self.add_element(self._split_invert, additional_tags=("split_colormap",))
self.add_element(self._split_normalize, additional_tags=("split_colormap",))
self.add_element(self._split_min, additional_tags=("split_colormap",))
self.add_element(self._split_max, additional_tags=("split_colormap",))
with self.viser_server.gui_folder("Crop Viewport"):
with self.viser_server.add_gui_folder("Crop Viewport"):
self.add_element(self._crop_viewport)
# Crop options

View File

@ -26,7 +26,7 @@ from viser import (
GuiButtonGroupHandle,
GuiButtonHandle,
GuiDropdownHandle,
GuiHandle,
GuiInputHandle,
ViserServer,
)
@ -49,14 +49,14 @@ class ViewerElement(Generic[TValue]):
cb_hook: Callable = lambda element: None,
) -> None:
self.name = name
self.gui_handle: Optional[Union[GuiHandle[TValue], GuiButtonHandle, GuiButtonGroupHandle]] = None
self.gui_handle: Optional[Union[GuiInputHandle[TValue], GuiButtonHandle, GuiButtonGroupHandle]] = None
self.disabled = disabled
self.cb_hook = cb_hook
@abstractmethod
def _create_gui_handle(self, viser_server: ViserServer) -> None:
"""
Returns the GuiHandle object which actually controls the parameter in the gui.
Returns the GuiInputHandle object which actually controls the parameter in the gui.
Args:
viser_server: The server to install the gui element into.
@ -100,7 +100,7 @@ class ViewerButton(ViewerElement[bool]):
super().__init__(name, disabled=disabled, cb_hook=cb_hook)
def _create_gui_handle(self, viser_server: ViserServer) -> None:
self.gui_handle = viser_server.add_gui_button(name=self.name, disabled=self.disabled)
self.gui_handle = viser_server.add_gui_button(self.name, disabled=self.disabled)
def install(self, viser_server: ViserServer) -> None:
self._create_gui_handle(viser_server)
@ -119,7 +119,7 @@ class ViewerParameter(ViewerElement[TValue], Generic[TValue]):
cb_hook: Callback to call on update
"""
gui_handle: GuiHandle
gui_handle: GuiInputHandle
def __init__(
self,

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "nerfstudio"
version = "0.3.2"
version = "0.3.3"
description = "All-in-one repository for state-of-the-art NeRFs"
readme = "README.md"
license = { text="Apache 2.0"}
@ -52,7 +52,7 @@ dependencies = [
"torchvision>=0.14.1",
"torchmetrics[image]>=1.0.1",
"typing_extensions>=4.4.0",
"viser>=0.0.12",
"viser==0.1.0",
"nuscenes-devkit>=1.1.1",
"wandb>=0.13.3",
"xatlas",