mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 22:08:41 +08:00
fix large number of typos in repository (#1977)
* fix large number of typos in repository * fix typos in tests
This commit is contained in:
1 parent
ccdcc3951e
commit
d413ca4204
32 files changed
+48
-48
No files matched your search
@@ -117,7 +117,7 @@ dataparser_outputs = dataparser.get_dataparser_outputs(split="train")
|
|||||||
input_dataset = InputDataset(dataparser_outputs)
|
input_dataset = InputDataset(dataparser_outputs)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also pull out information from the DataParserOutputs for other DataMangager components, such as the RayGenerator. The RayGenerator generates RayBundle objects from camera and pixel indices.
|
You can also pull out information from the DataParserOutputs for other DataManager components, such as the RayGenerator. The RayGenerator generates RayBundle objects from camera and pixel indices.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
ray_generator = RayGenerator(dataparser_outputs.cameras)
|
ray_generator = RayGenerator(dataparser_outputs.cameras)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ You can learn more about these methods [here](https://github.com/autonomousvisio
|
|||||||
|
|
||||||
## Surface models in nerfstudio
|
## Surface models in nerfstudio
|
||||||
|
|
||||||
We intend to integrate many of the SDFStudio improvments back into the nerstudio core repository.
|
We intend to integrate many of the SDFStudio improvements back into the nerfstudio core repository.
|
||||||
|
|
||||||
Supported methods:
|
Supported methods:
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -103,7 +103,7 @@ This documentation is organized into 3 parts:
|
|||||||
|
|
||||||
- [**Nerfacto**](nerfology/methods/nerfacto.md): Recommended method, integrates mutiple methods into one.
|
- [**Nerfacto**](nerfology/methods/nerfacto.md): Recommended method, integrates mutiple methods into one.
|
||||||
- [Instant-NGP](nerfology/methods/instant_ngp.md): Instant Neural Graphics Primitives with a Multiresolution Hash Encoding
|
- [Instant-NGP](nerfology/methods/instant_ngp.md): Instant Neural Graphics Primitives with a Multiresolution Hash Encoding
|
||||||
- [NeRF](nerfology/methods/nerf.md): OG Nerual Radiance Fields
|
- [NeRF](nerfology/methods/nerf.md): OG Neural Radiance Fields
|
||||||
- [Mip-NeRF](nerfology/methods/mipnerf.md): A Multiscale Representation for Anti-Aliasing Neural Radiance Fields
|
- [Mip-NeRF](nerfology/methods/mipnerf.md): A Multiscale Representation for Anti-Aliasing Neural Radiance Fields
|
||||||
- [TensoRF](nerfology/methods/tensorf.md): Tensorial Radiance Fields
|
- [TensoRF](nerfology/methods/tensorf.md): Tensorial Radiance Fields
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ The code snippet for how an image is edited in the pipeline can be found [here](
|
|||||||
|
|
||||||
When NeRF training starts, the dataset consists of the original, unedited images used to train the original scene. These images are saved separately to use as conditioning for InstructPix2Pix. At each optimization step, some number of NeRF optimization steps are performed, and then some number of images (often just one) are updated. The images are randomly ordered prior to training and then at each step, the images are chosen in order to edit. Once an image has been edited, it is replaced in the dataset. Importantly, at each NeRF step, rays are sampled across the entire dataset, meaning there is a mixed source of supervision between edited images and unedited images. This allows for a gradual optimization that balances maintaining the 3D structure and consistency of the NeRF as well as performing the edit.
|
When NeRF training starts, the dataset consists of the original, unedited images used to train the original scene. These images are saved separately to use as conditioning for InstructPix2Pix. At each optimization step, some number of NeRF optimization steps are performed, and then some number of images (often just one) are updated. The images are randomly ordered prior to training and then at each step, the images are chosen in order to edit. Once an image has been edited, it is replaced in the dataset. Importantly, at each NeRF step, rays are sampled across the entire dataset, meaning there is a mixed source of supervision between edited images and unedited images. This allows for a gradual optimization that balances maintaining the 3D structure and consistency of the NeRF as well as performing the edit.
|
||||||
|
|
||||||
At early iterations of this process, the edited images may be inconistent with one another, as InstructPix2Pix often doesn't perform consistent edits across viewpoints. However, over time, since images are edited using the current render of the NeRF, the edits begin to converge towards a globally consistent depiction of the underlying scene. Here is an example of how the underlying dataset evolves and becomes more consistent.
|
At early iterations of this process, the edited images may be inconsistent with one another, as InstructPix2Pix often doesn't perform consistent edits across viewpoints. However, over time, since images are edited using the current render of the NeRF, the edits begin to converge towards a globally consistent depiction of the underlying scene. Here is an example of how the underlying dataset evolves and becomes more consistent.
|
||||||
|
|
||||||
<video id="idu" muted autoplay playsinline loop controls width="100%">
|
<video id="idu" muted autoplay playsinline loop controls width="100%">
|
||||||
<source id="mp4" src="https://instruct-nerf2nerf.github.io/data/videos/du_update.mp4" type="video/mp4">
|
<source id="mp4" src="https://instruct-nerf2nerf.github.io/data/videos/du_update.mp4" type="video/mp4">
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ The core idea behind the improved sampling technique is that sampling over empty
|
|||||||
|
|
||||||
Nerfstudio uses [NerfAcc](https://www.nerfacc.com/en/latest/index.html) as the sampling algorithm implementation. The details on NerfAcc's sampling and occupancy grid is discussed [here](https://www.nerfacc.com/en/stable/methodology/sampling.html#occupancy-grid-estimator).
|
Nerfstudio uses [NerfAcc](https://www.nerfacc.com/en/latest/index.html) as the sampling algorithm implementation. The details on NerfAcc's sampling and occupancy grid is discussed [here](https://www.nerfacc.com/en/stable/methodology/sampling.html#occupancy-grid-estimator).
|
||||||
|
|
||||||
Another major bottleneck for NeRF's training speed has been querying the neural network. The authors of this work implement the network such that it runs entirely on a single CUDA kernal. The network is also shrunk down to be just 4 layers with 64 neurons in each layer. They show that their fully-fused neural network is 5-10x faster than a Tensorflow implementation.
|
Another major bottleneck for NeRF's training speed has been querying the neural network. The authors of this work implement the network such that it runs entirely on a single CUDA kernel. The network is also shrunk down to be just 4 layers with 64 neurons in each layer. They show that their fully-fused neural network is 5-10x faster than a Tensorflow implementation.
|
||||||
|
|
||||||
Nerfstudio uses the [tinycudann](https://github.com/NVlabs/tiny-cuda-nn) framework to utilize the fully-fused neural networks.
|
Nerfstudio uses the [tinycudann](https://github.com/NVlabs/tiny-cuda-nn) framework to utilize the fully-fused neural networks.
|
||||||
|
|
||||||
@@ -62,8 +62,8 @@ Steps 1-3 are done independently at each resolution level. Thus, since these fea
|
|||||||
|
|
||||||
An important note is that hash collisions are not explicitly handled. At each hash index, there may be multiple vertices which index to that feature vector, but because these vectors are trainable, the vertices that are most important to the specific output will have the highest gradient, and therefore automatically dominate the optimization of that feature.
|
An important note is that hash collisions are not explicitly handled. At each hash index, there may be multiple vertices which index to that feature vector, but because these vectors are trainable, the vertices that are most important to the specific output will have the highest gradient, and therefore automatically dominate the optimization of that feature.
|
||||||
|
|
||||||
This encoding structure creates a tradeoff betweewn quality, memory, and performance. The main parameters which can be adjusted are the size of the hash table (T), the size of the feature vectors (F), and the number of resolutions (L).
|
This encoding structure creates a tradeoff between quality, memory, and performance. The main parameters which can be adjusted are the size of the hash table (T), the size of the feature vectors (F), and the number of resolutions (L).
|
||||||
|
|
||||||
Instant-NGP encodes the vieweing direction using spherical harmonic encodings.
|
Instant-NGP encodes the viewing direction using spherical harmonic encodings.
|
||||||
|
|
||||||
Our [`nerfacto`](./nerfacto.md) model uses both the fully-fused MLP and the hash encoder, which were inspired by Instant-NGP. Lastly, our implementation covers the major ideas from Instant-NGP, but it doesn't strictly follow every detail. Some known differences include learning rate schedulers, hyper-parameters for sampling, and how camera gradients are calculated if enabled.
|
Our [`nerfacto`](./nerfacto.md) model uses both the fully-fused MLP and the hash encoder, which were inspired by Instant-NGP. Lastly, our implementation covers the major ideas from Instant-NGP, but it doesn't strictly follow every detail. Some known differences include learning rate schedulers, hyper-parameters for sampling, and how camera gradients are calculated if enabled.
|
||||||
@@ -357,7 +357,7 @@ class Cameras(TensorDataclass):
|
|||||||
keeping dimensions. If False, we flatten at the end. If True, then we keep the shape of the
|
keeping dimensions. If False, we flatten at the end. If True, then we keep the shape of the
|
||||||
camera_indices and coords tensors (if we can).
|
camera_indices and coords tensors (if we can).
|
||||||
disable_distortion: If True, disables distortion.
|
disable_distortion: If True, disables distortion.
|
||||||
aabb_box: if not None will calculate nears and fars of the ray according to aabb box intesection
|
aabb_box: if not None will calculate nears and fars of the ray according to aabb box intersection
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Rays for the given camera indices and coords.
|
Rays for the given camera indices and coords.
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ method_configs["neus-facto"] = TrainerConfig(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
model=NeuSFactoModelConfig(
|
model=NeuSFactoModelConfig(
|
||||||
# proposal network allows for signifanctly smaller sdf/color network
|
# proposal network allows for significantly smaller sdf/color network
|
||||||
sdf_field=SDFFieldConfig(
|
sdf_field=SDFFieldConfig(
|
||||||
use_grid_feature=True,
|
use_grid_feature=True,
|
||||||
num_layers=2,
|
num_layers=2,
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ class DataManager(nn.Module):
|
|||||||
step: the step number of the eval image to retrieve
|
step: the step number of the eval image to retrieve
|
||||||
Returns:
|
Returns:
|
||||||
A tuple of the ray bundle for the image, and a dictionary of additional batch information
|
A tuple of the ray bundle for the image, and a dictionary of additional batch information
|
||||||
such as the groudtruth image.
|
such as the groundtruth image.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@@ -258,19 +258,19 @@ class DataManager(nn.Module):
|
|||||||
step: the step number of the eval image to retrieve
|
step: the step number of the eval image to retrieve
|
||||||
Returns:
|
Returns:
|
||||||
A tuple of the ray bundle for the image, and a dictionary of additional batch information
|
A tuple of the ray bundle for the image, and a dictionary of additional batch information
|
||||||
such as the groudtruth image.
|
such as the groundtruth image.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def next_eval_image(self, step: int) -> Tuple[int, RayBundle, Dict]:
|
def next_eval_image(self, step: int) -> Tuple[int, RayBundle, Dict]:
|
||||||
"""Retreive the next eval image.
|
"""Retrieve the next eval image.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
step: the step number of the eval image to retrieve
|
step: the step number of the eval image to retrieve
|
||||||
Returns:
|
Returns:
|
||||||
A tuple of the step number, the ray bundle for the image, and a dictionary of
|
A tuple of the step number, the ray bundle for the image, and a dictionary of
|
||||||
additional batch information such as the groudtruth image.
|
additional batch information such as the groundtruth image.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ def traj_string_to_matrix(traj_string: str):
|
|||||||
class ARKitScenesDataParserConfig(DataParserConfig):
|
class ARKitScenesDataParserConfig(DataParserConfig):
|
||||||
"""ARKitScenes dataset config.
|
"""ARKitScenes dataset config.
|
||||||
ARKitScenes dataset (http://github.com/apple/ARKitScenes) is a large-scale 3D dataset of indoor scenes.
|
ARKitScenes dataset (http://github.com/apple/ARKitScenes) is a large-scale 3D dataset of indoor scenes.
|
||||||
This dataparser uses 3D deteciton subset of the ARKitScenes dataset.
|
This dataparser uses 3D detection subset of the ARKitScenes dataset.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_target: Type = field(default_factory=lambda: ARKitScenes)
|
_target: Type = field(default_factory=lambda: ARKitScenes)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class InstantNGP(DataParser):
|
|||||||
if not fname.exists():
|
if not fname.exists():
|
||||||
fname = data_dir / Path(frame["file_path"] + ".png")
|
fname = data_dir / Path(frame["file_path"] + ".png")
|
||||||
if not fname.exists():
|
if not fname.exists():
|
||||||
CONSOLE.log(f"couldnt find {fname} image")
|
CONSOLE.log(f"couldn't find {fname} image")
|
||||||
num_skipped_image_filenames += 1
|
num_skipped_image_filenames += 1
|
||||||
else:
|
else:
|
||||||
if "w" not in meta:
|
if "w" not in meta:
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ class PatchPixelSampler(PixelSampler):
|
|||||||
super().__init__(num_rays, keep_full_image, **kwargs)
|
super().__init__(num_rays, keep_full_image, **kwargs)
|
||||||
|
|
||||||
def set_num_rays_per_batch(self, num_rays_per_batch: int):
|
def set_num_rays_per_batch(self, num_rays_per_batch: int):
|
||||||
"""Set the number of rays to sample per batch. Overrided to deal with patch-based sampling.
|
"""Set the number of rays to sample per batch. Overridden to deal with patch-based sampling.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
num_rays_per_batch: number of rays to sample per batch
|
num_rays_per_batch: number of rays to sample per batch
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class NerfplayerNGPField(Field):
|
|||||||
Sometimes we need to disable viewing dependent effects in a dynamic scene, because there is
|
Sometimes we need to disable viewing dependent effects in a dynamic scene, because there is
|
||||||
ambiguity between being dynamic and viewing dependent effects. For example, the shadow of the camera
|
ambiguity between being dynamic and viewing dependent effects. For example, the shadow of the camera
|
||||||
should be a dynamic effect, but may be reconstructed as viewing dependent effects.
|
should be a dynamic effect, but may be reconstructed as viewing dependent effects.
|
||||||
num_images: number of images, requried if use_appearance_embedding is True
|
num_images: number of images, required if use_appearance_embedding is True
|
||||||
appearance_embedding_dim: dimension of appearance embedding
|
appearance_embedding_dim: dimension of appearance embedding
|
||||||
contraction_type: type of contraction
|
contraction_type: type of contraction
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class SphereCollider(SceneCollider):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
center: center of sphere to intersect [3]
|
center: center of sphere to intersect [3]
|
||||||
redius: radius of sphere to intersect
|
radius: radius of sphere to intersect
|
||||||
near_plane: near plane to clamp to
|
near_plane: near plane to clamp to
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ class SurfaceModelConfig(ModelConfig):
|
|||||||
background_model: Literal["grid", "mlp", "none"] = "mlp"
|
background_model: Literal["grid", "mlp", "none"] = "mlp"
|
||||||
"""background models"""
|
"""background models"""
|
||||||
num_samples_outside: int = 32
|
num_samples_outside: int = 32
|
||||||
"""Number of samples outside the bounding sphere for backgound"""
|
"""Number of samples outside the bounding sphere for background"""
|
||||||
periodic_tvl_mult: float = 0.0
|
periodic_tvl_mult: float = 0.0
|
||||||
"""Total variational loss mutliplier"""
|
"""Total variational loss multiplier"""
|
||||||
overwrite_near_far_plane: bool = False
|
overwrite_near_far_plane: bool = False
|
||||||
"""whether to use near and far collider from command line"""
|
"""whether to use near and far collider from command line"""
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ class SurfaceModel(Model):
|
|||||||
depth_bg = self.renderer_depth(weights=weights_bg, ray_samples=ray_samples_bg)
|
depth_bg = self.renderer_depth(weights=weights_bg, ray_samples=ray_samples_bg)
|
||||||
accumulation_bg = self.renderer_accumulation(weights=weights_bg)
|
accumulation_bg = self.renderer_accumulation(weights=weights_bg)
|
||||||
|
|
||||||
# merge background color to forgound color
|
# merge background color to foregound color
|
||||||
rgb = rgb + bg_transmittance * rgb_bg
|
rgb = rgb + bg_transmittance * rgb_bg
|
||||||
|
|
||||||
bg_outputs = {
|
bg_outputs = {
|
||||||
|
|||||||
@@ -605,28 +605,28 @@ def create_sfm_depth(
|
|||||||
return image_id_to_depth_path
|
return image_id_to_depth_path
|
||||||
|
|
||||||
|
|
||||||
def get_matching_summary(num_intial_frames: int, num_matched_frames: int) -> str:
|
def get_matching_summary(num_initial_frames: int, num_matched_frames: int) -> str:
|
||||||
"""Returns a summary of the matching results.
|
"""Returns a summary of the matching results.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
num_intial_frames: The number of initial frames.
|
num_initial_frames: The number of initial frames.
|
||||||
num_matched_frames: The number of matched frames.
|
num_matched_frames: The number of matched frames.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A summary of the matching results.
|
A summary of the matching results.
|
||||||
"""
|
"""
|
||||||
match_ratio = num_matched_frames / num_intial_frames
|
match_ratio = num_matched_frames / num_initial_frames
|
||||||
if match_ratio == 1:
|
if match_ratio == 1:
|
||||||
return "[bold green]COLMAP found poses for all images, CONGRATS!"
|
return "[bold green]COLMAP found poses for all images, CONGRATS!"
|
||||||
if match_ratio < 0.4:
|
if match_ratio < 0.4:
|
||||||
result = f"[bold red]COLMAP only found poses for {num_matched_frames / num_intial_frames * 100:.2f}%"
|
result = f"[bold red]COLMAP only found poses for {num_matched_frames / num_initial_frames * 100:.2f}%"
|
||||||
result += " of the images. This is low.\nThis can be caused by a variety of reasons,"
|
result += " of the images. This is low.\nThis can be caused by a variety of reasons,"
|
||||||
result += " such poor scene coverage, blurry images, or large exposure changes."
|
result += " such poor scene coverage, blurry images, or large exposure changes."
|
||||||
return result
|
return result
|
||||||
if match_ratio < 0.8:
|
if match_ratio < 0.8:
|
||||||
result = f"[bold yellow]COLMAP only found poses for {num_matched_frames / num_intial_frames * 100:.2f}%"
|
result = f"[bold yellow]COLMAP only found poses for {num_matched_frames / num_initial_frames * 100:.2f}%"
|
||||||
result += " of the images.\nThis isn't great, but may be ok."
|
result += " of the images.\nThis isn't great, but may be ok."
|
||||||
result += "\nMissing poses can be caused by a variety of reasons, such poor scene coverage, blurry images,"
|
result += "\nMissing poses can be caused by a variety of reasons, such poor scene coverage, blurry images,"
|
||||||
result += " or large exposure changes."
|
result += " or large exposure changes."
|
||||||
return result
|
return result
|
||||||
return f"[bold green]COLMAP found poses for {num_matched_frames / num_intial_frames * 100:.2f}% of the images."
|
return f"[bold green]COLMAP found poses for {num_matched_frames / num_initial_frames * 100:.2f}% of the images."
|
||||||
@@ -199,7 +199,7 @@ def generate_planar_projections_from_equirectangular(
|
|||||||
|
|
||||||
|
|
||||||
def compute_resolution_from_equirect(image_dir: Path, num_images: int) -> Tuple[int, int]:
|
def compute_resolution_from_equirect(image_dir: Path, num_images: int) -> Tuple[int, int]:
|
||||||
"""Compute the resolution of the persepctive projections of equirectangular images
|
"""Compute the resolution of the perspective projections of equirectangular images
|
||||||
from the heuristic: num_image * res**2 = orig_height * orig_width.
|
from the heuristic: num_image * res**2 = orig_height * orig_width.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ class ReadJSONinputCameraPath(bpy.types.Operator):
|
|||||||
transformed_camera_path_mat = [] # final transformed world matrix of the camera at each frame
|
transformed_camera_path_mat = [] # final transformed world matrix of the camera at each frame
|
||||||
input_json = None
|
input_json = None
|
||||||
|
|
||||||
def read_camera_coodinates(self):
|
def read_camera_coordinates(self):
|
||||||
"""Read the camera coordinates (world matrix and fov) from the json camera path."""
|
"""Read the camera coordinates (world matrix and fov) from the json camera path."""
|
||||||
|
|
||||||
json_cam_path = self.input_json["camera_path"]
|
json_cam_path = self.input_json["camera_path"]
|
||||||
@@ -333,7 +333,7 @@ class ReadJSONinputCameraPath(bpy.types.Operator):
|
|||||||
self.input_json = json.load(json_ns_file)
|
self.input_json = json.load(json_ns_file)
|
||||||
|
|
||||||
# call methods to read cam path and create camera
|
# call methods to read cam path and create camera
|
||||||
self.read_camera_coodinates()
|
self.read_camera_coordinates()
|
||||||
self.generate_camera()
|
self.generate_camera()
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ def main(mode: ConfigureMode = "install") -> None:
|
|||||||
assert_never(mode)
|
assert_never(mode)
|
||||||
|
|
||||||
if conda_path is not None:
|
if conda_path is not None:
|
||||||
# In conda environment we add the completitions activation scripts.
|
# In conda environment we add the completions activation scripts.
|
||||||
commands = _get_all_entry_points()
|
commands = _get_all_entry_points()
|
||||||
_update_conda_scripts(commands, completions_dir, mode)
|
_update_conda_scripts(commands, completions_dir, mode)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ class ExportMarchingCubesMesh(Exporter):
|
|||||||
self.resolution % 512 == 0
|
self.resolution % 512 == 0
|
||||||
), f"""resolution must be divisible by 512, got {self.resolution}.
|
), f"""resolution must be divisible by 512, got {self.resolution}.
|
||||||
This is important because the algorithm uses a multi-resolution approach
|
This is important because the algorithm uses a multi-resolution approach
|
||||||
to evaluate the SDF where the mimimum resolution is 512."""
|
to evaluate the SDF where the minimum resolution is 512."""
|
||||||
|
|
||||||
# Extract mesh using marching cubes for sdf at a multi-scale resolution.
|
# Extract mesh using marching cubes for sdf at a multi-scale resolution.
|
||||||
multi_res_mesh = generate_mesh_with_multires_marching_cubes(
|
multi_res_mesh = generate_mesh_with_multires_marching_cubes(
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
Visualization code for plotly.
|
Visualization code for plotly.
|
||||||
The function use prefix conventions in the following way:
|
The function use prefix conventions in the following way:
|
||||||
- 'get_*' functions (e.g., 'get_camera_frustums')
|
- 'get_*' functions (e.g., 'get_camera_frustums')
|
||||||
return data that can be ploted with plotly
|
return data that can be plotted with plotly
|
||||||
- 'vis_*' functions (e.g., 'vis_camera_rays')
|
- 'vis_*' functions (e.g., 'vis_camera_rays')
|
||||||
return 'go.Figure' objects which are the plots. Go Figure! :')
|
return 'go.Figure' objects which are the plots. Go Figure! :')
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ $sidebar-width: 100% !default;
|
|||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
// Viewport Controls Modal styling
|
// Viewport Controls Modal styling
|
||||||
|
|
||||||
.ViewportConstrolsModal-box {
|
.ViewportControlsModal-box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
|||||||
@@ -737,7 +737,7 @@ export default function CameraPanel(props) {
|
|||||||
transform_controls.addEventListener('mouseDown', (event) => {
|
transform_controls.addEventListener('mouseDown', (event) => {
|
||||||
// prevent multiple loops
|
// prevent multiple loops
|
||||||
if (update_cameras_interval === null) {
|
if (update_cameras_interval === null) {
|
||||||
// hardcoded for 100 ms per udpate
|
// hardcoded for 100 ms per update
|
||||||
update_cameras_interval = setInterval(() => {}, 100);
|
update_cameras_interval = setInterval(() => {}, 100);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function ControlsModal() {
|
|||||||
aria-labelledby="modal-modal-title"
|
aria-labelledby="modal-modal-title"
|
||||||
aria-describedby="modal-modal-description"
|
aria-describedby="modal-modal-description"
|
||||||
>
|
>
|
||||||
<Box className="ViewportConstrolsModal-box">
|
<Box className="ViewportControlsModal-box">
|
||||||
<center>
|
<center>
|
||||||
<img
|
<img
|
||||||
style={{ height: 37, margin: 'auto' }}
|
style={{ height: 37, margin: 'auto' }}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
""" Utilites for generating custom gui elements in the viewer """
|
""" Utilities for generating custom gui elements in the viewer """
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class RenderStateMachine(threading.Thread):
|
|||||||
# never overwrite rerenders
|
# never overwrite rerenders
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# monimal use case, just set the next action
|
# minimal use case, just set the next action
|
||||||
self.next_action = action
|
self.next_action = action
|
||||||
|
|
||||||
# handle interrupt logic
|
# handle interrupt logic
|
||||||
@@ -107,7 +107,7 @@ class RenderStateMachine(threading.Thread):
|
|||||||
self.render_trigger.set()
|
self.render_trigger.set()
|
||||||
|
|
||||||
def _render_img(self, cam_msg: CameraMessage):
|
def _render_img(self, cam_msg: CameraMessage):
|
||||||
"""Takes the current camera, generates rays, and renders the iamge
|
"""Takes the current camera, generates rays, and renders the image
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
cam_msg: the camera message to render
|
cam_msg: the camera message to render
|
||||||
@@ -238,7 +238,7 @@ class RenderStateMachine(threading.Thread):
|
|||||||
"""Calculate the maximum image height that can be rendered in the time budget
|
"""Calculate the maximum image height that can be rendered in the time budget
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
apect_ratio: the aspect ratio of the current view
|
aspect_ratio: the aspect ratio of the current view
|
||||||
Returns:
|
Returns:
|
||||||
image_height: the maximum image height that can be rendered in the time budget
|
image_height: the maximum image height that can be rendered in the time budget
|
||||||
image_width: the maximum image width that can be rendered in the time budget
|
image_width: the maximum image width that can be rendered in the time budget
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ class ViewerState:
|
|||||||
return camera
|
return camera
|
||||||
|
|
||||||
def _pick_drawn_image_idxs(self, total_num: int) -> list[int]:
|
def _pick_drawn_image_idxs(self, total_num: int) -> list[int]:
|
||||||
"""Determine indicies of images to display in viewer.
|
"""Determine indices of images to display in viewer.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
total_num: total number of training images.
|
total_num: total number of training images.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
""" Viser is used for the nerfstudio viewr backend """
|
""" Viser is used for the nerfstudio viewer backend """
|
||||||
|
|
||||||
|
|
||||||
from .message_api import GuiHandle as GuiHandle
|
from .message_api import GuiHandle as GuiHandle
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class MessageApi(abc.ABC):
|
|||||||
"""Interface for all commands we can use to send messages over a websocket connection.
|
"""Interface for all commands we can use to send messages over a websocket connection.
|
||||||
|
|
||||||
Should be implemented by both our global server object (for broadcasting) and by
|
Should be implemented by both our global server object (for broadcasting) and by
|
||||||
invidividual clients."""
|
individual clients."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self._handle_state_from_gui_name: Dict[str, _GuiHandleState[Any]] = {}
|
self._handle_state_from_gui_name: Dict[str, _GuiHandleState[Any]] = {}
|
||||||
|
|||||||
@@ -186,10 +186,10 @@ class DatasetImageMessage(NerfstudioMessage):
|
|||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
class TrainingStateMessage(NerfstudioMessage):
|
class TrainingStateMessage(NerfstudioMessage):
|
||||||
"""Wheather the scene is in training mode or not."""
|
"""Whether the scene is in training mode or not."""
|
||||||
|
|
||||||
training_state: Literal["training", "paused", "completed"]
|
training_state: Literal["training", "paused", "completed"]
|
||||||
"""True if the model is currently trianing, False otherwise"""
|
"""True if the model is currently training, False otherwise"""
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def test_tv_loss():
|
|||||||
for k in range(10):
|
for k in range(10):
|
||||||
grids[0, k, i, j] = grid_location
|
grids[0, k, i, j] = grid_location
|
||||||
|
|
||||||
# TV_row = 1, TV_col = 1. Totol tv should be 2 * (TV_row + TV_col)
|
# TV_row = 1, TV_col = 1. Total tv should be 2 * (TV_row + TV_col)
|
||||||
assert tv_loss(grids).item() == 4.0
|
assert tv_loss(grids).item() == 4.0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from nerfstudio.process_data.images_to_nerfstudio_dataset import (
|
|||||||
|
|
||||||
def random_quaternion(num_poses: int):
|
def random_quaternion(num_poses: int):
|
||||||
"""
|
"""
|
||||||
Generates random rotation quatenion.
|
Generates random rotation quaternion.
|
||||||
"""
|
"""
|
||||||
u, v, w = np.random.uniform(size=(3, num_poses))
|
u, v, w = np.random.uniform(size=(3, num_poses))
|
||||||
quaternion = np.stack(
|
quaternion = np.stack(
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ def _get_random_aabb_box(max_box, device):
|
|||||||
|
|
||||||
def _get_random_rays(num_rays, max_box, aabb, device):
|
def _get_random_rays(num_rays, max_box, aabb, device):
|
||||||
"""
|
"""
|
||||||
genrate random rays that distribute in the general direction of the box.
|
generate random rays that distribute in the general direction of the box.
|
||||||
The implementation is naive for now.
|
The implementation is naive for now.
|
||||||
:param num_rays:
|
:param num_rays:
|
||||||
:param max_box:
|
:param max_box:
|
||||||
|
|||||||
Reference in new issue
Block a user