mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 14:28:41 +08:00
dataloader memory leak
This commit is contained in:
1 parent
c113f29320
commit
ccf1dd5dc7
2 files changed
+5
-4
No files matched your search
@@ -34,6 +34,7 @@ from typing import (Any, Callable, Dict, ForwardRef, Generic, List, Literal,
|
|||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
from copy import deepcopy
|
||||||
from rich.progress import Console
|
from rich.progress import Console
|
||||||
from torch import Tensor, nn
|
from torch import Tensor, nn
|
||||||
from torch.nn import Parameter
|
from torch.nn import Parameter
|
||||||
@@ -270,7 +271,7 @@ class FullImageDatamanager(DataManager, Generic[TDataset]):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get_train_rays_per_batch(self):
|
def get_train_rays_per_batch(self):
|
||||||
# TODO (jake-austin): fix this to be the resolution of the last image rendered
|
# TODO: fix this to be the resolution of the last image rendered
|
||||||
return 800*800
|
return 800*800
|
||||||
|
|
||||||
def next_train(self, step: int) -> Tuple[Cameras, Dict]:
|
def next_train(self, step: int) -> Tuple[Cameras, Dict]:
|
||||||
@@ -282,7 +283,7 @@ class FullImageDatamanager(DataManager, Generic[TDataset]):
|
|||||||
if len(self.train_unseen_cameras) == 0:
|
if len(self.train_unseen_cameras) == 0:
|
||||||
self.train_unseen_cameras = [i for i in range(len(self.train_dataset))]
|
self.train_unseen_cameras = [i for i in range(len(self.train_dataset))]
|
||||||
|
|
||||||
data = self.cached_train[image_idx]
|
data = deepcopy(self.cached_train[image_idx])
|
||||||
data["image"] = data["image"].to(self.device)
|
data["image"] = data["image"].to(self.device)
|
||||||
|
|
||||||
assert len(self.train_dataset.cameras.shape) == 1, "Assumes single batch dimension"
|
assert len(self.train_dataset.cameras.shape) == 1, "Assumes single batch dimension"
|
||||||
@@ -308,7 +309,7 @@ class FullImageDatamanager(DataManager, Generic[TDataset]):
|
|||||||
|
|
||||||
Returns a Camera instead of raybundle
|
Returns a Camera instead of raybundle
|
||||||
|
|
||||||
TODO (jake-austin): Make sure this logic is consistent with the vanilladatamanager"""
|
TODO: Make sure this logic is consistent with the vanilladatamanager"""
|
||||||
image_idx = self.eval_unseen_cameras.pop(random.randint(0, len(self.eval_unseen_cameras)-1))
|
image_idx = self.eval_unseen_cameras.pop(random.randint(0, len(self.eval_unseen_cameras)-1))
|
||||||
# Make sure to re-populate the unseen cameras list if we have exhausted it
|
# Make sure to re-populate the unseen cameras list if we have exhausted it
|
||||||
if len(self.eval_unseen_cameras) == 0:
|
if len(self.eval_unseen_cameras) == 0:
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ dependencies = [
|
|||||||
"torchvision>=0.14.1",
|
"torchvision>=0.14.1",
|
||||||
"torchmetrics[image]>=1.0.1",
|
"torchmetrics[image]>=1.0.1",
|
||||||
"typing_extensions>=4.4.0",
|
"typing_extensions>=4.4.0",
|
||||||
"viser==0.1.3",
|
"viser==0.1.7",
|
||||||
"nuscenes-devkit>=1.1.1",
|
"nuscenes-devkit>=1.1.1",
|
||||||
"wandb>=0.13.3",
|
"wandb>=0.13.3",
|
||||||
"xatlas",
|
"xatlas",
|
||||||
|
|||||||
Reference in new issue
Block a user