Skip to content

Commit 528f78e

Browse files
committed
Putative gain in speed upon fetching images
1 parent 95730fc commit 528f78e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

model.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@ class Dataset:
2424

2525
def __init__(self, fnames):
2626
self.fnames = fnames
27+
self.data = io.imread_collection(fnames)
2728

2829
def __getitem__(self, index):
2930
if index >= len(self):
3031
raise StopIteration
3132

32-
fname = self.fnames[index]
33-
img = io.imread(fname)
3433
# TODO revert this at some point
35-
img = img[::5, ::5]
36-
return custom_types.Image(fname=fname, image=img)
34+
img = self.data[index][::5, ::5]
35+
return custom_types.Image(fname=self.fnames[index], image=img)
3736

3837
def __len__(self):
3938
return len(self.fnames)

0 commit comments

Comments
 (0)