From 359f955f3f9e46d112fa36ba7d48c25cd802f97a Mon Sep 17 00:00:00 2001 From: Kevin Chen <79341521+kevinddchen@users.noreply.github.com> Date: Wed, 26 Oct 2022 13:27:08 -0700 Subject: [PATCH] Fix skipping non-existent images (#832) Fix skipping non-existant images --- nerfstudio/data/dataparsers/nerfstudio_dataparser.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nerfstudio/data/dataparsers/nerfstudio_dataparser.py b/nerfstudio/data/dataparsers/nerfstudio_dataparser.py index 66cfbd967..afb66c657 100644 --- a/nerfstudio/data/dataparsers/nerfstudio_dataparser.py +++ b/nerfstudio/data/dataparsers/nerfstudio_dataparser.py @@ -17,7 +17,7 @@ from __future__ import annotations import math from dataclasses import dataclass, field -from pathlib import Path, PureWindowsPath +from pathlib import Path, PurePath from typing import Optional, Type import numpy as np @@ -80,12 +80,9 @@ class Nerfstudio(DataParser): num_skipped_image_filenames = 0 for frame in meta["frames"]: - if "\\" in frame["file_path"]: - filepath = PureWindowsPath(frame["file_path"]) - else: - filepath = Path(frame["file_path"]) + filepath = PurePath(frame["file_path"]) fname = self._get_fname(filepath) - if not fname: + if not fname.exists(): num_skipped_image_filenames += 1 else: image_filenames.append(fname) @@ -177,7 +174,7 @@ class Nerfstudio(DataParser): ) return dataparser_outputs - def _get_fname(self, filepath): + def _get_fname(self, filepath: PurePath) -> Path: """Get the filename of the image file.""" if self.downscale_factor is None: