Repository: nerfstudio-project/nerfstudio

Issue:
Rename train_split_percentage to train_split_fraction?
Here:
https://github.com/nerfstudio-project/nerfstudio/blob/main/nerfstudio/data/dataparsers/nerfstudio_dataparser.py#L63

The `train_split_percentage`parameter for the nerfstudio dataparser is actually a fraction (from 0 to 1), not a percentage (from 0 to 100), so the parameter should be named `train_split_fraction` (or simply `train_split`).

Help should read "The fraction (not percent) of images to use for training".

Or it could be done the other way round (percentage instead of fraction, the default being 90).


Discussion:
If you would like to make this change, Ill accept a PR.

Resolving patch:
diff --git a/nerfstudio/data/dataparsers/nerfstudio_dataparser.py b/nerfstudio/data/dataparsers/nerfstudio_dataparser.py
--- a/nerfstudio/data/dataparsers/nerfstudio_dataparser.py
+++ b/nerfstudio/data/dataparsers/nerfstudio_dataparser.py
@@ -60,8 +60,8 @@ class NerfstudioDataParserConfig(DataParserConfig):
     """Whether to center the poses."""
     auto_scale_poses: bool = True
     """Whether to automatically scale the poses to fit in +/- 1 bounding box."""
-    train_split_percentage: float = 0.9
-    """The percent of images to use for training. The remaining images are for eval."""
+    train_split_fraction: float = 0.9
+    """The fraction of images to use for training. The remaining images are for eval."""
     depth_unit_scale_factor: float = 1e-3
     """Scales the depth values to meters. Default value is 0.001 for a millimeter to meter conversion."""
 
@@ -184,7 +184,7 @@ def _generate_dataparser_outputs(self, split="train"):
 
         # filter image_filenames and poses based on train/eval split percentage
         num_images = len(image_filenames)
-        num_train_images = math.ceil(num_images * self.config.train_split_percentage)
+        num_train_images = math.ceil(num_images * self.config.train_split_fraction)
         num_eval_images = num_images - num_train_images
         i_all = np.arange(num_images)
         i_train = np.linspace(
diff --git a/nerfstudio/data/dataparsers/nuscenes_dataparser.py b/nerfstudio/data/dataparsers/nuscenes_dataparser.py
--- a/nerfstudio/data/dataparsers/nuscenes_dataparser.py
+++ b/nerfstudio/data/dataparsers/nuscenes_dataparser.py
@@ -66,7 +66,7 @@ class NuScenesDataParserConfig(DataParserConfig):
     mask_dir: Optional[Path] = None
     """Path to masks of dynamic objects."""
 
-    train_split_percentage: float = 0.9
+    train_split_fraction: float = 0.9
     """The percent of images to use for training. The remaining images are for eval."""
 
     verbose: bool = False
@@ -160,7 +160,7 @@ def _generate_dataparser_outputs(self, split="train"):
 
         # filter image_filenames and poses based on train/eval split percentage
         num_snapshots = len(samples)
-        num_train_snapshots = math.ceil(num_snapshots * self.config.train_split_percentage)
+        num_train_snapshots = math.ceil(num_snapshots * self.config.train_split_fraction)
         num_eval_snapshots = num_snapshots - num_train_snapshots
         i_all = np.arange(num_snapshots)
         i_train = np.linspace(
diff --git a/nerfstudio/data/dataparsers/phototourism_dataparser.py b/nerfstudio/data/dataparsers/phototourism_dataparser.py
--- a/nerfstudio/data/dataparsers/phototourism_dataparser.py
+++ b/nerfstudio/data/dataparsers/phototourism_dataparser.py
@@ -50,8 +50,8 @@ class PhototourismDataParserConfig(DataParserConfig):
     """How much to scale the camera origins by."""
     alpha_color: str = "white"
     """alpha color of background"""
-    train_split_percentage: float = 0.9
-    """The percent of images to use for training. The remaining images are for eval."""
+    train_split_fraction: float = 0.9
+    """The fraction of images to use for training. The remaining images are for eval."""
     scene_scale: float = 1.0
     """How much to scale the region of interest by."""
     orientation_method: Literal["pca", "up", "none"] = "up"
@@ -119,7 +119,7 @@ def _generate_dataparser_outputs(self, split="train"):
 
         # filter image_filenames and poses based on train/eval split percentage
         num_images = len(image_filenames)
-        num_train_images = math.ceil(num_images * self.config.train_split_percentage)
+        num_train_images = math.ceil(num_images * self.config.train_split_fraction)
         num_eval_images = num_images - num_train_images
         i_all = np.arange(num_images)
         i_train = np.linspace(


Test patch: