mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 14:58:55 +08:00
Option to process images on GPU for speed at the expense of memory (#2288)
* Fix pixel sampler cpu bottleneck cpu usage reduced 1700% -> 100%, and even more if using multi-gpu training * Convert to config option * Change optional to bool
This commit is contained in:
1 file changed
+5
-1
@@ -115,8 +115,10 @@ class DataManagerConfig(InstantiateConfig):
|
|||||||
"""Source of data, may not be used by all models."""
|
"""Source of data, may not be used by all models."""
|
||||||
camera_optimizer: Optional[CameraOptimizerConfig] = None
|
camera_optimizer: Optional[CameraOptimizerConfig] = None
|
||||||
"""Specifies the camera pose optimizer used during training. Helpful if poses are noisy."""
|
"""Specifies the camera pose optimizer used during training. Helpful if poses are noisy."""
|
||||||
masks_on_gpu: Optional[bool] = None
|
masks_on_gpu: bool = False
|
||||||
"""Process masks on GPU for speed at the expense of memory, if True."""
|
"""Process masks on GPU for speed at the expense of memory, if True."""
|
||||||
|
images_on_gpu: bool = False
|
||||||
|
"""Process images on GPU for speed at the expense of memory, if True."""
|
||||||
|
|
||||||
|
|
||||||
class DataManager(nn.Module):
|
class DataManager(nn.Module):
|
||||||
@@ -403,6 +405,8 @@ class VanillaDataManager(DataManager, Generic[TDataset]):
|
|||||||
self.exclude_batch_keys_from_device = self.train_dataset.exclude_batch_keys_from_device
|
self.exclude_batch_keys_from_device = self.train_dataset.exclude_batch_keys_from_device
|
||||||
if self.config.masks_on_gpu is True:
|
if self.config.masks_on_gpu is True:
|
||||||
self.exclude_batch_keys_from_device.remove("mask")
|
self.exclude_batch_keys_from_device.remove("mask")
|
||||||
|
if self.config.images_on_gpu is True:
|
||||||
|
self.exclude_batch_keys_from_device.remove("image")
|
||||||
|
|
||||||
if self.train_dataparser_outputs is not None:
|
if self.train_dataparser_outputs is not None:
|
||||||
cameras = self.train_dataparser_outputs.cameras
|
cameras = self.train_dataparser_outputs.cameras
|
||||||
|
|||||||
Reference in new issue
Block a user