karolyartur
commited on
Commit
·
e6109e1
1
Parent(s):
868fdaa
Fix dropping last sample issue
Browse files
SMVB.py
CHANGED
@@ -135,14 +135,14 @@ class SMVBDataset(datasets.GeneratorBasedBuilder):
|
|
135 |
keys = self.config.keys
|
136 |
|
137 |
for i, info in enumerate(data):
|
138 |
-
if file_infos and i%len(keys) == 0:
|
139 |
-
img_features_dict = {k:{'path':d[0],'bytes':d[1]} for k,d in zip(keys,file_infos) if k in ['image','mask']}
|
140 |
-
array_features_dict = {k:d[1] for k,d in zip(keys,file_infos) if not k in ['image','mask']}
|
141 |
-
data_dict = {**img_features_dict, **array_features_dict}
|
142 |
-
yield (i//len(keys))-1, data_dict
|
143 |
-
file_infos = []
|
144 |
file_path, file_object = info
|
145 |
if i%len(keys) < 2:
|
146 |
file_infos.append((file_path, file_object.read()))
|
147 |
else:
|
148 |
-
file_infos.append((file_path, np.load(io.BytesIO(file_object.read())).flatten()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
keys = self.config.keys
|
136 |
|
137 |
for i, info in enumerate(data):
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
file_path, file_object = info
|
139 |
if i%len(keys) < 2:
|
140 |
file_infos.append((file_path, file_object.read()))
|
141 |
else:
|
142 |
+
file_infos.append((file_path, np.load(io.BytesIO(file_object.read())).flatten()))
|
143 |
+
if (i+1)%len(keys) == 0:
|
144 |
+
img_features_dict = {k:{'path':d[0],'bytes':d[1]} for k,d in zip(keys,file_infos) if k in ['image','mask']}
|
145 |
+
array_features_dict = {k:d[1] for k,d in zip(keys,file_infos) if not k in ['image','mask']}
|
146 |
+
data_dict = {**img_features_dict, **array_features_dict}
|
147 |
+
yield (i//len(keys))-1, data_dict
|
148 |
+
file_infos = []
|