Reduce GPU memory usage in CacheDataloader (#1730)

* Reduce GPU memory usage in CacheDataloader

* Move also masks and seg.masks, depths to cpu

* Fix linter issues
This commit is contained in:
Jonáš Kulhánek authored and GitHub committed 2023-06-07 14:14:24 -04:00
1 parent d4b04376ab
commit 3b0f7581d8
10 files changed
+29 -11

No files matched your search

+1
View File
@@ -42,6 +42,7 @@ class InputDataset(Dataset):
scale_factor: The scaling factor for the dataparser outputs
"""
exclude_batch_keys_from_device: List[str] = ["image", "mask"]
cameras: Cameras
def __init__(self, dataparser_outputs: DataparserOutputs, scale_factor: float = 1.0):
@@ -31,6 +31,8 @@ class DepthDataset(InputDataset):
scale_factor: The scaling factor for the dataparser outputs.
"""
exclude_batch_keys_from_device = InputDataset.exclude_batch_keys_from_device + ["depth_image"]
def __init__(self, dataparser_outputs: DataparserOutputs, scale_factor: float = 1.0):
super().__init__(dataparser_outputs, scale_factor)
assert (
+2
View File
@@ -34,6 +34,8 @@ class SDFDataset(InputDataset):
scale_factor: The scaling factor for the dataparser outputs.
"""
exclude_batch_keys_from_device = InputDataset.exclude_batch_keys_from_device + ["depth", "normal"]
def __init__(self, dataparser_outputs: DataparserOutputs, scale_factor: float = 1.0):
super().__init__(dataparser_outputs, scale_factor)
@@ -32,6 +32,8 @@ class SemanticDataset(InputDataset):
dataparser_outputs: description of where and how to read input images.
"""
exclude_batch_keys_from_device = InputDataset.exclude_batch_keys_from_device + ["mask", "semantics"]
def __init__(self, dataparser_outputs: DataparserOutputs, scale_factor: float = 1.0):
super().__init__(dataparser_outputs, scale_factor)
assert "semantics" in dataparser_outputs.metadata.keys() and isinstance(self.metadata["semantics"], Semantics)