Skip to content

Commit

Permalink
update transform timing
Browse files Browse the repository at this point in the history
  • Loading branch information
nnaakkaaii committed Jul 4, 2024
1 parent e2c4d58 commit 76e0194
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions hrdae/dataloaders/datasets/ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ def __init__(
if in_memory:
for path in tqdm(self.paths, desc="loading datasets..."):
t = from_numpy(np.load(path)["arr_0"])
if transform is not None:
t = transform(t)
self.data.append(t)

self.slice_indexer = slice_indexer
Expand All @@ -119,8 +117,8 @@ def __getitem__(self, index: int) -> dict[str, Tensor]:
else: # not in memory
assert not self.in_memory
x_3d = from_numpy(np.load(str(self.paths[index]))["arr_0"])
if self.transform is not None:
x_3d = self.transform(x_3d)
if self.transform is not None:
x_3d = self.transform(x_3d)

x_3d = x_3d.float()
n, d, h, w = x_3d.size()
Expand Down

0 comments on commit 76e0194

Please sign in to comment.