karolyartur
commited on
Commit
·
23ab82c
1
Parent(s):
3a77c97
Load numpy files from file object
Browse files
SMVB.py
CHANGED
@@ -136,9 +136,12 @@ class SMVBDataset(datasets.GeneratorBasedBuilder):
|
|
136 |
for i, info in enumerate(data):
|
137 |
if file_infos and i%len(keys) == 0:
|
138 |
img_features_dict = {k:{'path':d[0],'bytes':d[1]} for k,d in zip(keys,file_infos) if k in ['image','mask']}
|
139 |
-
array_features_dict = {k:
|
140 |
data_dict = {**img_features_dict, **array_features_dict}
|
141 |
yield (i//len(keys))-1, data_dict
|
142 |
file_infos = []
|
143 |
file_path, file_object = info
|
144 |
-
|
|
|
|
|
|
|
|
136 |
for i, info in enumerate(data):
|
137 |
if file_infos and i%len(keys) == 0:
|
138 |
img_features_dict = {k:{'path':d[0],'bytes':d[1]} for k,d in zip(keys,file_infos) if k in ['image','mask']}
|
139 |
+
array_features_dict = {k:d[1] for k,d in zip(keys,file_infos) if not k in ['image','mask']}
|
140 |
data_dict = {**img_features_dict, **array_features_dict}
|
141 |
yield (i//len(keys))-1, data_dict
|
142 |
file_infos = []
|
143 |
file_path, file_object = info
|
144 |
+
if i%len(keys) < 2:
|
145 |
+
file_infos.append((file_path, file_object.read()))
|
146 |
+
else:
|
147 |
+
file_infos.append((file_path, np.load(file_object)))
|