update docstrings and random cleanups (#387)

* fixing docstrings and small nits; up to fileds

* finished adding and fixing docstrings
This commit is contained in:
evonneng authored and GitHub committed 2022-09-10 23:09:44 -07:00
1 parent bd5967461d
commit d50c71ac43
52 files changed
+846 -646

No files matched your search

+10 -6
View File
@@ -25,7 +25,11 @@ from nerfactory.datamanagers.structs import DatasetInputs
@dataclass
class DataParser:
"""A dataset."""
"""A dataset.
Args:
config: datasetparser config containing all information needed to instantiate dataset
"""
def __init__(self, config: cfg.DataParserConfig):
super().__init__()
@@ -33,23 +37,23 @@ class DataParser:
@abstractmethod
def _generate_dataset_inputs(self, split: str = "train") -> DatasetInputs:
"""Returns the dataset inputs for the given split.
"""Abstract method that returns the dataset inputs for the given split.
Args:
split: Which dataset split to generate.
split: Which dataset split to generate (train/test).
Returns:
DatasetInputs
DatasetInputs containing data for the specified dataset and split
"""
def get_dataset_inputs(self, split: str = "train") -> DatasetInputs:
"""Returns the dataset inputs for the given split.
Args:
split: Which dataset split to generate.
split: Which dataset split to generate (train/test).
Returns:
DatasetInputs
DatasetInputs containing data for the specified dataset and split
"""
dataset_inputs = self._generate_dataset_inputs(split)
return dataset_inputs
@@ -34,11 +34,6 @@ from nerfactory.utils.io import get_absolute_path, load_from_json
class Blender(DataParser):
"""Blender Dataset
Some of this code comes from https://github.com/yenchenlin/nerf-pytorch/blob/master/load_blender.py#L37.
Args:
data_directory: Location of data
alpha_color: Sets transparent regions to specified color, otherwise black.
scale_factor: How much to scale the camera origins by.
"""
def __init__(self, config: cfg.BlenderDataParserConfig):
@@ -33,7 +33,12 @@ CONSOLE = Console()
def get_semantics_and_masks(image_idx: int, semantics: Semantics):
"""function to process additional semantics and mask information"""
"""function to process additional semantics and mask information
Args:
image_idx: specific image index to work with
semantics: semantics data
"""
# handle mask
person_index = semantics.thing_classes.index("person")
thing_image_filename = semantics.thing_filenames[image_idx]
@@ -55,7 +60,11 @@ class Friends(DataParser):
@classmethod
def _get_aabb_and_transform(cls, basedir):
"""Returns the aabb and pointcloud transform from the threejs.json file."""
"""Returns the aabb and pointcloud transform from the threejs.json file.
Args:
basedir: base directory to load from
"""
filename = basedir / "threejs.json"
assert filename.exists()
data = load_from_json(filename)
@@ -33,13 +33,7 @@ from nerfactory.utils.io import get_absolute_path, load_from_json
@dataclass
class InstantNGP(DataParser):
"""Instant NGP Dataset
Args:
data_directory: Location of data
scale_factor: How much to scale the camera origins by.
scene_scale: How much to scale the scene. Defaults to 0.33
"""
"""Instant NGP Dataset"""
config: cfg.InstantNGPDataParserConfig
@@ -30,15 +30,7 @@ from nerfactory.utils.io import get_absolute_path
@dataclass
class Mipnerf360(DataParser):
"""MipNeRF 360 Dataset
Args:
data_directory: Location of data
downscale_factor: How much to downscale images. Defaults to 1.
val_skip: 1/val_skip images to use for validation. Defaults to 8.
auto_scale: Scale based on pose bounds. Defaults to True.
aabb_scale: Scene scale, Defaults to 1.0.
"""
"""MipNeRF 360 Dataset"""
config: cfg.MipNerf360DataParserConfig
@@ -31,15 +31,7 @@ from nerfactory.utils.io import get_absolute_path, load_from_json
@dataclass
class Nerfactory(DataParser):
"""Nerfactory Dataset
Args:
data_directory: Location of data
scale_factor: How much to scale the camera origins by.
downscale_factor: How much to downscale images.
scene_scale: How much to scale the scene.
orientation_method: The method to use for orientation. Either "pca" or "up".
"""
"""Nerfactory Dataset"""
config: cfg.NerfactoryDataParserConfig
@@ -31,15 +31,7 @@ from nerfactory.utils.io import get_absolute_path, load_from_json
@dataclass
class Record3D(DataParser):
"""Record3D Dataset
Args:
data_directory: Location of data
val_skip: 1/val_skip images to use for validation. Defaults to 8.
aabb_scale: Scene scale, Defaults to 4.0.
max_dataset_size: Max number of images to train on. If the dataset has
more, images will be sampled approximately evenly. Defaults to 150.
"""
"""Record3D Dataset"""
config: cfg.Record3DDataParserConfig