Fixed Unexpectedly huge RAM consumption of parallel datamanager (#3060)

* Reduced the memory usage by caching image after the datamanager process starts
This commit is contained in:
hyperzy authored and GitHub committed 2024-04-11 18:56:37 +00:00
1 parent 4714ae75f7
commit 03bdeff2ad
1 file changed
+1 -1
@@ -93,10 +93,10 @@ class DataProcessor(mp.Process): # type: ignore
self.exclude_batch_keys_from_device = self.dataset.exclude_batch_keys_from_device self.exclude_batch_keys_from_device = self.dataset.exclude_batch_keys_from_device
self.pixel_sampler = pixel_sampler self.pixel_sampler = pixel_sampler
self.ray_generator = RayGenerator(self.dataset.cameras) self.ray_generator = RayGenerator(self.dataset.cameras)
self.cache_images()
def run(self): def run(self):
"""Append out queue in parallel with ray bundles and batches.""" """Append out queue in parallel with ray bundles and batches."""
self.cache_images()
while True: while True:
batch = self.pixel_sampler.sample(self.img_data) batch = self.pixel_sampler.sample(self.img_data)
ray_indices = batch["indices"] ray_indices = batch["indices"]