[WIP] dataloading cleanup (#332)

* testing; need to merge

* fixing wrong base file in models/base

* pushed input parser into datasets class to abstract away fetching data in dataloader

* slight name chage and all

* nits

* added dataparser

* added licnese
This commit is contained in:
evonneng authored and GitHub committed 2022-09-06 13:54:35 -07:00
1 parent e907bc5c71
commit 56113e6c75
29 files changed
+1048 -960

No files matched your search

+7 -9
View File
@@ -28,8 +28,7 @@ import torch
from nerfactory.cameras.cameras import Cameras
from nerfactory.cameras.rays import RayBundle
from nerfactory.configs import base as cfg
from nerfactory.dataloaders.image_dataset import ImageDataset
from nerfactory.dataloaders.structs import DatasetInputs
from nerfactory.datamanagers.datasets import InputDataset
from nerfactory.models.base import Model
from nerfactory.utils import profiler, visualization
from nerfactory.utils.decorators import check_visualizer_enabled, decorate_all
@@ -230,12 +229,11 @@ class VisualizerState:
self.outputs_set = False
def init_scene(self, image_dataset: ImageDataset, dataset_inputs: DatasetInputs) -> None:
def init_scene(self, dataset: InputDataset) -> None:
"""Draw some images and the scene aabb in the viewer.
Args:
image_dataset: dataset to render in the scene
dataset_inputs: inputs to the image dataset and ray generator
dataset: dataset to render in the scene
"""
# clear the current scene
@@ -243,15 +241,15 @@ class VisualizerState:
self.vis["sceneState/cameras"].delete()
# draw the training cameras and images
image_indices = range(len(image_dataset))
image_indices = range(len(dataset))
for idx in image_indices:
image = image_dataset[idx]["image"]
image = dataset[idx]["image"]
bgr = image[..., [2, 1, 0]]
camera_json = dataset_inputs.cameras.to_json(camera_idx=idx, image=bgr, resize_shape=(100, 100))
camera_json = dataset.inputs.cameras.to_json(camera_idx=idx, image=bgr, resize_shape=(100, 100))
self.vis[f"sceneState/cameras/{idx:06d}"].write(camera_json)
# draw the scene bounds (i.e., the bounding box)
json_ = dataset_inputs.scene_bounds.to_json()
json_ = dataset.inputs.scene_bounds.to_json()
self.vis["sceneState/sceneBounds"].write(json_)
# set the properties of the camera