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

+2 -2
View File
@@ -254,7 +254,7 @@ class SemanticNerfWModel(Model):
# semantic loss
loss_dict["semantics_loss"] = self.config.semantic_loss_weight * self.cross_entropy_loss(
outputs["semantics"], batch["semantics"][..., 0].long()
outputs["semantics"], batch["semantics"][..., 0].long().to(self.device)
)
return loss_dict
@@ -301,6 +301,6 @@ class SemanticNerfWModel(Model):
images_dict["semantics_colormap"] = self.colormap.to(self.device)[semantic_labels]
# valid mask
images_dict["mask"] = batch["mask"].repeat(1, 1, 3)
images_dict["mask"] = batch["mask"].repeat(1, 1, 3).to(self.device)
return metrics_dict, images_dict