Commit 46fc1f92 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[utils] simplify the map_labels function

parent 77b652ca
Pipeline #26377 passed with stage
in 7 minutes and 22 seconds
......@@ -55,9 +55,10 @@ class CasiaWebFaceDataset(Dataset):
subject = int(path[-1])
self.data_files.append(os.path.join(root, name))
id_labels.append(subject)
self.id_labels = map_labels(id_labels, start_index)
def __len__(self):
"""Returns the length of the dataset (i.e. nb of examples)
......
......@@ -97,12 +97,12 @@ def map_labels(raw_labels, start_index=0):
# map back to native int, resolve the problem with dataset concatenation
# it does: line 78 is now ok
# for some reason, it was not working when the type of id labels were numpy.int64 ...
labels_int = []
for i in range(len(labels)):
labels_int.append(labels[i].item())
return labels_int
#labels_int = []
#for i in range(len(labels)):
# labels_int.append(labels[i].item())
#return labels_int
return labels
from torch.utils.data import Dataset
import bob.io.base
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment