mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 22:38:48 +08:00
nerfstudio dataparser: avoid loading images at inference time (#2051)
Also remove the image skipping logic, which seems to be a remnant of some old code (all images should exist) Co-authored-by: Frédéric Devernay <f-dy@users.noreply.github.com>
This commit is contained in:
1 parent
88b253f506
commit
e2e5637d05
2 files changed
+2
-12
No files matched your search
@@ -388,6 +388,8 @@ class VanillaDataManager(DataManager, Generic[TDataset]):
|
|||||||
else:
|
else:
|
||||||
self.config.data = self.config.dataparser.data
|
self.config.data = self.config.dataparser.data
|
||||||
self.dataparser = self.dataparser_config.setup()
|
self.dataparser = self.dataparser_config.setup()
|
||||||
|
if test_mode == "inference":
|
||||||
|
self.dataparser.downscale_factor = 1 # Avoid opening images
|
||||||
self.includes_time = self.dataparser.includes_time
|
self.includes_time = self.dataparser.includes_time
|
||||||
self.train_dataparser_outputs: DataparserOutputs = self.dataparser.get_dataparser_outputs(split="train")
|
self.train_dataparser_outputs: DataparserOutputs = self.dataparser.get_dataparser_outputs(split="train")
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ class Nerfstudio(DataParser):
|
|||||||
mask_filenames = []
|
mask_filenames = []
|
||||||
depth_filenames = []
|
depth_filenames = []
|
||||||
poses = []
|
poses = []
|
||||||
num_skipped_image_filenames = 0
|
|
||||||
|
|
||||||
fx_fixed = "fl_x" in meta
|
fx_fixed = "fl_x" in meta
|
||||||
fy_fixed = "fl_y" in meta
|
fy_fixed = "fl_y" in meta
|
||||||
@@ -109,9 +108,6 @@ class Nerfstudio(DataParser):
|
|||||||
for frame in meta["frames"]:
|
for frame in meta["frames"]:
|
||||||
filepath = Path(frame["file_path"])
|
filepath = Path(frame["file_path"])
|
||||||
fname = self._get_fname(filepath, data_dir)
|
fname = self._get_fname(filepath, data_dir)
|
||||||
if not fname.exists():
|
|
||||||
num_skipped_image_filenames += 1
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not fx_fixed:
|
if not fx_fixed:
|
||||||
assert "fl_x" in frame, "fx not specified in frame"
|
assert "fl_x" in frame, "fx not specified in frame"
|
||||||
@@ -159,14 +155,6 @@ class Nerfstudio(DataParser):
|
|||||||
depth_fname = self._get_fname(depth_filepath, data_dir, downsample_folder_prefix="depths_")
|
depth_fname = self._get_fname(depth_filepath, data_dir, downsample_folder_prefix="depths_")
|
||||||
depth_filenames.append(depth_fname)
|
depth_filenames.append(depth_fname)
|
||||||
|
|
||||||
if num_skipped_image_filenames >= 0:
|
|
||||||
CONSOLE.log(f"Skipping {num_skipped_image_filenames} files in dataset split {split}.")
|
|
||||||
assert (
|
|
||||||
len(image_filenames) != 0
|
|
||||||
), """
|
|
||||||
No image files found.
|
|
||||||
You should check the file_paths in the transforms.json file to make sure they are correct.
|
|
||||||
"""
|
|
||||||
assert len(mask_filenames) == 0 or (
|
assert len(mask_filenames) == 0 or (
|
||||||
len(mask_filenames) == len(image_filenames)
|
len(mask_filenames) == len(image_filenames)
|
||||||
), """
|
), """
|
||||||
|
|||||||
Reference in new issue
Block a user