mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-22 07:35:26 +08:00
sorting imports on save; cleanup imports sorting; add isort check (#207)
This commit is contained in:
1 parent
6050dfb6e3
commit
1cd697366e
46 files changed
+160
-80
No files matched your search
@@ -27,6 +27,8 @@ jobs:
|
|||||||
- name: Run license checks
|
- name: Run license checks
|
||||||
run: |
|
run: |
|
||||||
./scripts/licensing/license_headers.sh --check
|
./scripts/licensing/license_headers.sh --check
|
||||||
|
- name: Run isort
|
||||||
|
run: isort . --profile black --check
|
||||||
- name: Run Black
|
- name: Run Black
|
||||||
run: black nerfactory/ scripts/ notebooks/ --check
|
run: black nerfactory/ scripts/ notebooks/ --check
|
||||||
- name: Python Pylint
|
- name: Python Pylint
|
||||||
|
|||||||
Vendored
+4
-1
@@ -9,7 +9,10 @@
|
|||||||
},
|
},
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"[python]": {
|
"[python]": {
|
||||||
"editor.defaultFormatter": "ms-python.python"
|
"editor.defaultFormatter": "ms-python.python",
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.organizeImports": true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"python.envFile": "${workspaceFolder}/.env",
|
"python.envFile": "${workspaceFolder}/.env",
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ from dataclasses import dataclass
|
|||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from nerfactory.cameras.cameras import Camera, get_camera, get_intrinsics_from_intrinsics_matrix
|
|
||||||
from nerfactory.cameras.utils import get_interpolated_poses_many
|
|
||||||
|
|
||||||
import nerfactory.cameras.utils as camera_utils
|
import nerfactory.cameras.utils as camera_utils
|
||||||
|
from nerfactory.cameras.cameras import (
|
||||||
|
Camera,
|
||||||
|
get_camera,
|
||||||
|
get_intrinsics_from_intrinsics_matrix,
|
||||||
|
)
|
||||||
|
from nerfactory.cameras.utils import get_interpolated_poses_many
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ Original file at https://github.com/colmap/colmap/blob/1a4d0bad2e90aa65ce997c9d1
|
|||||||
#
|
#
|
||||||
# Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)
|
# Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)
|
||||||
|
|
||||||
import os
|
|
||||||
import collections
|
|
||||||
import numpy as np
|
|
||||||
import struct
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import collections
|
||||||
|
import os
|
||||||
|
import struct
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
CameraModel = collections.namedtuple("CameraModel", ["model_id", "model_name", "num_params"])
|
CameraModel = collections.namedtuple("CameraModel", ["model_id", "model_name", "num_params"])
|
||||||
Camera = collections.namedtuple("Camera", ["id", "model", "width", "height", "params"])
|
Camera = collections.namedtuple("Camera", ["id", "model", "width", "height", "params"])
|
||||||
|
|||||||
@@ -19,24 +19,27 @@ Data loader.
|
|||||||
import random
|
import random
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from typing import Dict, List, Optional, Tuple, Union
|
from typing import Dict, List, Optional, Tuple, Union
|
||||||
from omegaconf import ListConfig
|
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
from omegaconf import ListConfig
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
|
|
||||||
from nerfactory.cameras.cameras import Camera, get_camera
|
from nerfactory.cameras.cameras import Camera, get_camera
|
||||||
from nerfactory.cameras.rays import RayBundle
|
from nerfactory.cameras.rays import RayBundle
|
||||||
from nerfactory.data.image_dataset import ImageDataset
|
from nerfactory.data.image_dataset import ImageDataset
|
||||||
from nerfactory.data.image_sampler import ImageSampler
|
from nerfactory.data.image_sampler import ImageSampler
|
||||||
from nerfactory.data.pixel_sampler import PixelSampler
|
from nerfactory.data.pixel_sampler import PixelSampler
|
||||||
from nerfactory.data.structs import DatasetInputs, BaseDataContainer
|
from nerfactory.data.structs import BaseDataContainer, DatasetInputs
|
||||||
from nerfactory.data.utils import get_dataset_inputs_from_dataset_config
|
from nerfactory.data.utils import get_dataset_inputs_from_dataset_config
|
||||||
from nerfactory.graphs.modules.ray_generator import RayGenerator
|
from nerfactory.graphs.modules.ray_generator import RayGenerator
|
||||||
from nerfactory.utils import profiler
|
from nerfactory.utils import profiler
|
||||||
from nerfactory.utils.config import DataConfig
|
from nerfactory.utils.config import DataConfig
|
||||||
from nerfactory.utils.misc import IterableWrapper, get_dict_to_torch, instantiate_from_dict_config
|
from nerfactory.utils.misc import (
|
||||||
|
IterableWrapper,
|
||||||
|
get_dict_to_torch,
|
||||||
|
instantiate_from_dict_config,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@profiler.time_function
|
@profiler.time_function
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ import os
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from nerfactory.data.colmap_utils import read_cameras_binary, read_images_binary, read_pointsTD_binary
|
from nerfactory.data.colmap_utils import (
|
||||||
|
read_cameras_binary,
|
||||||
|
read_images_binary,
|
||||||
|
read_pointsTD_binary,
|
||||||
|
)
|
||||||
from nerfactory.data.structs import DatasetInputs, PointCloud, SceneBounds, Semantics
|
from nerfactory.data.structs import DatasetInputs, PointCloud, SceneBounds, Semantics
|
||||||
from nerfactory.utils import profiler
|
from nerfactory.utils import profiler
|
||||||
from nerfactory.utils.io import load_from_json
|
from nerfactory.utils.io import load_from_json
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ from PIL import Image
|
|||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
from nerfactory.data.structs import Semantics
|
from nerfactory.data.structs import Semantics
|
||||||
|
|
||||||
from nerfactory.utils.misc import is_not_none
|
from nerfactory.utils.misc import is_not_none
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
Code for sampling images from a dataset of images.
|
Code for sampling images from a dataset of images.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from abc import abstractmethod
|
|
||||||
import random
|
import random
|
||||||
|
from abc import abstractmethod
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ from torch.nn.parallel import DistributedDataParallel as DDP
|
|||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
from nerfactory.cameras.rays import RayBundle
|
from nerfactory.cameras.rays import RayBundle
|
||||||
from nerfactory.data.dataloader import EvalDataloader, setup_dataset_eval, setup_dataset_train
|
from nerfactory.data.dataloader import (
|
||||||
|
EvalDataloader,
|
||||||
|
setup_dataset_eval,
|
||||||
|
setup_dataset_train,
|
||||||
|
)
|
||||||
from nerfactory.graphs.base import setup_graph
|
from nerfactory.graphs.base import setup_graph
|
||||||
from nerfactory.optimizers.optimizers import setup_optimizers
|
from nerfactory.optimizers.optimizers import setup_optimizers
|
||||||
from nerfactory.utils import profiler, writer
|
from nerfactory.utils import profiler, writer
|
||||||
|
|||||||
@@ -13,6 +13,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
"""init field modules"""
|
"""init field modules"""
|
||||||
|
from .base import FieldModule
|
||||||
from .encoding import Encoding, ScalingAndOffset
|
from .encoding import Encoding, ScalingAndOffset
|
||||||
from .mlp import MLP
|
from .mlp import MLP
|
||||||
from .base import FieldModule
|
|
||||||
@@ -19,6 +19,7 @@ Code for embeddings.
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
from nerfactory.fields.modules.base import FieldModule
|
from nerfactory.fields.modules.base import FieldModule
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"""
|
"""
|
||||||
Multi Layer Perceptron
|
Multi Layer Perceptron
|
||||||
"""
|
"""
|
||||||
from typing import Tuple, Optional
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
|
|||||||
@@ -21,11 +21,16 @@ import torch
|
|||||||
from torch import nn
|
from torch import nn
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
from nerfactory.fields.modules.encoding import Encoding, Identity
|
|
||||||
from nerfactory.fields.modules.field_heads import DensityFieldHead, FieldHead, FieldHeadNames, RGBFieldHead
|
|
||||||
from nerfactory.fields.modules.mlp import MLP
|
|
||||||
from nerfactory.fields.base import Field
|
|
||||||
from nerfactory.cameras.rays import RaySamples
|
from nerfactory.cameras.rays import RaySamples
|
||||||
|
from nerfactory.fields.base import Field
|
||||||
|
from nerfactory.fields.modules.encoding import Encoding, Identity
|
||||||
|
from nerfactory.fields.modules.field_heads import (
|
||||||
|
DensityFieldHead,
|
||||||
|
FieldHead,
|
||||||
|
FieldHeadNames,
|
||||||
|
RGBFieldHead,
|
||||||
|
)
|
||||||
|
from nerfactory.fields.modules.mlp import MLP
|
||||||
from nerfactory.fields.modules.spatial_distortions import SpatialDistortion
|
from nerfactory.fields.modules.spatial_distortions import SpatialDistortion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import torch
|
|||||||
from torch import nn
|
from torch import nn
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
|
from nerfactory.cameras.rays import RaySamples
|
||||||
|
from nerfactory.fields.base import Field
|
||||||
from nerfactory.fields.modules.embedding import Embedding
|
from nerfactory.fields.modules.embedding import Embedding
|
||||||
from nerfactory.fields.modules.encoding import Encoding, Identity
|
from nerfactory.fields.modules.encoding import Encoding, Identity
|
||||||
from nerfactory.fields.modules.field_heads import (
|
from nerfactory.fields.modules.field_heads import (
|
||||||
@@ -31,8 +33,6 @@ from nerfactory.fields.modules.field_heads import (
|
|||||||
UncertaintyFieldHead,
|
UncertaintyFieldHead,
|
||||||
)
|
)
|
||||||
from nerfactory.fields.modules.mlp import MLP
|
from nerfactory.fields.modules.mlp import MLP
|
||||||
from nerfactory.fields.base import Field
|
|
||||||
from nerfactory.cameras.rays import RaySamples
|
|
||||||
|
|
||||||
|
|
||||||
class VanillaNerfWField(Field):
|
class VanillaNerfWField(Field):
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ from nerfactory.data.structs import DatasetInputs, SceneBounds
|
|||||||
from nerfactory.graphs.modules.ray_generator import RayGenerator
|
from nerfactory.graphs.modules.ray_generator import RayGenerator
|
||||||
from nerfactory.utils import profiler
|
from nerfactory.utils import profiler
|
||||||
from nerfactory.utils.config import GraphConfig
|
from nerfactory.utils.config import GraphConfig
|
||||||
from nerfactory.utils.misc import get_masked_dict, instantiate_from_dict_config, is_not_none
|
from nerfactory.utils.misc import (
|
||||||
|
get_masked_dict,
|
||||||
|
instantiate_from_dict_config,
|
||||||
|
is_not_none,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@profiler.time_function
|
@profiler.time_function
|
||||||
|
|||||||
@@ -22,19 +22,22 @@ from typing import Dict, List
|
|||||||
import torch
|
import torch
|
||||||
from torch.nn import Parameter
|
from torch.nn import Parameter
|
||||||
from torchmetrics import PeakSignalNoiseRatio
|
from torchmetrics import PeakSignalNoiseRatio
|
||||||
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
|
||||||
from torchmetrics.functional import structural_similarity_index_measure
|
from torchmetrics.functional import structural_similarity_index_measure
|
||||||
|
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
||||||
|
|
||||||
|
from nerfactory.cameras.rays import RayBundle
|
||||||
from nerfactory.fields.modules.encoding import NeRFEncoding
|
from nerfactory.fields.modules.encoding import NeRFEncoding
|
||||||
from nerfactory.fields.modules.field_heads import FieldHeadNames
|
from nerfactory.fields.modules.field_heads import FieldHeadNames
|
||||||
from nerfactory.fields.nerf_field import NeRFField
|
from nerfactory.fields.nerf_field import NeRFField
|
||||||
from nerfactory.graphs.base import Graph
|
from nerfactory.graphs.base import Graph
|
||||||
from nerfactory.optimizers.loss import MSELoss
|
|
||||||
from nerfactory.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
from nerfactory.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
||||||
from nerfactory.renderers.renderers import AccumulationRenderer, DepthRenderer, RGBRenderer
|
from nerfactory.optimizers.loss import MSELoss
|
||||||
from nerfactory.utils import colors
|
from nerfactory.renderers.renderers import (
|
||||||
from nerfactory.cameras.rays import RayBundle
|
AccumulationRenderer,
|
||||||
from nerfactory.utils import visualization, writer
|
DepthRenderer,
|
||||||
|
RGBRenderer,
|
||||||
|
)
|
||||||
|
from nerfactory.utils import colors, visualization, writer
|
||||||
|
|
||||||
|
|
||||||
class MipNerfGraph(Graph):
|
class MipNerfGraph(Graph):
|
||||||
|
|||||||
@@ -22,21 +22,24 @@ from typing import Dict, List
|
|||||||
import torch
|
import torch
|
||||||
from torch.nn import Parameter
|
from torch.nn import Parameter
|
||||||
from torchmetrics import PeakSignalNoiseRatio
|
from torchmetrics import PeakSignalNoiseRatio
|
||||||
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
|
||||||
from torchmetrics.functional import structural_similarity_index_measure
|
from torchmetrics.functional import structural_similarity_index_measure
|
||||||
|
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
||||||
|
|
||||||
|
from nerfactory.cameras.rays import RayBundle
|
||||||
from nerfactory.fields.modules.encoding import NeRFEncoding
|
from nerfactory.fields.modules.encoding import NeRFEncoding
|
||||||
from nerfactory.fields.modules.field_heads import FieldHeadNames
|
from nerfactory.fields.modules.field_heads import FieldHeadNames
|
||||||
from nerfactory.fields.modules.spatial_distortions import SceneContraction
|
from nerfactory.fields.modules.spatial_distortions import SceneContraction
|
||||||
from nerfactory.fields.nerf_field import NeRFField
|
from nerfactory.fields.nerf_field import NeRFField
|
||||||
from nerfactory.graphs.base import Graph
|
from nerfactory.graphs.base import Graph
|
||||||
from nerfactory.graphs.modules.ray_losses import distortion_loss
|
from nerfactory.graphs.modules.ray_losses import distortion_loss
|
||||||
from nerfactory.optimizers.loss import MSELoss
|
|
||||||
from nerfactory.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
from nerfactory.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
||||||
from nerfactory.renderers.renderers import AccumulationRenderer, DepthRenderer, RGBRenderer
|
from nerfactory.optimizers.loss import MSELoss
|
||||||
from nerfactory.utils import colors
|
from nerfactory.renderers.renderers import (
|
||||||
from nerfactory.cameras.rays import RayBundle
|
AccumulationRenderer,
|
||||||
from nerfactory.utils import visualization, writer
|
DepthRenderer,
|
||||||
|
RGBRenderer,
|
||||||
|
)
|
||||||
|
from nerfactory.utils import colors, visualization, writer
|
||||||
|
|
||||||
|
|
||||||
class MipNerf360Graph(Graph):
|
class MipNerf360Graph(Graph):
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ Ray generator.
|
|||||||
"""
|
"""
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
from nerfactory.cameras.rays import RayBundle
|
|
||||||
from nerfactory.cameras.cameras import get_camera_model
|
from nerfactory.cameras.cameras import get_camera_model
|
||||||
|
from nerfactory.cameras.rays import RayBundle
|
||||||
|
|
||||||
|
|
||||||
class RayGenerator(nn.Module):
|
class RayGenerator(nn.Module):
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ Ray generator.
|
|||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
from nerfactory.data.structs import SceneBounds
|
|
||||||
from nerfactory.cameras.rays import RayBundle
|
from nerfactory.cameras.rays import RayBundle
|
||||||
|
from nerfactory.data.structs import SceneBounds
|
||||||
|
|
||||||
|
|
||||||
class SceneBoundsCollider(nn.Module):
|
class SceneBoundsCollider(nn.Module):
|
||||||
|
|||||||
@@ -18,20 +18,24 @@ NeRF-W (NeRF in the wild) implementation.
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torchmetrics import PeakSignalNoiseRatio
|
from torchmetrics import PeakSignalNoiseRatio
|
||||||
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
|
||||||
from torchmetrics.functional import structural_similarity_index_measure
|
from torchmetrics.functional import structural_similarity_index_measure
|
||||||
|
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
||||||
|
|
||||||
|
from nerfactory.cameras.rays import RayBundle
|
||||||
from nerfactory.fields.modules.encoding import NeRFEncoding
|
from nerfactory.fields.modules.encoding import NeRFEncoding
|
||||||
from nerfactory.fields.modules.field_heads import FieldHeadNames
|
from nerfactory.fields.modules.field_heads import FieldHeadNames
|
||||||
from nerfactory.fields.nerf_field import NeRFField
|
from nerfactory.fields.nerf_field import NeRFField
|
||||||
from nerfactory.fields.nerfw_field import VanillaNerfWField
|
from nerfactory.fields.nerfw_field import VanillaNerfWField
|
||||||
from nerfactory.graphs.base import Graph
|
from nerfactory.graphs.base import Graph
|
||||||
from nerfactory.optimizers.loss import MSELoss
|
|
||||||
from nerfactory.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
from nerfactory.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
||||||
from nerfactory.renderers.renderers import AccumulationRenderer, DepthRenderer, RGBRenderer, UncertaintyRenderer
|
from nerfactory.optimizers.loss import MSELoss
|
||||||
from nerfactory.utils import colors
|
from nerfactory.renderers.renderers import (
|
||||||
from nerfactory.cameras.rays import RayBundle
|
AccumulationRenderer,
|
||||||
from nerfactory.utils import visualization, writer
|
DepthRenderer,
|
||||||
|
RGBRenderer,
|
||||||
|
UncertaintyRenderer,
|
||||||
|
)
|
||||||
|
from nerfactory.utils import colors, visualization, writer
|
||||||
|
|
||||||
|
|
||||||
class NerfWGraph(Graph):
|
class NerfWGraph(Graph):
|
||||||
|
|||||||
@@ -21,16 +21,21 @@ from typing import Dict, Optional, Tuple
|
|||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
from nerfactory.data.structs import Semantics
|
|
||||||
|
|
||||||
from nerfactory.fields.modules.encoding import Encoding, Identity, NeRFEncoding
|
from nerfactory.cameras.rays import RayBundle, RaySamples
|
||||||
from nerfactory.fields.modules.field_heads import DensityFieldHead, FieldHeadNames, RGBFieldHead, SemanticFieldHead
|
from nerfactory.data.structs import Semantics
|
||||||
from nerfactory.fields.modules.mlp import MLP
|
|
||||||
from nerfactory.fields.base import Field
|
from nerfactory.fields.base import Field
|
||||||
|
from nerfactory.fields.modules.encoding import Encoding, Identity, NeRFEncoding
|
||||||
|
from nerfactory.fields.modules.field_heads import (
|
||||||
|
DensityFieldHead,
|
||||||
|
FieldHeadNames,
|
||||||
|
RGBFieldHead,
|
||||||
|
SemanticFieldHead,
|
||||||
|
)
|
||||||
|
from nerfactory.fields.modules.mlp import MLP
|
||||||
from nerfactory.fields.nerf_field import NeRFField
|
from nerfactory.fields.nerf_field import NeRFField
|
||||||
from nerfactory.graphs.vanilla_nerf import NeRFGraph
|
from nerfactory.graphs.vanilla_nerf import NeRFGraph
|
||||||
from nerfactory.renderers.renderers import SemanticRenderer
|
from nerfactory.renderers.renderers import SemanticRenderer
|
||||||
from nerfactory.cameras.rays import RaySamples, RayBundle
|
|
||||||
from nerfactory.utils import writer
|
from nerfactory.utils import writer
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,19 +22,22 @@ from typing import Dict, List
|
|||||||
import torch
|
import torch
|
||||||
from torch.nn import Parameter
|
from torch.nn import Parameter
|
||||||
from torchmetrics import PeakSignalNoiseRatio
|
from torchmetrics import PeakSignalNoiseRatio
|
||||||
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
|
||||||
from torchmetrics.functional import structural_similarity_index_measure
|
from torchmetrics.functional import structural_similarity_index_measure
|
||||||
|
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
||||||
|
|
||||||
|
from nerfactory.cameras.rays import RayBundle
|
||||||
from nerfactory.fields.modules.encoding import NeRFEncoding
|
from nerfactory.fields.modules.encoding import NeRFEncoding
|
||||||
from nerfactory.fields.modules.field_heads import FieldHeadNames
|
from nerfactory.fields.modules.field_heads import FieldHeadNames
|
||||||
from nerfactory.fields.nerf_field import NeRFField
|
from nerfactory.fields.nerf_field import NeRFField
|
||||||
from nerfactory.graphs.base import Graph
|
from nerfactory.graphs.base import Graph
|
||||||
from nerfactory.optimizers.loss import MSELoss
|
|
||||||
from nerfactory.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
from nerfactory.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
||||||
from nerfactory.renderers.renderers import AccumulationRenderer, DepthRenderer, RGBRenderer
|
from nerfactory.optimizers.loss import MSELoss
|
||||||
from nerfactory.utils import colors
|
from nerfactory.renderers.renderers import (
|
||||||
from nerfactory.cameras.rays import RayBundle
|
AccumulationRenderer,
|
||||||
from nerfactory.utils import visualization, writer
|
DepthRenderer,
|
||||||
|
RGBRenderer,
|
||||||
|
)
|
||||||
|
from nerfactory.utils import colors, visualization, writer
|
||||||
|
|
||||||
|
|
||||||
class NeRFGraph(Graph):
|
class NeRFGraph(Graph):
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ from typing import Optional
|
|||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
from nerfactory.cameras.rays import RaySamples
|
|
||||||
|
|
||||||
|
from nerfactory.cameras.rays import RaySamples
|
||||||
from nerfactory.utils.math import components_from_spherical_harmonics
|
from nerfactory.utils.math import components_from_spherical_harmonics
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,9 @@
|
|||||||
|
|
||||||
"""Common Colors"""
|
"""Common Colors"""
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from omegaconf import ListConfig
|
|
||||||
import torch
|
import torch
|
||||||
|
from omegaconf import ListConfig
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
WHITE = torch.tensor([1.0, 1.0, 1.0])
|
WHITE = torch.tensor([1.0, 1.0, 1.0])
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
from omegaconf import DictConfig, MISSING
|
|
||||||
|
from omegaconf import MISSING, DictConfig
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
from typing import Any, Tuple, Optional
|
from typing import Any, Optional, Tuple
|
||||||
|
|
||||||
|
|
||||||
def load_from_json(filename: str):
|
def load_from_json(filename: str):
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ Miscellaneous helper code.
|
|||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
from math import floor, log
|
||||||
from pydoc import locate
|
from pydoc import locate
|
||||||
from typing import Any, Callable, Dict
|
from typing import Any, Callable, Dict
|
||||||
|
|
||||||
from math import floor, log
|
|
||||||
import torch
|
import torch
|
||||||
from omegaconf import DictConfig
|
from omegaconf import DictConfig
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ from typing import Callable
|
|||||||
|
|
||||||
from nerfactory.utils import comms
|
from nerfactory.utils import comms
|
||||||
from nerfactory.utils.config import LoggingConfig
|
from nerfactory.utils.config import LoggingConfig
|
||||||
from nerfactory.utils.decorators import check_main_thread, check_profiler_enabled, decorate_all
|
from nerfactory.utils.decorators import (
|
||||||
|
check_main_thread,
|
||||||
|
check_profiler_enabled,
|
||||||
|
decorate_all,
|
||||||
|
)
|
||||||
|
|
||||||
PROFILER = []
|
PROFILER = []
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ from typing import Dict
|
|||||||
import imageio
|
import imageio
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
import wandb
|
||||||
from omegaconf import ListConfig
|
from omegaconf import ListConfig
|
||||||
from torch.utils.tensorboard import SummaryWriter
|
from torch.utils.tensorboard import SummaryWriter
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
import wandb
|
|
||||||
from nerfactory.utils.config import LoggingConfig
|
from nerfactory.utils.config import LoggingConfig
|
||||||
from nerfactory.utils.decorators import check_main_thread, decorate_all
|
from nerfactory.utils.decorators import check_main_thread, decorate_all
|
||||||
from nerfactory.utils.misc import human_format
|
from nerfactory.utils.misc import human_format
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"""Logic to render Camera objects in the Viewer"""
|
"""Logic to render Camera objects in the Viewer"""
|
||||||
|
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ from dataclasses import dataclass
|
|||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from nerfactory.viewer.server.geometry import (
|
from nerfactory.viewer.server.geometry import (
|
||||||
Mesh,
|
Mesh,
|
||||||
MeshPhongMaterial,
|
MeshPhongMaterial,
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ from __future__ import absolute_import, division, print_function
|
|||||||
import sys
|
import sys
|
||||||
from typing import Callable, List, Optional
|
from typing import Callable, List, Optional
|
||||||
|
|
||||||
|
import msgpack
|
||||||
|
import msgpack_numpy
|
||||||
import tornado.gen
|
import tornado.gen
|
||||||
import tornado.ioloop
|
import tornado.ioloop
|
||||||
import tornado.web
|
import tornado.web
|
||||||
import tornado.websocket
|
import tornado.websocket
|
||||||
import msgpack
|
|
||||||
import msgpack_numpy
|
|
||||||
import umsgpack
|
import umsgpack
|
||||||
import zmq
|
import zmq
|
||||||
import zmq.eventloop.ioloop
|
import zmq.eventloop.ioloop
|
||||||
|
|||||||
@@ -16,10 +16,15 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from nerfactory.cameras.cameras import Camera, get_camera, get_intrinsics_from_intrinsics_matrix
|
from nerfactory.cameras.cameras import (
|
||||||
|
Camera,
|
||||||
|
get_camera,
|
||||||
|
get_intrinsics_from_intrinsics_matrix,
|
||||||
|
)
|
||||||
from nerfactory.viewer.server.visualizer import Viewer
|
from nerfactory.viewer.server.visualizer import Viewer
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,17 +25,21 @@ from typing import Any, Dict, List, Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
from nerfactory.utils.decorators import check_visualizer_enabled, decorate_all
|
|
||||||
|
|
||||||
import nerfactory.viewer.server.cameras as c
|
import nerfactory.viewer.server.cameras as c
|
||||||
import nerfactory.viewer.server.geometry as g
|
import nerfactory.viewer.server.geometry as g
|
||||||
from nerfactory.cameras.cameras import Camera, get_camera, get_intrinsics_from_intrinsics_matrix
|
from nerfactory.cameras.cameras import (
|
||||||
|
Camera,
|
||||||
|
get_camera,
|
||||||
|
get_intrinsics_from_intrinsics_matrix,
|
||||||
|
)
|
||||||
from nerfactory.cameras.rays import RayBundle
|
from nerfactory.cameras.rays import RayBundle
|
||||||
from nerfactory.data.image_dataset import ImageDataset
|
from nerfactory.data.image_dataset import ImageDataset
|
||||||
from nerfactory.data.structs import DatasetInputs
|
from nerfactory.data.structs import DatasetInputs
|
||||||
from nerfactory.graphs.base import Graph
|
from nerfactory.graphs.base import Graph
|
||||||
from nerfactory.utils import profiler
|
from nerfactory.utils import profiler
|
||||||
from nerfactory.utils.config import ViewerConfig
|
from nerfactory.utils.config import ViewerConfig
|
||||||
|
from nerfactory.utils.decorators import check_visualizer_enabled, decorate_all
|
||||||
from nerfactory.viewer.server.transformations import get_translation_matrix
|
from nerfactory.viewer.server.transformations import get_translation_matrix
|
||||||
from nerfactory.viewer.server.utils import get_intrinsics_matrix_and_camera_to_world_h
|
from nerfactory.viewer.server.utils import get_intrinsics_matrix_and_camera_to_world_h
|
||||||
from nerfactory.viewer.server.visualizer import Viewer
|
from nerfactory.viewer.server.visualizer import Viewer
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
import imageio
|
import imageio
|
||||||
import mediapy as media
|
import mediapy as media
|
||||||
|
|
||||||
# ipython stuff
|
|
||||||
from IPython import get_ipython
|
|
||||||
|
|
||||||
# plotly stuff
|
# plotly stuff
|
||||||
import plotly.graph_objects as go
|
import plotly.graph_objects as go
|
||||||
|
|
||||||
|
# ipython stuff
|
||||||
|
from IPython import get_ipython
|
||||||
|
|
||||||
|
|
||||||
def setup_ipynb():
|
def setup_ipynb():
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -7,15 +7,14 @@ import logging
|
|||||||
import os
|
import os
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
from hydra import compose, initialize
|
from hydra import compose, initialize
|
||||||
from hydra.core.global_hydra import GlobalHydra
|
from hydra.core.global_hydra import GlobalHydra
|
||||||
import numpy as np
|
|
||||||
from omegaconf import DictConfig
|
from omegaconf import DictConfig
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from scripts.run_eval import run_inference_from_config
|
from scripts.run_eval import run_inference_from_config
|
||||||
|
|
||||||
|
|
||||||
OBJECT_LIST = ["mic", "ficus", "chair", "hotdog", "materials", "drums", "ship", "lego"]
|
OBJECT_LIST = ["mic", "ficus", "chair", "hotdog", "materials", "drums", "ship", "lego"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import sys
|
|||||||
import dcargs
|
import dcargs
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
LOCAL_TESTS = ["Run license checks", "Run Black", "Python Pylint", "Test with pytest"]
|
LOCAL_TESTS = ["Run license checks", "Run isort", "Run Black", "Python Pylint", "Test with pytest"]
|
||||||
|
|
||||||
|
|
||||||
def run_command(command: str, continue_on_fail: bool = False) -> None:
|
def run_command(command: str, continue_on_fail: bool = False) -> None:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Script to process different dataset types into our format.
|
|||||||
# TODO(ethan): we should write a script here to convert from other datasets to our formats
|
# TODO(ethan): we should write a script here to convert from other datasets to our formats
|
||||||
# e.g., Blender, LLFF, ShapeNet, DTU
|
# e.g., Blender, LLFF, ShapeNet, DTU
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from hydra import compose, initialize
|
from hydra import compose, initialize
|
||||||
|
|
||||||
from nerfactory.data.utils import get_dataset_inputs
|
from nerfactory.data.utils import get_dataset_inputs
|
||||||
|
|||||||
+10
-2
@@ -12,8 +12,16 @@ from hydra import compose, initialize
|
|||||||
from omegaconf import DictConfig
|
from omegaconf import DictConfig
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from nerfactory.cameras.camera_paths import CameraPath, get_interpolated_camera_path, get_spiral_path
|
from nerfactory.cameras.camera_paths import (
|
||||||
from nerfactory.data.dataloader import EvalDataloader, setup_dataset_eval, setup_dataset_train
|
CameraPath,
|
||||||
|
get_interpolated_camera_path,
|
||||||
|
get_spiral_path,
|
||||||
|
)
|
||||||
|
from nerfactory.data.dataloader import (
|
||||||
|
EvalDataloader,
|
||||||
|
setup_dataset_eval,
|
||||||
|
setup_dataset_train,
|
||||||
|
)
|
||||||
from nerfactory.graphs.base import Graph, setup_graph
|
from nerfactory.graphs.base import Graph, setup_graph
|
||||||
from nerfactory.utils.misc import human_format
|
from nerfactory.utils.misc import human_format
|
||||||
from nerfactory.utils.writer import TimeWriter
|
from nerfactory.utils.writer import TimeWriter
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""View Bridge Server"""
|
"""View Bridge Server"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from nerfactory.viewer.server.server import ZMQWebSocketBridge
|
from nerfactory.viewer.server.server import ZMQWebSocketBridge
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Test the ray classes.
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from nerfactory.cameras.rays import Frustums
|
from nerfactory.cameras.rays import Frustums
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Encoding Tests
|
|||||||
"""
|
"""
|
||||||
import pytest
|
import pytest
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from nerfactory.fields.modules import encoding
|
from nerfactory.fields.modules import encoding
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
"""
|
"""
|
||||||
Field output tests
|
Field output tests
|
||||||
"""
|
"""
|
||||||
|
import pytest
|
||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
import pytest
|
|
||||||
|
|
||||||
from nerfactory.fields.modules.field_heads import (
|
from nerfactory.fields.modules.field_heads import (
|
||||||
DensityFieldHead,
|
DensityFieldHead,
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ Test the fields
|
|||||||
"""
|
"""
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from nerfactory.fields.instant_ngp_field import TCNNInstantNGPField
|
|
||||||
from nerfactory.cameras.rays import Frustums, RaySamples
|
from nerfactory.cameras.rays import Frustums, RaySamples
|
||||||
|
from nerfactory.fields.instant_ngp_field import TCNNInstantNGPField
|
||||||
|
|
||||||
|
|
||||||
def test_tcnn_instant_ngp_field():
|
def test_tcnn_instant_ngp_field():
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
Test samplers
|
Test samplers
|
||||||
"""
|
"""
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
from nerfactory.cameras.rays import RayBundle
|
||||||
from nerfactory.graphs.modules.ray_sampler import (
|
from nerfactory.graphs.modules.ray_sampler import (
|
||||||
LinearDisparitySampler,
|
LinearDisparitySampler,
|
||||||
LogSampler,
|
LogSampler,
|
||||||
@@ -9,8 +11,6 @@ from nerfactory.graphs.modules.ray_sampler import (
|
|||||||
SqrtSampler,
|
SqrtSampler,
|
||||||
UniformSampler,
|
UniformSampler,
|
||||||
)
|
)
|
||||||
|
|
||||||
from nerfactory.cameras.rays import RayBundle
|
|
||||||
from nerfactory.graphs.modules.scene_colliders import NearFarCollider
|
from nerfactory.graphs.modules.scene_colliders import NearFarCollider
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,11 @@ from nerfactory.cameras.camera_paths import InterpolatedCameraPath
|
|||||||
from nerfactory.cameras.cameras import get_camera
|
from nerfactory.cameras.cameras import get_camera
|
||||||
from nerfactory.data.utils import get_dataset_inputs
|
from nerfactory.data.utils import get_dataset_inputs
|
||||||
from nerfactory.utils.io import get_absolute_path
|
from nerfactory.utils.io import get_absolute_path
|
||||||
|
from nerfactory.viewer.server.transformations import (
|
||||||
|
get_rotation_matrix,
|
||||||
|
get_translation_matrix,
|
||||||
|
)
|
||||||
from nerfactory.viewer.server.viewer_utils import get_default_vis, set_camera
|
from nerfactory.viewer.server.viewer_utils import get_default_vis, set_camera
|
||||||
from nerfactory.viewer.server.transformations import get_rotation_matrix, get_translation_matrix
|
|
||||||
|
|
||||||
|
|
||||||
def test_drawing():
|
def test_drawing():
|
||||||
|
|||||||
Reference in new issue
Block a user