fix: set index
Browse files
facial-emotion-recognition-dataset.py
CHANGED
@@ -76,8 +76,8 @@ class FacialEmotionRecognitionDataset(datasets.GeneratorBasedBuilder):
|
|
76 |
images = [sorted(images)[i:i + 8] for i in range(0, len(images), 8)]
|
77 |
|
78 |
for idx, images_set in enumerate(images):
|
79 |
-
set_id = int(images_set[0].split('/')[-2])
|
80 |
-
data = {'set_id':
|
81 |
|
82 |
for file in images_set:
|
83 |
if 'neutral' in file.lower():
|
@@ -98,10 +98,10 @@ class FacialEmotionRecognitionDataset(datasets.GeneratorBasedBuilder):
|
|
98 |
data['surprised'] = file
|
99 |
|
100 |
data['age'] = annotations_df.loc[annotations_df['set_id'] ==
|
101 |
-
|
102 |
data['gender'] = annotations_df.loc[annotations_df['set_id'] ==
|
103 |
-
|
104 |
data['country'] = annotations_df.loc[annotations_df['set_id'] ==
|
105 |
-
|
106 |
|
107 |
yield idx, data
|
|
|
76 |
images = [sorted(images)[i:i + 8] for i in range(0, len(images), 8)]
|
77 |
|
78 |
for idx, images_set in enumerate(images):
|
79 |
+
# set_id = int(images_set[0].split('/')[-2])
|
80 |
+
data = {'set_id': idx}
|
81 |
|
82 |
for file in images_set:
|
83 |
if 'neutral' in file.lower():
|
|
|
98 |
data['surprised'] = file
|
99 |
|
100 |
data['age'] = annotations_df.loc[annotations_df['set_id'] ==
|
101 |
+
idx]['age'].values[0]
|
102 |
data['gender'] = annotations_df.loc[annotations_df['set_id'] ==
|
103 |
+
idx]['gender'].values[0]
|
104 |
data['country'] = annotations_df.loc[annotations_df['set_id'] ==
|
105 |
+
idx]['country'].values[0]
|
106 |
|
107 |
yield idx, data
|