jmc255 commited on
Commit
c5edc51
1 Parent(s): 30d8bff
Files changed (1) hide show
  1. aphantasia_drawing_dataset.py +21 -4
aphantasia_drawing_dataset.py CHANGED
@@ -164,8 +164,6 @@ class AphantasiaDrawingDataset(datasets.GeneratorBasedBuilder):
164
  subjects_data = json.load(subjects_file)
165
  idx = 0
166
  for sub in subjects_data:
167
- sub_id = subjects_data[sub]["subject_id"]
168
- trt = subjects_data[sub]["treatment"]
169
  for room in subjects_data[sub]["drawings"].keys():
170
  if subjects_data[sub]["drawings"][room]["perception"] != "":
171
  img_byt = base64.b64decode(subjects_data[sub]["drawings"][room]["perception"])
@@ -188,8 +186,8 @@ class AphantasiaDrawingDataset(datasets.GeneratorBasedBuilder):
188
  idx += 1
189
 
190
  yield idx-1, {
191
- "subject_id": sub_id,
192
- "treatment": trt,
193
  "demographics": {
194
  "country": subjects_data[sub]["demographics"]["country"],
195
  "age": subjects_data[sub]["demographics"]["age"],
@@ -203,6 +201,25 @@ class AphantasiaDrawingDataset(datasets.GeneratorBasedBuilder):
203
  "diff_explanation": subjects_data[sub]["demographics"]["diff_explanation"],
204
  "vviq_score": subjects_data[sub]["demographics"]["vviq_score"],
205
  "osiq_score": subjects_data[sub]["demographics"]["osiq_score"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  }
207
  }
208
 
 
164
  subjects_data = json.load(subjects_file)
165
  idx = 0
166
  for sub in subjects_data:
 
 
167
  for room in subjects_data[sub]["drawings"].keys():
168
  if subjects_data[sub]["drawings"][room]["perception"] != "":
169
  img_byt = base64.b64decode(subjects_data[sub]["drawings"][room]["perception"])
 
186
  idx += 1
187
 
188
  yield idx-1, {
189
+ "subject_id": subjects_data[sub]["subject_id"],
190
+ "treatment": subjects_data[sub]["treatment"],
191
  "demographics": {
192
  "country": subjects_data[sub]["demographics"]["country"],
193
  "age": subjects_data[sub]["demographics"]["age"],
 
201
  "diff_explanation": subjects_data[sub]["demographics"]["diff_explanation"],
202
  "vviq_score": subjects_data[sub]["demographics"]["vviq_score"],
203
  "osiq_score": subjects_data[sub]["demographics"]["osiq_score"]
204
+ },
205
+ "drawings": {
206
+ "kitchen": {
207
+ "perception": subjects_data[sub]["drawings"]["kitchen"]["perception"],
208
+ "memory": subjects_data[sub]["drawings"]["kitchen"]["perception"]
209
+ },
210
+ "livingroom": {
211
+ "perception": subjects_data[sub]["drawings"]["livingroom"]["perception"],
212
+ "memory": subjects_data[sub]["drawings"]["livingroom"]["memory"]
213
+ },
214
+ "bedroom": {
215
+ "perception": subjects_data[sub]["drawings"]["bedroom"]["perception"],
216
+ "memory": subjects_data[sub]["drawings"]["bedroom"]["memory"]
217
+ }
218
+ },
219
+ "image": {
220
+ "kitchen": subjects_data[sub]["image"]["kitchen"],
221
+ "livingroom": subjects_data[sub]["image"]["livingroom"],
222
+ "bedroom": subjects_data[sub]["image"]["bedroom"]
223
  }
224
  }
225